Closed adilq93 closed 2 years ago
There should be no need to re-create or modify the order dict. Just pass the modify_order_option function the order you want to modify from your open orders.
orders = wb.get_current_orders()
op_order = orders[0]
modify_order_option(op_order, ...)
I tried that during market hours and was receiving a 500 error. I've noticed 500 errors are produced when you don't own the asset or have enough buying power for buys. I figured it is looking for the tickerId of the option because in webull.py I see that tickerType is set to 'OPTION' and tickerId that's being pulled in is a stock.
Without posting your code it's hard to tell what the issue is... I just tested this and it's working as expected here. I have removed some fileds to save space below.
wb.place_order_option(optionId=1021559540, lmtPrice='0.01', action='BUY', orderType='LMT', enforce='DAY', quant='1')
print(json.dumps(orders, indent=2))
[
{
"ticker": {
"tickerId": 913243251,
"symbol": "SPY",
"assetType": "option",
"orderType": "LMT",
"action": "BUY",
"status": "Submitted",
"statusCode": "Working",
"statusStr": "Working",
"lmtPrice": "0.0100",
"totalQuantity": "1",
wb.modify_order_option(order=orders[0], lmtPrice=0.02, quant=2)
True
print(json.dumps(wb.get_current_orders()[0], indent=2))
{
"ticker": {
"tickerId": 913243251,
"symbol": "SPY",
"assetType": "option",
"orderType": "LMT",
"action": "BUY",
"status": "Submitted",
"statusCode": "Working",
"statusStr": "Working",
"lmtPrice": "0.0200",
"totalQuantity": "2",
Hey there,
So i'm trying to use the modify option order method. It takes in the dictionary we get for get current orders. But the issue is that get current orders doesn't give the tickerId or optionId for the option, it only shows the tickerId for the actual ticker. For example, I have pasted in the return I got for an option order I placed that is still pending from get current orders
'openOrders':[ { 'ticker':{ 'tickerId':913303928, 'symbol':'FB', 'name':'Facebook', 'tinyName':'Facebook', 'listStatus':1, 'exchangeCode':'NSQ', 'exchangeId':96, 'type':2, 'regionId':6, 'currencyId':247, 'currencyCode':'USD', 'secType':[ 61 ], 'disExchangeCode':'NASDAQ', 'disSymbol':'FB' }, 'orderId':472285850769033216, 'brokerOrderId':'GFI0AJD1F4P2929CLTDAE1EDMB', 'brokerId':8, 'orderNum':'210723244067a', 'assetType':'option', 'orderType':'LMT', 'action':'BUY', 'status':'Submitted', 'statusCode':'Working', 'statusStr':'Working', 'lmtPrice':'1.000', 'totalQuantity':'1', 'filledQuantity':'0', 'createTime':'07/23/2021 09:40:51 EDT', 'createTime0':1627047651000, 'updateTime':'07/23/2021 09:40:52 EDT', 'updateTime0':1627047652000, 'remainQuantity':'1', 'entrustType':'QTY', 'timeInForce':'GTC', 'outsideRegularTradingHour':False, 'filledValue':'0.0000', 'orderSource':'Android', 'relation':'normal', 'priceTolerance':'0', 'canModify':True, 'canCancel':True, 'comboType':'NORMAL', 'comboId':'A3JU3IT5816M73RJGD22BH38OA', 'expireTime':'09/21/2021' },
ticker[tickerId] is just the tickerId for FB stock not the option. Is there a workaround for this so that we can see the optionId when we get current orders so that modify order option method works?
thank you