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

cannot place a stop order or stop-limit #428

Open
apimir opened this issue Dec 19, 2023 · 3 comments
Open

cannot place a stop order or stop-limit #428

apimir opened this issue Dec 19, 2023 · 3 comments

Comments

@apimir
Copy link

apimir commented Dec 19, 2023

I can't set stop orders:

wb.place_order(stock='CGEN', action='SELL', orderType='STP TRAIL', quant=1, trial_value='-5', enforce='DAY')
{'msg': 'GTX_NOT_SUPPORT_MARKET', 'code': '200', 'success': False}

wb.place_order(stock='CGEN', action='SELL', orderType='STP', quant=1, stpPrice=format(1.9, '.2f'), enforce='DAY')
{'msg': 'GTX_NOT_SUPPORT_MARKET', 'code': '200', 'success': False}

wb.place_order(stock='CGEN', price='1.68', stpPrice='1.78', action='SELL', orderType='STP LMT', quant=1, enforce='GTC', outsideRegularTradingHour=True)
{'msg': 'STOP_ORDER_NOT_SUPPORT_EXTEND_HOUR', 'code': '200', 'success': False}

wb.place_order(stock='CGEN', price='1.68', stpPrice='1.78', action='SELL', orderType='STP LMT', quant=1, enforce='GTC', outsideRegularTradingHour=False)
{'msg': 'CASH_ACCOUNT_CAN_NOT_SELL_SHORT', 'code': '200', 'success': False}

How to correct way to use place_order with action=SELL and orderType='STP'?

With orderType='LMT' everything works fine.

@ICANTFINDAUSERNAMEATALL
Copy link
Collaborator

In the last line, you need a lmtPrice instead of just price, I believe. Lmk if it works

@apimir
Copy link
Author

apimir commented Jan 5, 2024

it's did not work lmtPrice doesn't exist for place_order:

>>> help(wb.place_order)
Help on method place_order in module webull.webull:

place_order(stock=None, tId=None, price=0, action='BUY', orderType='LMT', enforce='GTC', quant=0, outsideRegularTradingHour=True, stpPrice=None, trial_value=0, trial_type='DOLLAR') method of webull.webull.webull instance
    Place an order
    
    price: float (LMT / STP LMT Only)
    action: BUY / SELL / SHORT
    ordertype : LMT / MKT / STP / STP LMT / STP TRAIL
    timeinforce:  GTC / DAY / IOC
    outsideRegularTradingHour: True / False
    stpPrice: float (STP / STP LMT Only)
    trial_value: float (STP TRIAL Only)
    trial_type: DOLLAR / PERCENTAGE (STP TRIAL Only)

But I have tried with another stock CNVS and it's works fine:

>>> wb.place_order(stock='CNVS', price='1', stpPrice='1.1', action='SELL', orderType='STP LMT', quant=1, enforce='GTC', outsideRegularTradingHour=False)
{'success': True, 'data': {'orderId': 'CRG6MP450248911EU01PPJM308'}}

I guess in first my post I tried to set wrong price, I mean according to this picture:
telegram-cloud-photo-size-1-4933917456389483709-x

You can't set Stop Loss Price below Stop limit Price and Stop Limit Price can't be more than your Buy Price

I think we can close the issue.

@winstonwilliamsiii
Copy link

I will try to use these WeBull API this week. Any new updates before I run the code?

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

3 participants