Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Stop limit order requested, but no stop price provided #429

Open
amanmaldar opened this issue Aug 15, 2023 · 3 comments
Open

'Stop limit order requested, but no stop price provided #429

amanmaldar opened this issue Aug 15, 2023 · 3 comments

Comments

@amanmaldar
Copy link

data = r.orders.order_buy_limit("TSLA",16,100,timeInForce='gtc',extendedHours=True)
print(data)

error -
{'non_field_errors': ['Stop limit order requested, but no stop price provided.']}

hi everyone, I am placing buy limit order but getting error related to stop limit order. My robin_stocks is updated to latest version 6

@joeld1
Copy link

joeld1 commented Aug 22, 2023

I'm also experiencing this issue on my mac. I'm also unable to specify the 24hr market in that method call.

@joeld1
Copy link

joeld1 commented Sep 5, 2023

I dove into the code and think that there's a mistake on how they arranged their positional arguments.

@login_required
def order_buy_limit(symbol, quantity, limitPrice, account_number=None, timeInForce='gtc', extendedHours=False, jsonify=True):
    # ...
    return order(symbol, quantity, "buy", account_number, limitPrice, None, timeInForce, extendedHours, jsonify)

The positional arguments don't align with the order method

@login_required
def order(symbol, quantity, side, limitPrice=None, stopPrice=None, account_number=None, timeInForce='gtc', extendedHours=False, jsonify=True, market_hours='regular_hours'):
    # ...
    pass

If you use keyword arguments according to how the order method is, you get the following which is incorrect:

@login_required
def order_buy_limit(symbol, quantity, limitPrice, account_number=None, timeInForce='gtc', extendedHours=False, jsonify=True):
    # ...
    order(symbol=symbol, quantity=quantity, side="buy", limitPrice=account_number, stopPrice=limitPrice, account_number=None, timeInForce=timeInForce, extendedHours=extendedHours, jsonify=jsonify)

The correct order of the arguments should be

@login_required
def order_buy_limit(symbol, quantity, limitPrice, account_number=None, timeInForce='gtc', extendedHours=False, jsonify=True):
    # ...
    return order(symbol, quantity, "buy", limitPrice, None, account_number, timeInForce, extendedHours, jsonify)

@jmfernandes Would it be unreasonable to refactor and use keyword arguments instead of positional arguments for whenever order is called?

Thanks!

@joeld1
Copy link

joeld1 commented Sep 26, 2023

@jmfernandes @henryzhangpku - Where possible, I refactored method calls to explicitly use keyword arguments instead of positional arguments. Those changes are found here #441 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants