From 565184a486eddad30d9faefef3d26d9cf30a2b07 Mon Sep 17 00:00:00 2001 From: Humza-Sami Date: Sun, 24 Dec 2023 16:22:10 +0500 Subject: [PATCH] Fix order_sell_stop_loss function argument order to resolve TypeError --- robin_stocks/robinhood/orders.py | 4 ++-- tests/test_robinhood.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/robin_stocks/robinhood/orders.py b/robin_stocks/robinhood/orders.py index 7e95d17..a33d448 100644 --- a/robin_stocks/robinhood/orders.py +++ b/robin_stocks/robinhood/orders.py @@ -434,7 +434,7 @@ def order_buy_stop_loss(symbol, quantity, stopPrice, account_number=None, timeIn the price, and the quantity. """ - return order(symbol, quantity, "buy", account_number, None, stopPrice, timeInForce, extendedHours, jsonify) + return order(symbol=symbol, quantity=quantity, side="buy", limitPrice=None, stopPrice=stopPrice, account_number=account_number, timeInForce=timeInForce, extendedHours=extendedHours, jsonify= jsonify) @login_required @@ -631,7 +631,7 @@ def order_sell_stop_loss(symbol, quantity, stopPrice, account_number=None, timeI the price, and the quantity. """ - return order(symbol, quantity, "sell", account_number, None, stopPrice, timeInForce, extendedHours, jsonify) + return order(symbol=symbol, quantity=quantity, side="sell", limitPrice=None, stopPrice=stopPrice, account_number=account_number, timeInForce=timeInForce, extendedHours=extendedHours, jsonify= jsonify) @login_required diff --git a/tests/test_robinhood.py b/tests/test_robinhood.py index 2f714ef..2b655ef 100644 --- a/tests/test_robinhood.py +++ b/tests/test_robinhood.py @@ -835,4 +835,8 @@ def isFloat(f): assert isFloat(order['quantity']) assert isFloat(order['cumulative_quantity']) if(order['state'] == 'filled'): - assert (order['quantity'] == order['cumulative_quantity']) \ No newline at end of file + assert (order['quantity'] == order['cumulative_quantity']) + + def test_stop_loss_order(cls): + order_details = r.order_sell_stop_loss() + assert ('account_number' in order_details) \ No newline at end of file