Closed dubleigh closed 2 years ago
@dubleigh
Hi, are you installing via pip? could you do:
pip install webull --upgrade
I have just updated the package on pypi, and please try again after it is updated.
Thanks!
Thank you Ted! Just upgraded via pip and am getting a similar reponse:
This is my code: result = wb.modify_order(orderId, price, action, orderType, enforce, quant, outsideRegularTradingHour) pp.pprint(result)
This is my response: File "/usr/local/lib/python3.8/dist-packages/webull/webull.py", line 495, in modify_order 'tickerId': order['ticker']['tickerId'], TypeError: 'int' object is not subscriptable
modify_order(self, order=None, price=0, action=None, orderType=None, enforce=None, quant=0, outsideRegularTradingHour=None)
I don't see orderId in the arguments? Can you check the code you posted again?
for the arguments, is "order" the orderId?
order: ? price: ## action: BUY / SELL ordertype: LMT / MKT / STP / STP LMT / STP TRAIL enforce/timeinforce: GTC / DAY / IOC quant: ## outsideRegularTradingHour: True / False
@dubleigh
I have updated the package to fixed the modify order:
can you do:
pip install webull --upgrade
then try this (please change the arguments to your own):
wb.modify_order(order_id=00000, stock='TSLA', price=999, action='BUY', orderType='LMT', enforce='GTC', quant=1, outsideRegularTradingHour=True)
Here's what I got
Code: order_id = ## stock = 'AAAA' price = ## action = 'SELL' orderType = 'LMT' enforce = 'GTC' quant = 15 outsideRegularTradingHour = True
result = wb.modify_order(order_id, stock, price, action,
orderType, enforce, quant, outsideRegularTradingHour)
pp.pprint(result)
Response:
File "/usr/local/lib/python3.8/dist-packages/webull/webull.py", line 481, in modify_order
modifiedLmtPrice = float(price or order['lmtPrice'])
ValueError: could not convert string to float: 'LMT'
what's your price? ##? (I think that is not too sensitive, you can post that part)
No prob its: order_id = 50637975636784#### stock = 'PDSB' price = 14 action = 'SELL' orderType = 'LMT' enforce = 'GTC' quant = 15 outsideRegularTradingHour = True
price = 14
looks correct, but the error doesn't seem to match with the value.
can you try
14.0
float(14)
instead of
14
?
can you copy paste your code exactly?
are you sure you didn't add '
next to your 14?
it looks like you manually typed it on here, if you copy paste the exact code, I think I can catch the error on your code.
No problem, here is the exact code:
order_id = 506379756367841280
stock = 'PDSB'
price = 14.00
action = 'SELL'
orderType = 'LMT'
enforce = 'GTC'
quant = 15
outsideRegularTradingHour = True
result = wb.modify_order(order_id, stock, price, action,
orderType, enforce, quant, outsideRegularTradingHour)
pp.pprint(result)
This is the response: File "/usr/local/lib/python3.8/dist-packages/webull/webull.py", line 481, in modify_order modifiedLmtPrice = float(price or order['lmtPrice']) ValueError: could not convert string to float: 'LMT'
nope, you can't do it like that, you have to specify the arguments, or else it will attempt the arguments in order, which causes mismatch.
order_id = 506379756367841280
stock = 'PDSB'
price = 14.00
action = 'SELL'
orderType = 'LMT'
enforce = 'GTC'
quant = 15
outsideRegularTradingHour = True
result = wb.modify_order(order_id=order_id, stock=stock, price=price, action=action,
orderType=orderType, enforce=enforce, quant=quant, outsideRegularTradingHour=outsideRegularTradingHour)
pp.pprint(result)
Ah well that would do it! Thanks for your help. I tried it again and got the below response:
{ 'lastSerialId': 'I3GK284JTBMQC3LIA1S6DG6EQ9', 'orderId': 506379756367841280, 'result': True}
@dubleigh please close the issue if your problem is solved. Thanks.
Will do. BTW your API is awesome
Hello - not sure this is an issue, or an error with my code
When attempting to modify an existing order, I get the following error: File "/usr/local/lib/python3.8/dist-packages/webull/webull.py", line 478, in modify_order 'tickerId': order['ticker']['tickerId'], TypeError: 'int' object is not subscriptable
TickerId is not a variable in webull.py: def modify_order(self, order=None, price=0, action=None, orderType=None, enforce=None, quant=0, outsideRegularTradingHour=None)
Should TickerId be included?
Thanks!