Open M1NL1TE opened 1 year ago
I haven't tried a modify order for paper options.
I haven't tried a modify order for paper options.
@michaelkkehoe May I ask how you found the endpoints for the modify options order and the other endpoints? Did you use something like wire shark or postman with the Webull desktop application? I've had difficulties with wire shark
$ cd /usr/local/WebullDesktop $ strings wbplugins/libtradestore.so | grep paper-center
$ cd /usr/local/WebullDesktop
$ strings wbplugins/libtradestore.so | grep paper-center
@michaelkkehoe Sorry to bother you again but when I try that command in my visual studio code git bash command terminal on Windows 10, it doesn't recognize the command. I was wondering what OS are you running with what terminal and what packages or anything else I would need to make it work with that command. Here's an example of my terminal:
@M1NL1TE It's a standard linux command. I found this using Webull Desktop application on my Ubuntu laptop.
@michaelkkehoe @tedchou12 Have you been successful with a modify option order with the 'https://act.webullbroker.com/webull-paper-center/api/paper/v1/order/optionReplace' endpoint?
I keep getting this response: 2023-05-25 12:42:58,193 INFO b'{"msg":"orderId=null","traceId":"b7ef3d8e73a84dda9b3d8146e2024d20","code":"400","success":false}'
and this is the request: 2023-05-25 12:42:58,192 INFO b'{"oderId": 105353561, "orderType": "LMT", "accountId": 12345, "paperId": 1, "timeInForce": "GTC", "serialId": "XYZ", "orders": [{"quantity": 1, "action": "BUY", "tickerId": 1038356919, "tickerType": "OPTION", "orderId": 105353561}], "lmtPrice": 1.29}'
(intentionally omitted possibly sensitive info)
And here is how I implemented the modify order function in webull.py: def modify_order_option(self, order=None, lmtPrice=None, stpPrice=None, enforce=None, quant=0): ''' order: dict from get_current_orders stpPrice: float lmtPrice: float enforce: GTC / DAY quant: int ''' headers = self.build_req_headers(include_trade_token=True, include_time=True) data = { 'oderId': order[0]['orderId'], 'orderType': order[0]['orderType'], 'accountId': self._account_id, 'paperId': 1, 'timeInForce': enforce or order[0]['timeInForce'], 'serialId': str(uuid.uuid4()), 'orders': [{'quantity': quant or order[0]['totalQuantity'], 'action': order[0]['action'], 'tickerId': order[0]['ticker']['tickerId'], 'tickerType': 'OPTION', 'orderId': order[0]['orderId']}] }
The main change I made to the regular account modify_order_option was taking out the "'comboId': order['comboId']" line in the data dictionary as I don't see that in the list of "openOrders" for the paper account. It's somehow not accepting the orderId from the request and I'm not sure why.
Here are the API endpoints:
https://act.webullbroker.com/webull-paper-center/api/paper/v1/order/getOptionAccountDetailAndPosition https://act.webullbroker.com/webull-paper-center/api/paper/v1/order/optionPlace https://act.webullbroker.com/webull-paper-center/api/paper/v1/order/optionReplace
Here is an example function to place option orders:
Originally posted by @michaelkkehoe in https://github.com/tedchou12/webull/issues/316#issuecomment-1408021185