Esempio n. 1
0
        private void OnRspQryInvestorPosition_callback(object sender, [In] ref PositionField position, int size1, bool bIsLast)
        {
            if (null == OnRspQryInvestorPosition)
            {
                return;
            }

            PositionField field = position;

            PositionClass cls = new PositionClass();

            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.Side        = (int)field.Side;
            cls.Side_String = Enum <XAPI.PositionSide> .ToString(field.Side);

            cls.HedgeFlag        = (int)field.HedgeFlag;
            cls.HedgeFlag_String = Enum <XAPI.HedgeFlagType> .ToString(field.HedgeFlag);

            cls.Date            = field.Date;
            cls.PositionCost    = field.PositionCost;
            cls.Position        = field.Position;
            cls.TodayPosition   = field.TodayPosition;
            cls.HistoryPosition = field.HistoryPosition;
            cls.HistoryFrozen   = field.HistoryFrozen;
            cls.TodayBSPosition = field.TodayBSPosition;
            cls.TodayBSFrozen   = field.TodayBSFrozen;
            cls.TodayPRPosition = field.TodayPRPosition;
            cls.TodayPRFrozen   = field.TodayPRFrozen;

            cls.PortfolioID1    = field.PortfolioID1;
            cls.PortfolioID2    = field.PortfolioID2;
            cls.PortfolioID3    = field.PortfolioID3;
            cls.Business        = (int)field.Business;
            cls.Business_String = Enum <XAPI.BusinessType> .ToString(field.Business);


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

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

                MessageQueue.Enqueue(qd);
            }
            else
            {
                OnRspQryInvestorPosition(this, cls, size1, bIsLast);
            }
        }
Esempio n. 2
0
        private void OnRspQryInvestorPosition_callback(object sender, ref PositionField position, int size1, bool bIsLast)
        {
            if (null == OnRspQryInvestorPosition)
                return;

            PositionField field = position;

            PositionClass cls = new PositionClass();

            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.Side = (int)field.Side;
            cls.Side_String = Enum<XAPI.PositionSide>.ToString(field.Side);
            cls.HedgeFlag = (int)field.HedgeFlag;
            cls.HedgeFlag_String = Enum<XAPI.HedgeFlagType>.ToString(field.HedgeFlag);

            cls.Date = field.Date;
            cls.PositionCost = field.PositionCost;
            cls.Position = field.Position;
            cls.TodayPosition = field.TodayPosition;
            cls.HistoryPosition = field.HistoryPosition;
            cls.HistoryFrozen = field.HistoryFrozen;
            cls.TodayBSPosition = field.TodayBSPosition;
            cls.TodayBSFrozen = field.TodayBSFrozen;
            cls.TodayPRPosition = field.TodayPRPosition;
            cls.TodayPRFrozen = field.TodayPRFrozen;

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

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