public DerivativeSymbolTick GetTick(bool getSpread, out BrokerErrorCode code) { DerivativeSymbolQuote Q = null; DerivativeSymbolSpread S = null; DerivativeSymbolTick T = new DerivativeSymbolTick(); StringBuilder sb = new StringBuilder(); code = _broker.GetDerivativeQuote(Instrument.Symbol, Instrument.InstrumentType, Instrument.ExpiryDate, Instrument.StrikePrice, out Q); // Check for exchange closed or contract disabled code if (code == BrokerErrorCode.Success) { T.Q = Q; sb.Append(Q.ToTickString()); } if (getSpread) { code = _broker.GetDerivativeSpread(Instrument.Symbol, Instrument.InstrumentType, Instrument.ExpiryDate, Instrument.StrikePrice, out S); if (code == BrokerErrorCode.Success) { T.S = S; sb.Append(";" + S.ToString()); } } if (code.Equals(BrokerErrorCode.Success) && (_writeTicks || MarketUtils.IsTimeTodayAfter915(Q.QuoteTime))) { _writeTicks = true; _ticksw.WriteLine(sb.ToString()); } return(T); }
public DerivativeSymbolQuoteRecord(DerivativeSymbolQuote dqi) { InstrumentType = dqi.InstrumentType; AssetUnderlying = dqi.UnderlyingSymbol; StrikePrice = dqi.StrikePriceDouble; ExpiryDate = DateTime.Parse(dqi.ExpiryDate); ContractName = StockUtils.GetInstrumentDescriptionString(InstrumentType, AssetUnderlying, ExpiryDate, StrikePrice); QuoteTime = dqi.QuoteTime; LastTradePrice = dqi.LastTradedPriceDouble; AssetPrice = dqi.AssetPrice; BidPrice = dqi.BestBidPriceDouble; OfferPrice = dqi.BestOfferPriceDouble; BidQty = dqi.BestBidQuantityInt; OfferQty = dqi.BestOfferQuantityInt; TradedQty = dqi.VolumeTradedInt; }