You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The order_sell_stop_loss function in orders.py is calling the order function with incorrect arguments. This leads to a TypeError when attempting to use the order_sell_stop_loss function.
Traceback (most recent call last):
File "your_script.py", line 1, in <module>
order = rs.robinhood.order_sell_stop_loss("SNDL", "1", 1.45)
File "~\anaconda3\Lib\site-packages\robin_stocks\robinhood\helper.py:33", in login_required.<locals>.login_wrapper(*args, **kwargs)
30 if not LOGGED_IN:
31 raise Exception('{} can only be called when logged in'.format(
32 func.__name__))
---> 33 return(func(*args, **kwargs))
File "~\anaconda3\Lib\site-packages\robin_stocks\robinhood\orders.py:634", in order_sell_stop_loss(symbol, quantity, stopPrice, account_number, timeInForce, extendedHours, jsonify)
610 @login_required
611 def order_sell_stop_loss(symbol, quantity, stopPrice, account_number=None, timeInForce='gtc', extendedHours=False, jsonify=True):
612 """Submits a stop order to be turned into a market order once a certain stop price is reached.
613
614 :param symbol: The stock ticker of the stock to sell.
(...)
632
633 """
--> 634 return order(symbol, quantity, "sell", account_number, None, stopPrice, timeInForce, extendedHours, jsonify)
File "~\anaconda3\Lib\site-packages\robin_stocks\robinhood\helper.py:33", in login_required.<locals>.login_wrapper(*args, **kwargs)
30 if not LOGGED_IN:
31 raise Exception('{} can only be called when logged in'.format(
32 func.__name__))
---> 33 return(func(*args, **kwargs))
File "~\anaconda3\Lib\site-packages\robin_stocks\robinhood\orders.py:837", in order(symbol, quantity, side, limitPrice, stopPrice, account_number, timeInForce, extendedHours, jsonify, market_hours)
834 else:
835 price = round_price(next(iter(get_latest_price(symbol, priceType, extendedHours)), 0.00))
836 payload = {
--> 837 'account': load_account_profile(account_number=account_number, info='url'),
838 'instrument': get_instruments_by_symbols(symbol, info='url')[0],
839 'symbol': symbol,
840 'price': price,
841 'quantity': quantity,
842 'ref_id': str(uuid4()),
843 'type': orderType,
844 'stop_price': stopPrice,
845 'time_in_force': timeInForce,
846 'trigger': trigger,
847 'side': side,
848 'market_hours': market_hours, # choices are ['regular_hours', 'all_day_hours']
849 'extended_hours': extendedHours,
850 'order_form_version': 4
851 }
852 # adjust market orders
853 if orderType == 'market':
File "~\anaconda3\Lib\site-packages\robin_stocks\robinhood\helper.py:33", in login_required.<locals>.login_wrapper(*args, **kwargs)
30 if not LOGGED_IN:
31 raise Exception('{} can only be called when logged in'.format(
32 func.__name__))
---> 33 return(func(*args, **kwargs))
File "~\anaconda3\Lib\site-packages\robin_stocks\robinhood\profiles.py:64", in load_account_profile(account_number, info)
6 @login_required
7 def load_account_profile(account_number=None, info=None):
8 """Gets the information associated with the accounts profile, including day
9 trading information and cash being held by Robinhood.
10 (...)
62
63 """
--> 64 url = account_profile_url(account_number)
65 if account_number is not None:
66 data = request_get(url)
File "~\anaconda3\Lib\site-packages\robin_stocks\robinhood\urls.py:19", in account_profile_url(account_number)
17 def account_profile_url(account_number=None):
18 if account_number:
--> 19 return('https://api.robinhood.com/accounts/'+account_number)
20 else:
21 return('https://api.robinhood.com/accounts/')
This error is solved by passing correct order arguments in order_sell_stop_loss function. I am going to update the function arguments and will create a pull request. @jmfernandes
The text was updated successfully, but these errors were encountered:
The
order_sell_stop_loss
function inorders.py
is calling theorder
function with incorrect arguments. This leads to aTypeError
when attempting to use theorder_sell_stop_loss
function.I am using this to place stop loss.
Steps to Reproduce:
Use the
order_sell_stop_loss
function:Error:
Order function declartion:
While its call in order_sell_stop_loss function:
This error is solved by passing correct order arguments in
order_sell_stop_loss
function. I am going to update the function arguments and will create a pull request. @jmfernandesThe text was updated successfully, but these errors were encountered: