Пример #1
0
        /// <summary>
        /// 取得未平倉資料
        /// </summary>
        /// <param name="data"></param>
        private void GetOpenInterest(RTDItem data)
        {
            if (!_CheckAccount(data))
            {
                return;
            }
            var op = from open in m_OpenInterestList
                     where open.CustNo == data.CustNo && open.ComID == data.ComID
                     select open;

            if (op.Count() == 0)
            {
                data.Value = -1;
                return;
            }
            OpenInterest item = op.First();

            switch (data.Item)
            {
            case "LOTS":
                data.Value = item.Qty * (item.BuySell == BuySell.B ? 1 : -1);
                break;

            case "MARKETPRICE":
                data.Value = item.MP;
                break;

            case "AVGPRICE":
                data.Value = item.AvgP;
                break;

            case "CLOSEPRICE":
                data.Value = item.YstCP;
                break;

            case "PL":
                data.Value = item.ProfitLoss;
                break;

            case "UPDATETIME":
                data.Value = item.UpdateTime;
                break;

            default:
                data.Value = -1;
                break;
            }
        }
Пример #2
0
 /// <summary>
 /// 海外期貨未平倉
 /// </summary>
 /// <param name="bstrData"></param>
 private void OnOverseaFutureOpenInterest(string bstrData)
 {
     if (!String.IsNullOrEmpty(bstrData))
     {
         if (bstrData.Contains("@@"))    //開始接收
         {
             WaitingPositionResponse = false;
             m_OpenInterestList      = new List <OpenInterest>();
         }
         else if (bstrData.Contains("##"))   //停止
         {
             m_RTDSvr.UpdateNotify();
         }
         else   //接收中
         {
             OpenInterest position = new OpenInterest(bstrData);
             m_OpenInterestList.Add(position);
         }
     }
 }