Add() 공개 메소드

public Add ( AccountReport report ) : void
report AccountReport
리턴 void
예제 #1
0
        // 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);
        }
예제 #2
0
 public void Add(AccountReport report)
 {
     Account.Add(report);
 }