I am trying to figure out how to handle crash recovery. Suppose, as my situation today is, that I have some running strategy and NT crashes while the strategy has an open position. I am using IB, so when I restart NT and reconnect to IB, NT actually knows about my orders and positions with IB (you can see them in the control center).
As per a post by NT staff, a strategy would not know about the fact that the position is its own position, and indeed, the control center orders tab does not show the strategy on the open stop order, does not show the position on the strategies tab, confirming that the connection between the position, the orders and the strategy is entirely lost.
However, if we maintain the assumption that I have at most one strategy active per symbol (this is something that I can control), then theoretically, the strategy can scan the account positions and discover the existing position and decide to manage it going forward. I don't know whether I can somehow discover the open stop order, as the Orders collection has nothing in it.
So these are my questions (under the assumption listed above):
- Is there any way for a strategy to recover open (working) orders from the account?
- Is there any way that a strategy, having discovered a position, can "take it over"? That is to say, can it reestablish the connection between the position and the strategy. so that the managed API will do the right thing? (it is my understanding that is I simply issue an ExitLong() while having a "disconnected position" that was left over from the crashed process, then what the API will actually do is start a short position...
- Alternatively, can the strategy temporarily switch to an unmanaged mode, issue a Sell() when it wants to exit the "orphan position" and then return to managed mode so that further transactions will use the managed API as normal? Would that do "the right thing"?
Comment