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


C# CoreLib.RawMarketData类代码示例

本文整理汇总了C#中CoreLib.RawMarketData的典型用法代码示例。如果您正苦于以下问题:C# RawMarketData类的具体用法?C# RawMarketData怎么用?C# RawMarketData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RawMarketData类属于CoreLib命名空间,在下文中一共展示了RawMarketData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        public Signal Run(RawMarketData rmd)
        {
            if (rmd == null)
            {
                return Signal.Stay;
            }

            if (Util.IsValidPrice(rmd.CurPrice))
            {
                _curFuturePrice = rmd.CurPrice;

                if (_curFuturePrice >= _upBarrier)
                {
                    return Signal.Rebalance;
                }
                else if (_curFuturePrice <= _downBarrier)
                {
                    return Signal.Rebalance;
                }
                return Signal.Stay;
            }
            else
            {
                return Signal.Stay;
            }
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:26,代码来源:Monitor_UnderlyingPrice.cs

示例2: GetRawMarketData

        public static RawMarketData GetRawMarketData()
        {
            RawMarketData rmd = new RawMarketData("test_code", Detail.ProductType.Unknown);

            rmd.AskPrice5 = 10;
            rmd.AskPrice4 = 9;
            rmd.AskPrice3 = 8;
            rmd.AskPrice2 = 7;
            rmd.AskPrice1 = 6;

            rmd.BidPrice1 = 5;
            rmd.BidPrice2 = 4;
            rmd.BidPrice3 = 3;
            rmd.BidPrice4 = 2;
            rmd.BidPrice5 = 1;

            rmd.AskCount5 = 10;
            rmd.AskCount4 = 20;
            rmd.AskCount3 = 30;
            rmd.AskCount2 = 40;
            rmd.AskCount1 = 50;

            rmd.BidCount1 = 55;
            rmd.BidCount2 = 45;
            rmd.BidCount3 = 35;
            rmd.BidCount4 = 25;
            rmd.BidCount5 = 15;

            rmd.LastUpdatedTime = DateTime.Now;

            return rmd;
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:32,代码来源:Generator.cs

示例3: KtbFutureTest

        void KtbFutureTest()
        {
            String future10yrCode = KtbFutureUtil.Ins().KtbFuture_10yr_1.Code;
            {
                TradingDirection longShort = TradingDirection.Long;
                string code = future10yrCode;
                long reqCount = 10;
                double reqPrice = 105.10;
                Account account = AccountManager.Ins().CreateSimFOAccount();

                IOrderLimit orderLimit = new DefaultOrderLimit(account);
                orderLimit = new LimOrderLimit(orderLimit);

                account.SetOrderLimit(orderLimit);

                RawMarketData rmdClone = new RawMarketData(future10yrCode, Detail.ProductType.KtbFuture);
                rmdClone.BidPrice1 = 105.10;
                rmdClone.AskPrice1 = 105.15;

                POrder target = new POrder(longShort, code, reqCount, reqPrice, account, rmdClone);
                bool success = POrderUtil.RequestOrder(target, null);
                Assert.AreEqual(true, success);

                target.UpdateCancelMessage(target.ReqCount);

                POrder_UnittestUtil.ClearOrder(target);
            }
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:28,代码来源:POrderTest.cs

示例4: SetData_Raw

 void SetData_Raw(RawMarketData rmd, String type, double value, DateTime dt)
 {
     switch (type)
     {
         case "CurPrice":
             rmd.CurPrice = value;
             break;
         case "AskCount1":
             rmd.AskCount1 = Convert.ToInt64(value);
             break;
         case "BidCount1":
             rmd.BidCount1 = Convert.ToInt64(value);
             break;
         case "AskPrice1":
             rmd.AskPrice1 = value;
             break;
         case "BidPrice1":
             rmd.BidPrice1 = value;
             break;
         case "Basis":
             break;
         case "CurRate":
             break;
         default:
             logger.Warn("Invalid {0}, {1}", type, value);
             break;
     }
     rmd.LastUpdatedTime = dt;
     LastUpdated = dt;
 }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:30,代码来源:KtbSpotBoard.cs

示例5: Decode_Raw

        public RawMarketData Decode_Raw(InPacket iPacket, String targetCode, DateTime curDateTime)
        {
            try
            {
                StringPacket sp = new StringPacket(iPacket.ToString().Substring(24));
                String code = sp.Decode();

                if (code != targetCode)
                {
                    return null;
                }

                RawMarketData rmd = new RawMarketData(targetCode, Detail.ProductType.Unknown);

                String type = sp.Decode();
                double value = Convert.ToDouble(sp.Decode());
                DateTime dt = DateTime.ParseExact(sp.Decode(), "yyyyMMdd HH:mm:ss.fff", null);

                SetData_Raw(rmd, type, value, dt);

                return rmd;
            }
            catch (System.Exception ex)
            {
                logger.Warn(ex.ToString());
            }
            return null;
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:28,代码来源:MarketDataDecoder_Infomax.cs

示例6: BeforeEnterSweeperChance

        // RMD clone을 만드는 등 데이터를 준비하는 역할을 수행한다.
        // build ot, adjust price, adjust count 등의 작업을 진행한다.
        public void BeforeEnterSweeperChance()
        {
            _instanceRmdFut1 = _referenceRmdFut1.Clone() as RawMarketData;

            // adjust count
            POrderBidAskCountManager.Ins().AdjustRmdCountWithoutMine(ref _instanceRmdFut1);
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:9,代码来源:Test_PB_HTSLeaf_MonitorEnter.cs

示例7: IsValidCondition

        Boolean IsValidCondition(RawMarketData rmd, RawMarketData rmdFuture)
        {
            if (!Util.IsValidRMDTimeAndPrice(rmdFuture) || !Util.IsValidRMDTimeAndPrice(rmd))
            {
                return false;
            }

            ArrayList arr = _context.TradingOrders;

            foreach (POrder o in arr)
            {
                if (o.LongShort == TradingDirection.Long)
                {
                    if (o.ReqPrice * 1.5 >= rmd.CurPrice)
                    {
                        return false;
                    }
                }
                else
                {
                    if (o.ReqPrice * 0.67 <= rmd.CurPrice)
                    {
                        return false;
                    }
                }
            }
            return true;
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:28,代码来源:OptionContOOR_Monitoring.cs

示例8: TestPOrderLegalData

        public void TestPOrderLegalData()
        {
            string code = "201EC260";
            RawMarketData rmd = new RawMarketData(code, Detail.ProductType.CallOption);
            rmd.BidPrice1 = 0.81000001F;
            rmd.BidCount1 = 1000;
            rmd.AskPrice1 = 0.81999999F;
            rmd.AskCount1 = 1000;

            Account simAccount = AccountManager.Ins().CreateSimFOAccount();

            POrder o0 = new POrder(TradingDirection.Long, code, 1, 0.81, simAccount, rmd);
            POrderLegalManager.Ins().Add(o0);

            {

                POrder o2 = new POrder(TradingDirection.Long, code, 1, 0.81, simAccount, rmd);
                Boolean success = POrderLegalManager.Ins().Remove(o2);
                Assert.AreEqual(success, false);
            }

            {
                POrder o = new POrder(TradingDirection.Short, code, 1, 0.8099998, simAccount, rmd);
                POrder_Accessor oAccessor = new POrder_Accessor(o);
                oAccessor.ReqPrice = 0.810006;

                Boolean legal = POrderLegalManager.Ins().IsLegalOrder(o, false);
                Assert.AreEqual(legal, false);

                o.SetAsLegalPrice();
                legal = POrderLegalManager.Ins().IsLegalOrder(o, false);
                Assert.AreEqual(legal, true);

                Util.LogOutCriticalError("\t\t # Non exist code search 1 permitted.");
                Boolean success = POrderLegalManager.Ins().Remove(o);
                Assert.AreEqual(success, false);

                POrderLegalManager.Ins().Add(o);

                POrder o2 = new POrder(TradingDirection.Short, code, 1, 0.8099998, simAccount, rmd);
                success = POrderLegalManager.Ins().Remove(o2);
                Assert.AreEqual(success, false);

                // test reverse
                {
                    POrder o3 = new POrder(TradingDirection.Long, code, 1, 0.83, simAccount, rmd);
                    POrder_Accessor oAccessor3 = new POrder_Accessor(o3);
                    oAccessor3.ReqPrice = 0.83;

                    legal = POrderLegalManager.Ins().IsLegalOrder(o3, false);
                    Assert.AreEqual(legal, false);

                    POrderLegalManager.Ins().Remove(o3);
                }
                POrderLegalManager.Ins().Remove(o2);
                POrderLegalManager.Ins().Remove(o);
            }
            POrderLegalManager.Ins().Remove(o0);
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:59,代码来源:POrderLegalDataTest.cs

示例9: IsValidCurPrice

 public static Boolean IsValidCurPrice(RawMarketData rmd)
 {
     if (rmd.CurPrice == double.MaxValue || rmd.CurPrice == double.MinValue || rmd.CurPrice == 0)
     {
         return false;
     }
     return true;
 }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:8,代码来源:RawMarketDataUtil.cs

示例10: AdjustRmdCountWithoutMine

        // 기존에 나가 있는 주문 수량을 고려해준다.
        // 하나의 기회에 대해서 순간적으로 많은 주문을 낼 수 있으므로 이렇게 해주도록 한다.
        public void AdjustRmdCountWithoutMine(ref RawMarketData rmd)
        {
            long myLongReqCount = GetRegisteredReqCount(rmd.Code, TradingDirection.Long, rmd.AskPrice1);
            rmd.AskCount1 = Math.Max(rmd.AskCount1 - myLongReqCount, 0);

            long myShortReqCount = GetRegisteredReqCount(rmd.Code, TradingDirection.Short, rmd.BidPrice1);
            rmd.BidCount1 = Math.Max(rmd.BidCount1 - myShortReqCount, 0);
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:10,代码来源:POrdersBidAskCountManager.cs

示例11: GetOneUnitPnL

        public double GetOneUnitPnL(
            Position_KtbSkel position, RawMarketData spotRmdClone, RawMarketData futureRmdClone)
        {
            double spotProfit = spotRmdClone.BidPrice1 - position.SpotAvgPriceTimeAdjust;
            double futureProfit = (position.FutureAvgPrice - futureRmdClone.AskPrice1) * 100;

            double pnl = spotProfit + futureProfit;
            return pnl;
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:9,代码来源:MonitorExit_KtbSkel.cs

示例12: MonitorEnter_KtbSkel

        public MonitorEnter_KtbSkel(RawMarketData spotRmd, RawMarketData futureRmd, IMonitorEnterPolicy policy)
        {
            this._spotRmd = spotRmd;
            this._futureRmd = futureRmd;
            this._policy = policy;

            ValidateInputs();
            MakeInfoLog();
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:9,代码来源:MonitorEnter_KtbSkel.cs

示例13: Add

        public void Add(DateTime dt, RawMarketData y, RawMarketData x)
        {
            MarketDataPair pair = new MarketDataPair();
            pair.CurDateTime = dt;
            pair.Y = y;
            pair.X = x;

            _data.Put(pair);
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:9,代码来源:PairMarketDataRegression.cs

示例14: GetIndicator

        public MonitorDatum_KtbSkel GetIndicator(
            RawMarketData spotRmdThisTurn, RawMarketData futureRmdThisTurn)
        {
            try
            {
                double spotMidPrice = (spotRmdThisTurn.AskPrice1 + spotRmdThisTurn.BidPrice1) / 2;
                double futureMidPrice = (futureRmdThisTurn.AskPrice1 + futureRmdThisTurn.BidPrice1) / 2;

                double spotMidRate =
                    BondPriceRateMapManager.Ins().ConvertToRate(spotRmdThisTurn.Code, (int)spotMidPrice);

                double spotBidRate = BondPriceRateMapManager.Ins().ConvertToRate(
                    spotRmdThisTurn.Code, (int)spotRmdThisTurn.BidPrice1);
                double spotAskRate = BondPriceRateMapManager.Ins().ConvertToRate(
                    spotRmdThisTurn.Code, (int)spotRmdThisTurn.AskPrice1);

                double futureMidRate =
                    BondPriceRateMapManager.Ins().ConvertToRate(futureRmdThisTurn.Code, (int)(futureMidPrice * 100));
                double futureBidRate =
                    BondPriceRateMapManager.Ins().ConvertToRate(
                    futureRmdThisTurn.Code, (int)(futureRmdThisTurn.BidPrice1 * 100));
                double futureAskRate =
                    BondPriceRateMapManager.Ins().ConvertToRate(
                    futureRmdThisTurn.Code, (int)(futureRmdThisTurn.AskPrice1 * 100));

                double curSpotRate = spotMidRate;
                double curFutureRate = futureMidRate * (-1);

                String spotLog = String.Format("S {0:n0}({1:n5}) // {2:n0}({3:n5}) // {4:n0}({5:n5})",
                    spotRmdThisTurn.AskPrice1, spotAskRate,
                    spotMidPrice, spotMidRate,
                    spotRmdThisTurn.BidPrice1, spotBidRate);

                String futureLog = String.Format("F {0:n2}({1:n5}) // {2:n2}({3:n5}) // {4:n2}({5:n5})",
                    futureRmdThisTurn.AskPrice1, futureAskRate,
                    futureMidPrice, futureMidRate,
                    futureRmdThisTurn.BidPrice1, futureBidRate);

                double curIndicator = (curSpotRate + curFutureRate) * 10000;
                DateTime lastUpdated = DateTime.Now;

                MonitorDatum_KtbSkel datum = new MonitorDatum_KtbSkel();
                datum.CurIndicator = curIndicator;
                datum.FutureLog = futureLog;
                datum.SpotLog = spotLog;
                datum.LastUpdated = lastUpdated;

                return datum;
            }
            catch (System.Exception ex)
            {
                logger.Error(ex.ToString());
                Util.KillWithNotice(ex.ToString());
            }
            return null;
        }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:56,代码来源:StaticRateDiff.cs

示例15: GetIfExitPnL

 public Dictionary<int, double> GetIfExitPnL(RawMarketData rmd)
 {
     Dictionary<int, double> ret = new Dictionary<int, double>();
     foreach (KeyValuePair<int, ISweeper> sweeper in _liveSweepers)
     {
         double pnl = sweeper.Value.GetIfExitPnL(rmd);
         ret.Add(sweeper.Key, pnl);
     }
     return ret;
 }
开发者ID:HongSeokHwan,项目名称:legacy,代码行数:10,代码来源:LivePosition.cs


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