Flatten/CancelAll from API

Custom indicators, trading strategies, data export and recording and more...
fenepet965
Posts: 24
Joined: Wed May 26, 2021 12:13 pm
Has thanked: 2 times

Flatten/CancelAll from API

Post by fenepet965 » Thu Aug 19, 2021 12:29 pm

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?
 

Svyatoslav
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

Post by Svyatoslav » Thu Aug 19, 2021 4:26 pm

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.

mpxtreme
Posts: 33
Joined: Thu Oct 25, 2018 12:20 am
Been thanked: 6 times

Re: Flatten/CancelAll from API

Post by mpxtreme » Thu Aug 19, 2021 10:27 pm

 
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)

Post Reply