accountSelector.SelectedAccount.PositionUpdate += OnPositionUpdate;
to subscribe to position updates
for this i will get all open positions relating to this account : in order to filter down to a specific instrument ; within OnPositionUpdate i access the position fields eg
e.Position.Instrument.FullName
what would be the best safest way to compare this with a particular instrument i am looking at .. just a string compare on the Fullname of each?
Also ... i am subscribing to the OnBarUpdate for a BarsRequest - i note in the sample code and framework example of having to loop ......
/* Depending on the BarsPeriod type of your barsRequest you can have situations where more than one bar is updated by a single tick
Be sure to process the full range of updated bars to ensure you did not miss a bar. */
// Option 1. If you want to process updated bars on each tick
for (int i = e.MinIndex; i <= e.MaxIndex; i++)
{
// Processing every single tick
outputBox.Text = string.Format("REALTIME BARS{0}Time: {1}{0}Open: {2}{0}High: {3}{0}Low: {4}{0}Close: {5}",
Environment.NewLine,
e.BarsSeries.GetTime(i),
e.BarsSeries.GetOpen(i),
e.BarsSeries.GetHigh(i),
e.BarsSeries.GetLow(i),
e.BarsSeries.GetClose(i));
}
If i am only wanting bar updates for the current live bar ie there is not lookback for number of bars or days of bars ... i dont need to do the above and simply use
e.BarsSeries.GetClose(e.MaxIndex)
?
what situation for example would one have where more than one bar is updated by a single tick ? and then needing to process the full range of updated bars to ensure you did not miss a bar? If i am only subscribing with no lookback ; this does not apply?
thanks
Comment