Page 1 of 1

Flatten/CancelAll from API

Posted: Thu Aug 19, 2021 12:29 pm
by fenepet965
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?
 

Re: Flatten/CancelAll from API

Posted: Thu Aug 19, 2021 4:26 pm
by Svyatoslav
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.

Re: Flatten/CancelAll from API

Posted: Thu Aug 19, 2021 10:27 pm
by mpxtreme
 
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)