-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
Modify options order: #402
Comments
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 |
@michaelkkehoe |
@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 #316 (comment)
The text was updated successfully, but these errors were encountered: