Example #1
0
        // -----------------------------------------------------------
        /// <summary>获取合约最新行情</summary>
        /// <param name="instrumentID">合约代码</param>
        /// <returns>最新行情,无数据时返回null</returns>
        public MD getMarketData(String instrumentID)
        {
            List <MD> tempList = marketData[instrumentIndex[instrumentID]];
            MD        result   = null;

            if (tempList.Count > 0)
            {
                result = tempList[tempList.Count - 1];
            }
            tempList = null;
            return(result);
        }
Example #2
0
        /// <summary>行情数据返回:更新本地数据</summary>
        /// ??根据合约ID 触发对应回调?
        private void onRtnDepthMarketData(String[] resStr)
        {
            MD md = new MD();

            md.SetData(resStr);

            int index = instrumentIndex[md.InstrumentID];

            marketData[index - 1].Add(md);

            int  thisCount  = marketData[index - 1].Count;
            long thisVolume = 0;

            if (thisCount >= 2)
            {
                thisVolume = marketData[index - 1][thisCount - 1].Volume - marketData[index - 1][thisCount - 2].Volume;
            }
            FormTool.DisplayMarketData(md.GetData(thisVolume));
        }