Hi,
Does bookmap provide any option to trigger the Flatten or Cancel All function from API? If not, do you have any plan these capabilities to the API or is there any good workaround for this?
Flatten/CancelAll from API
-
- Posts: 24
- Joined: Wed May 26, 2021 12:13 pm
- Has thanked: 2 times
-
- Site Admin
- Posts: 278
- Joined: Mon Jun 11, 2018 11:44 am
- Has thanked: 2 times
- Been thanked: 31 times
Re: Flatten/CancelAll from API
Unfortunately there is no way to do it with single action, but you can do it as below:
To cancel all you need to issue a cancellation requests on all orders. Ideally you should group those into a batch using OrderCancelParameters#batchId and OrderCancelParameters#batchEnd.
To actually flatten you should send a market order of corresponding size. You can set a hint SimpleOrderSendParameters#closingPositionHint which will tell the adapter that if it has a better implementation than just blindly following your order - it can use that instead.
To cancel all you need to issue a cancellation requests on all orders. Ideally you should group those into a batch using OrderCancelParameters#batchId and OrderCancelParameters#batchEnd.
To actually flatten you should send a market order of corresponding size. You can set a hint SimpleOrderSendParameters#closingPositionHint which will tell the adapter that if it has a better implementation than just blindly following your order - it can use that instead.
Re: Flatten/CancelAll from API
Despite not being able to access those specific BM button functions through the API just yet...with a bit of work,a lot can be done.
Here is one example of what can be accomplished with the API's current capabilities related to trade execution.
KB Pro from FintechVisuals on the Bookmap Marketplace.
https://marketplace.bookmap.com/product ... ution-pro/
Reach out if desired.
(I consult for FV)