Ejemplo n.º 1
0
        static void InitBondArbNodeInputs(STR_Arb strategy, STR_ArbInput input, ref _InnerObjectsForUnittest innerData)
        {
            StrategyNode node = new StrategyNode();
            innerData.BondArbNode = node;

            node.InitRoot_1(strategy);

            innerData.BondArbNodeEnterLimit = new EnterConditionLimit(
                Util.ConvertFormatStringToInt64(input.BondArb_MaxLiveSweepCount),
                Util.ConvertFormatStringToInt64(input.BondArb_MaxNewSweepCount));

            node.InitEnterLimit_2(innerData.BondArbNodeEnterLimit);

            DateTime dtStart = DateUtil.GetTodayDateTime(9 + Const.kHourAdjustment_Start, 0, 0);
            DateTime dtEnd = DateUtil.GetTodayDateTime(12 + 2 + Const.kHourAdjustment_End, 37, 00);

            innerData.BondArbNodeMonitorLimit = new MonitorLimit_Time(dtStart, dtEnd);

            node.InitMonitorTimeLimit_3(innerData.BondArbNodeMonitorLimit);

            SweeperCollectionDefault sweeperCollection = new SweeperCollectionDefault();
            innerData.BondArbSweeperLeaf = sweeperCollection;

            node.InitSweeperCollection_4(sweeperCollection);

            innerData.BondArb_MonitorEnter = new MonitorEnter_BondArb(node);
            node.InitMonitorEnter_5(innerData.BondArb_MonitorEnter);

            strategy.AddNode(node, STR_Arb.NodeType.BondArb);
        }
Ejemplo n.º 2
0
        public static STR_Arb Build(String inputJson, String strategyName, ref _InnerObjectsForUnittest innerData)
        {
            innerData.Input = GetInput(inputJson);

            if (!innerData.Input.IsValidInput())
            {
                return null;
            }

            // 1. Root에 설정해야 하는 부분을 설정한다.
            // 1.1. 전략이름
            innerData.Arb = new STR_Arb(strategyName);

            InitRootInputs(innerData.Arb, innerData.Input, ref innerData);

            // 2. BondNode를 설정한다.
            InitBondArbNodeInputs(innerData.Arb, innerData.Input, ref innerData);

            // 3. CalFutNode를 설정한다.
            InitCalFutNodeInputs(innerData.Arb, innerData.Input, ref innerData);

            // 마지막으로 strategy validation진행
            innerData.Arb.ValidateInits_Last();

            return innerData.Arb;
        }
Ejemplo n.º 3
0
        public static void MyClassInitialize(TestContext testContext)
        {
            ConfigManager.Ins().Initialize("c:\\UnittestMadViper\\config.txt");
            DB_DataLoader_Kospi_Future.Ins().Load();
            DB_DataLoader_Option.Ins().Load();
            DB_DataLoader_Elw.Ins().Load();

            String inputJson = STR_ArbBuilder.GetInputTemplate();
            g_innerData = new _InnerObjectsForUnittest();
            STR_ArbBuilder.Build(inputJson, "STR_Arb_Unittest", ref g_innerData);
        }
Ejemplo n.º 4
0
        public static STR_Arb Build(String inputJson, String strategyName)
        {
            _InnerObjectsForUnittest innerData = new _InnerObjectsForUnittest();

            return Build(inputJson, strategyName, ref innerData);
        }
Ejemplo n.º 5
0
        static void InitRootInputs(STR_Arb strategy, STR_ArbInput input, ref _InnerObjectsForUnittest innerData)
        {
            TossClientSession.Ins().StartReadSession();

            // 1.2. Account
            strategy.InitAccount_1(input.Root_BondAccountName, input.Root_FutureAccountName);

            // 1.3. Agent
            strategy.InitAgent_2();

            strategy.InitDefaultBondOrderLimit_3_1(input.BondArb_MaxNotionalPerOnce);
            strategy.InitEmptyRMDBondOrderLimit_3_2(input.BondArb_MaxNotionalPerOnce);
            strategy.InitDefaultFutureOrderLimit_3_3(input.Future_MaxCountPerOnce);

            // 1.5. EnterLimit
            strategy.InitEnterLimit_4(input.Root_MaxLiveSweepCount, input.Root_MaxNewSweepCount);

            // 1.6. MonitorLimit
            strategy.InitMonitorLimitWithMarketDataAccount_5();
        }
Ejemplo n.º 6
0
        static void InitCalFutNodeInputs(STR_Arb strategy, STR_ArbInput input, ref _InnerObjectsForUnittest innerData)
        {
            StrategyNode node = new StrategyNode();
            innerData.CalFutNode = node;

            node.InitRoot_1(strategy);

            innerData.CalFutNodeEnterLimit = new EnterConditionLimit(
                Util.ConvertFormatStringToInt64(input.CalFut_MaxLiveSweepCount),
                Util.ConvertFormatStringToInt64(input.CalFut_MaxNewSweepCount));

            node.InitEnterLimit_2(innerData.CalFutNodeEnterLimit);

            DateTime dtStart = DateUtil.GetTodayDateTime(9 + Const.kHourAdjustment_Start, 0, 0);
            DateTime dtEnd = DateUtil.GetTodayDateTime(12 + 3 + Const.kHourAdjustment_End, 4, 00);

            innerData.CalFutNodeMonitorLimit = new MonitorLimit_Time(dtStart, dtEnd);

            node.InitMonitorTimeLimit_3(innerData.CalFutNodeMonitorLimit);

            SweeperCollectionDefault sweeperCollection = new SweeperCollectionDefault();
            innerData.CalFutSweeperLeaf = sweeperCollection;

            node.InitSweeperCollection_4(sweeperCollection);

            innerData.CalFut_MonitorEnter = new MonitorEnter_CalFut(
                node,
                Detail.ProductType.KospiFuture,
                KospiFutureUtil.Ins().KFSI.FutureCode1,
                KospiFutureUtil.Ins().KFSI.Code,
                KospiFutureUtil.Ins().KFSI.FutureCode2,
                MonitorEnter_CalFut.ForwardBackward.Forward);

            node.InitMonitorEnter_5(innerData.CalFut_MonitorEnter);

            strategy.AddNode(node, STR_Arb.NodeType.CalFut);
        }