Example #1
0
        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);
        }
Example #2
0
 public SymbolTick(bool allocateD)
 {
     if (allocateD)
     {
         D = new DerivativeSymbolTick();
     }
     else
     {
         E = new EquitySymbolTick();
     }
 }