Пример #1
0
        private void OnRspQryInstrument_callback(object sender, [In] ref InstrumentField instrument, int size1, bool bIsLast)
        {
            if (null == OnRspQryInstrument)
            {
                return;
            }

            InstrumentField field = instrument;

            InstrumentClass cls = new InstrumentClass();

            cls.InstrumentName = field.InstrumentName();
            cls.Symbol         = field.Symbol;
            cls.InstrumentID   = field.InstrumentID;
            cls.ExchangeID     = field.ExchangeID;
            cls.ClientID       = field.ClientID;
            cls.AccountID      = field.AccountID;

            cls.ExchangeInstID = field.ExchangeInstID;

            cls.Type        = (int)field.Type;
            cls.Type_String = Enum <XAPI.InstrumentType> .ToString(field.Type);

            cls.VolumeMultiple = field.VolumeMultiple;
            cls.PriceTick      = field.PriceTick;
            cls.ExpireDate     = field.ExpireDate;
            cls.StrikePrice    = field.StrikePrice;

            cls.OptionsType        = (int)field.OptionsType;
            cls.OptionsType_String = Enum <XAPI.PutCall> .ToString(field.OptionsType);

            cls.ProductID         = field.ProductID;
            cls.UnderlyingInstrID = field.UnderlyingInstrID;

            cls.InstLifePhase        = (int)field.InstLifePhase;
            cls.InstLifePhase_String = Enum <XAPI.InstLifePhaseType> .ToString(field.InstLifePhase);

            if (null == OnRspQryInstrument)
            {
                QueueData qd = new QueueData();
                qd.Type        = (int)ResponseType.OnRspQryInstrument;
                qd.Type_String = Enum <XAPI.ResponseType> .ToString(ResponseType.OnRspQryInstrument);

                qd.Sender = this;
                qd.Data1  = cls;
                qd.Data2  = size1;
                qd.Data3  = bIsLast;

                MessageQueue.Enqueue(qd);
            }
            else
            {
                OnRspQryInstrument(this, cls, size1, bIsLast);
            }
        }
Пример #2
0
        private void OnRspQryInstrument_callback(object sender, ref InstrumentField instrument, int size1, bool bIsLast)
        {
            if (null == OnRspQryInstrument)
                return;

            InstrumentField field = instrument;

            InstrumentClass cls = new InstrumentClass();

            cls.InstrumentName = field.InstrumentName();
            cls.Symbol = field.Symbol;
            cls.InstrumentID = field.InstrumentID;
            cls.ExchangeID = field.ExchangeID;
            cls.ClientID = field.ClientID;
            cls.AccountID = field.AccountID;

            cls.ExchangeInstID = field.ExchangeInstID;

            cls.Type = (int)field.Type;
            cls.Type_String = Enum<XAPI.InstrumentType>.ToString(field.Type);

            cls.VolumeMultiple = field.VolumeMultiple;
            cls.PriceTick = field.PriceTick;
            cls.ExpireDate = field.ExpireDate;
            cls.StrikePrice = field.StrikePrice;

            cls.OptionsType = (int)field.OptionsType;
            cls.OptionsType_String = Enum<XAPI.PutCall>.ToString(field.OptionsType);

            cls.ProductID = field.ProductID;
            cls.UnderlyingInstrID = field.UnderlyingInstrID;

            cls.InstLifePhase = (int)field.InstLifePhase;
            cls.InstLifePhase_String = Enum<XAPI.InstLifePhaseType>.ToString(field.InstLifePhase);

            if (null == OnRspQryInstrument)
            {
                QueueData qd = new QueueData();
                qd.Type = (int)ResponeType.OnRspQryInstrument;
                qd.Type_String = Enum<XAPI.ResponeType>.ToString(ResponeType.OnRspQryInstrument);
                qd.Sender = this;
                qd.Data1 = cls;
                qd.Data2 = size1;
                qd.Data3 = bIsLast;

                MessageQueue.Enqueue(qd);
            }
            else
            {
                OnRspQryInstrument(this, ref cls, size1, bIsLast);
            }
        }