FastQuant.Stop.GetInstrumentPrice C# (CSharp) Méthode

GetInstrumentPrice() protected méthode

protected GetInstrumentPrice ( ) : double
Résultat double
        protected virtual double GetInstrumentPrice()
        {
            if (this.position.Side == PositionSide.Long)
            {
                var bid = this.strategy.framework.DataManager.GetBid(this.instrument);
                if (bid != null)
                    return GetPrice(bid.Price);
            }

            if (this.position.Side == PositionSide.Short)
            {
                var ask = this.strategy.framework.DataManager.GetAsk(this.instrument);
                if (ask != null)
                    return GetPrice(ask.Price);
            }

            var trade = this.strategy.framework.DataManager.GetTrade(this.instrument);
            if (trade != null)
                return GetPrice(trade.Price);

            var bar = this.strategy.framework.DataManager.GetBar(this.instrument);
            return bar != null ? GetPrice(bar.Close) : 0;
        }