Skip to main content Skip to footer

OnPositionUpdate - a handler to handle a position update events.

Position is a class that describes current open position for specific instrument. Each Position instance is generated by broker. Pay attention that all properties of position are read-only and cannot be changed in instance after its creation.In other words, position is immutable and, consequently is thread-safe. That's why Position has no any change events. Once you get the reference to the position object, you can be sure that all its properties won't change. It means that each time a position is changing a broker adapter creates a new instance, so each position changed event is accompanied by new instance. Also, each position list request may generate new instances of positions (depending on broker adapter implementation).So, never compare positions by object references. Use Instrument or Order.OrderId instead. Pay attention that constructors of position are hidden and the class is abstract. It is impossible to create position outside. The position can be created by broker only. And each broker must create its own derived classes to be able to create position instances.

protected override void OnPositionUpdate(TradeManagerClass tradeManager, Position position)
{
    //Write your code here
}

Cookies Notice

We use cookies to improve your experience, personalize content, and analyze our traffic. By clicking "Accept All Cookies," you agree to the storing of cookies on your device. You can manage your cookie preferences at any time by visiting our Cookie Settings.