当前位置: 首页>>代码示例>>C#>>正文


C# TickImpl.ToString方法代码示例

本文整理汇总了C#中TradeLink.Common.TickImpl.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# TickImpl.ToString方法的具体用法?C# TickImpl.ToString怎么用?C# TickImpl.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TradeLink.Common.TickImpl的用法示例。


在下文中一共展示了TickImpl.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnNxCoreExgQuote

        static unsafe void OnNxCoreExgQuote(NxCoreSystem* pNxCoreSys, NxCoreMessage* pNxCoreMsg)
        {
            if (keepcurrent && (STATUS < 4)) return;
            if (DOLIVESKIPTEST)
            {
                if (pNxCoreSys->nxTime.MsOfDay < (DateTime.UtcNow.TimeOfDay.TotalMilliseconds - (DateTime.Now.IsDaylightSavingTime() ? (1000 * 60 * 60 * 4) : (1000 * 60 * 60 * 5))))
                    return;
                DOLIVESKIPTEST = false;
                D("NxCore starting realtime data");
            }
            // Get the symbol for category message

            int idx = _nxsyms.getindex(new string(&pNxCoreMsg->coreHeader.pnxStringSymbol->String));
            if (idx < 0) return;
            if (!_nxsyms[idx]) return;

            // Assign a pointer to the ExgQuote data
            NxCoreExgQuote* Quote = &pNxCoreMsg->coreData.ExgQuote;
            NxCoreQuote cq = Quote->coreQuote;
            // Get bid and ask price
            double bid = 0;
            double ask = 0;
            int bs = 0;
            int os = 0;
            string be = string.Empty;
            string oe = string.Empty;
            bool bbid = false;
            bool bask = false;
            if ((cq.BidPriceChange != 0) || (cq.BidSizeChange != 0))
            {
                bid = NxCore.PriceToDouble(Quote->coreQuote.BidPrice, Quote->coreQuote.PriceType);
                bs = Quote->coreQuote.BidSize;
                be = excode2name(Quote->BestBidExg);
                bbid = true;
            }
            if ((cq.AskPriceChange != 0) || (cq.AskSizeChange != 0))
            {
                ask = NxCore.PriceToDouble(Quote->coreQuote.AskPrice, Quote->coreQuote.PriceType);
                os = Quote->coreQuote.AskSize;
                oe = excode2name(Quote->BestAskExg);
                bask = true;
            }
            if (bask || bbid)
            {
                NxTime time = pNxCoreMsg->coreHeader.nxExgTimestamp;
                int tltime = time.Hour * 10000 + time.Minute * 100 + time.Second;
                NxDate date = pNxCoreMsg->coreHeader.nxSessionDate;
                int tldate = (int)date.Year * 10000 + (int)date.Month * 100 + (int)date.Day;
                Tick k = new TickImpl();
                k.symbol = _realsym2nxidx.getlabel(idx);
                k.date = tldate;
                k.time = tltime;
                if (bask && bbid)
                {
                    k.bid = (decimal)bid;
                    k.bs = bs;
                    k.be = be;
                    k.ask = (decimal)ask;
                    k.os = os;
                    k.oe = oe;
                }
                else if (bbid)
                {
                    k.bid = (decimal)bid;
                    k.bs = bs;
                    k.be = be;
                }
                else
                {
                    k.ask = (decimal)ask;
                    k.os = os;
                    k.oe = oe;
                }
                try
                {
                    tl.newTick(k);
                }
                catch (Exception ex)
                {
                    D("bad tick: " + k.ToString() + " " + ex.Message + ex.StackTrace);
                }
            }
        }
开发者ID:antonywu,项目名称:tradelink,代码行数:83,代码来源:ServerNxCore.cs


注:本文中的TradeLink.Common.TickImpl.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。