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


C# POrder.IsDone方法代码示例

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


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

示例1: IsSame

        public static Boolean IsSame(POrder a, POrder b)
        {
            if (a.IsDone() || b.IsDone())
            {
                return false;
            }

            if (a.ContractedCount > 0 ||
                b.ContractedCount > 0)
            {
                return false;
            }

            if (a.IsCancelRemains() ||
                b.IsCancelRemains())
            {
                return false;
            }

            if (a.Code.CompareTo(b.Code) == 0 &&
                a.ReqCount == b.ReqCount &&
                a.ReqPrice == b.ReqPrice &&
                a.LongShort == b.LongShort &&
                a.TargetAccount == b.TargetAccount)
            {
                return true;
            }
            return false;
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:29,代码来源:POrderUtil.cs

示例2: CancelRemainsTest

        public void CancelRemainsTest()
        {
            long reqCount = 3;
            double reqPrice = 220.0;

            Account account = AccountManager.Ins().CreateSimFOAccount();
            IOrderLimit orderLimit = new DefaultOrderLimit(account);
            orderLimit = new CountBidAskRangeOrderLimit(orderLimit);
            orderLimit = new PriceBidAskRangeOrderLimit(orderLimit);
            orderLimit = new LimOrderLimit(orderLimit);

            account.SetOrderLimit(orderLimit);

            SimHTS target = account.Hts as SimHTS;

            string code = KospiFutureUtil.Ins().KFI.Code;
            string price = reqPrice.ToString("n0");
            string quantity = Convert.ToString(reqCount);

            RawMarketData rmd = RmdManager.Ins().GetData(KospiFutureUtil.Ins().KFI.Code);

            rmd.BidPrice1 = 220;
            rmd.AskPrice1 = 225;
            rmd.BidCount1 = 100;
            rmd.AskCount1 = 101;

            {
                POrder o = new POrder(TradingDirection.Long, code, reqCount, reqPrice, account, rmd);
                Assert.AreEqual(o.IsInputValidated, true);

                bool expected = true;
                bool actual;

                actual = account.RequestOrder(o);

                Assert.AreEqual(expected, actual);

                SimPOrder simOrder = new SimPOrder(o, 1500);

                simOrder.Execute();

                StringPacket inOrderPacket = simOrder.GetContractPacket(SimPOrder.접수);
                target.ReceiveDTRealEventHandler(inOrderPacket.GetStream());

                account.HandleCallBackData();

                o.CancelRemains();
                StringPacket cancelPacket = simOrder.GetCancelPacket();
                target.ReceiveDTRealEventHandler(cancelPacket.GetStream());

                account.HandleCallBackData();

                Assert.AreEqual(o.IsDone(), true);
                Assert.AreEqual(o.CanceledCount, o.ReqCount);

                POrderLegalManager.Ins().Remove(o);
                POrderBidAskCountManager.Ins().Unregister(o);
            }

            {
                POrder o = new POrder(TradingDirection.Long, code, reqCount, reqPrice, account, rmd);
                Assert.AreEqual(o.IsInputValidated, true);

                bool expected = true;
                bool actual;

                actual = account.RequestOrder(o);

                Assert.AreEqual(expected, actual);

                SimPOrder simOrder = new SimPOrder(o, 1500);

                simOrder.Execute();

                StringPacket inOrderPacket = simOrder.GetContractPacket(SimPOrder.접수);
                target.ReceiveDTRealEventHandler(inOrderPacket.GetStream());

                simOrder.CurTotalContractedCount = reqCount;
                StringPacket contractCompletePacket = simOrder.GetContractPacket(SimPOrder.전량체결);
                target.ReceiveDTRealEventHandler(contractCompletePacket.GetStream());

                o.CancelRemains();

                account.HandleCallBackData();

                Assert.AreEqual(o.IsDone(), true);
                Assert.AreEqual(o.CanceledCount, 0);
                Assert.AreEqual(o.ContractedCount, o.ReqCount);

                POrderLegalManager.Ins().Remove(o);
                POrderBidAskCountManager.Ins().Unregister(o);
            }
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:93,代码来源:SimHTSTest.cs

示例3: GetSignedMaxPossibleExposureCount

        public static long GetSignedMaxPossibleExposureCount(POrder o)
        {
            long count = 0;

            long tmp = o.ReqCount;
            if (o.IsDone())
            {
                tmp = o.ContractedCount;
            }

            if (o.LongShort == TradingDirection.Short)
            {
                tmp = tmp * (-1);
            }
            count += tmp;

            return count;
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:18,代码来源:POrderUtil.cs


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