public Add ( |
||
report | ||
Результат | void |
// TODO: rewrite it internal void OnFill(Fill fill, bool queued = true) { Fills.Add(fill); this.framework.EventServer.OnFill(this, fill, queued); var instrument = fill.Instrument; bool flag = false; var position = PositionsByInstrumentId[instrument.Id] ?? GetOrCreatePosition(instrument); if (position.Amount == 0) { flag = true; } position.Add(fill); Account.Add(fill, false); if (flag) { Statistics.OnPositionChanged(position); this.framework.EventServer.OnPositionChanged(this, position, queued); Statistics.OnPositionOpened(position); this.framework.EventServer.OnPositionOpened(this, position, queued); } else { if (fill.Qty > position.Qty && position.Amount != 0.0 && ((fill.Side == OrderSide.Buy && position.Side == PositionSide.Long) || (fill.Side == OrderSide.Sell && position.Side == PositionSide.Short))) { Statistics.OnPositionSideChanged(position); } if (position.Amount != 0.0) { Statistics.OnPositionChanged(position); } this.framework.EventServer.OnPositionChanged(this, position, queued); if (position.Amount == 0.0) { Statistics.OnPositionClosed(position); this.framework.EventServer.OnPositionClosed(this, position, queued); } } if (UpdateParent) { Parent?.OnFill(fill, queued); } Statistics.OnFill(fill); }
public void Add(AccountReport report) { Account.Add(report); }