I was looking for the API equivalent of the "set liquidate last" of Interactive Brokers (or a similar feature to control auto-liquidation priority). Does anyone know if this can be also set via API and on which object/method to look for this setting? Thanks
That does not appear to be an API feature. It is odd you would be looking for this! lol. Do you have a trading strategy that needs to control IB automated liquidations because you are headed to skid row?
If a feature is in place one might have a chance to take advantage of it. Or else one must rely only on his own code (and hardware). (Which may be as good as it gets, but not always cover all that can happen.) We may all be headed to skid row sometimes in our life. It depends on many factors, some of which are not completely under our control
The idea of automated trading is that you as the developer make the decision which positions to liquidate when and in what order. I don't see a reason why you would ever need this feature built into the api. The api offers you information on your available funds and margin requirements and hence you can determine at any point in time how far you are from a deficit and then decide which positions to liquidate first and last.
Well, if they do not have it, there is no much point in talking about it. If it were in place, I would use it, along with all the other means and features. (Following that line of thought you should not have it in the TWS too, because at any time you can see the margin requirements and decide what to close.) I know what the API offers in relation to margin computations, but this world is not perfect, and there may be things that can go in a way one did not envision earlier or that momentarily cannot be controlled directly It would be nice to have. That is all. (But we can still survive and print $$$ without.)
Your comparison with tws does not make sense. The reason it's in TWS is because the assumption is that no api is monitoring margin deficits, it's a feature in TWS to help users who are not constantly sitting behind the screen. If you automate via api then you can let the api monitor it for you via all the currently given features of the api. It is absolutely not necessary to have it in the api.
<OffTopic>It's good to hear people are planning for doomsday. Smells like a market bottom.</OffTopic>