tedchou12 / webull

Unofficial APIs for Webull.
MIT License
601 stars 184 forks source link

interesting problem where Order info doesn't have the TickerId for options! #230

Open Hamze24w opened 3 years ago

Hamze24w commented 3 years ago

Hi, I've been using this awesome api for some time now, I'm pretty aquainted with it. I've faced an interesting problem , I'm getting the current orders of options , (wb.get_current_orders) and this usually has the tickerId of the stock and of the option contract. my current program is acting just fine but I'm using a new webull account for another strategy, this one is a margin account, and interesingly, when I get the current orders the same way that the current production program is working, it does not have the TickerId of the option! here's a sample

[{'ticker': {'tickerId': 913243251, 'symbol': 'SPY', 'name': 'SPDR® S&P 500 ETF Trust', 'tinyName': 'SPDR® S&P 500 ETF Trust', 'listStatus': 1, 'exchangeCode': 'PSE', 'exchangeId': 34, 'type': 3, 'regionId': 6, 'currencyId': 247, 'currencyCode': 'USD', 'secType': [1, 34, 12], 'exchangeTrade': True, 'disExchangeCode': 'NYSEARCA', 'disSymbol': 'SPY'}, 'orderId': 445519348493723648, 'brokerOrderId': 'EKIM241O1U91F6CCMRLJD384K8', 'brokerId': 8, 'orderNum': '21051030c00ae', 'assetType': 'option', 'orderType': 'LMT', 'action': 'SELL', 'status': 'Submitted', 'statusCode': 'Working', 'statusStr': 'Working', 'lmtPrice': '0.2500', 'totalQuantity': '1', 'filledQuantity': '0', 'createTime': '05/10/2021 13:00:20 EDT', 'createTime0': 1620666020000, 'updateTime': '05/10/2021 13:00:20 EDT', 'updateTime0': 1620666020000, 'remainQuantity': '1', 'entrustType': 'QTY', 'timeInForce': 'DAY', 'outsideRegularTradingHour': False, 'filledValue': '0.0000', 'orderSource': 'other', 'relation': 'normal', 'priceTolerance': '0', 'canModify': True, 'canCancel': True, 'comboType': 'NORMAL', 'comboId': 'B8J2RN56ST6S62LRN6USCTMVKA', 'expireTime': 'Day'}]

now this raises problems, I was able to use find my order using it's comboID , but the problem is that the modify_order_option() function itself assumes that the ticker ID that's in ['ticker']['tickerId'] is for the contract (but as you see it starts with 9 which is usually for the stocks) . so I'm unable to modify my orders. now this works like a charm in the other account which I think is a cash account, so I'm suspecting it has to do with the account type.

can somebody help me with this?

enochlev commented 3 years ago

In my cash account, I have the same problem. I even modified the tickerId to the optionId and it still returned an error. Currently I am just canceling and rebuying as an alternative.

adilq93 commented 3 years ago

I am having same issue with modify order option. I am receiving a 500 error if I try to modify an option order every time.

Hamze24w commented 3 years ago

I am having same issue with modify order option. I am receiving a 500 error if I try to modify an option order every time.

I've been canceling and rebuying instead. modify works perfectly on the margin account, but not the cash accounts, just cancel and reopen.