public EDoorEachMonitorEnterController(
     EDoorMonitorEnterController parent,
     KospiOptionInfo koi_0,
     KospiOptionInfo koi_1,
     KospiOptionInfo koi_2,
     KospiOptionInfo koi_3,
     KospiOptionInfo koi_4,
     ElwInfo ei)
 {
     this.Parent = parent;
     this._data = new EDoorEachMonitorEnterData(this, koi_0, koi_1,
         koi_2, koi_3, koi_4, ei);
     this._monitorEnter = new MonitorState(this);
 }
Exemplo n.º 2
0
        public static MonitorState.MonitorDataThisTurn CreateThisTurnInput(
            EDoorEachMonitorEnterData eachData)
        {
            MonitorState.MonitorDataThisTurn monitorData =
                new MonitorState.MonitorDataThisTurn();

            monitorData.RmdKoi_0 =
                RmdManager.Ins().GetDataClone(eachData.KOI_0.Code);
            monitorData.RmdKoi_1 =
                RmdManager.Ins().GetDataClone(eachData.KOI_1.Code);
            monitorData.RmdKoi_2 =
                RmdManager.Ins().GetDataClone(eachData.KOI_2.Code);
            monitorData.RmdKoi_3 =
                RmdManager.Ins().GetDataClone(eachData.KOI_3.Code);
            monitorData.RmdKoi_4 =
                RmdManager.Ins().GetDataClone(eachData.KOI_4.Code);
            monitorData.RmdElw =
                RmdManager.Ins().GetDataClone(eachData.EI.Code);

            return monitorData;
        }
Exemplo n.º 3
0
        void CalculateElwReqPriceTest(
            MonitorState_Accessor ms,
            MonitorState.MonitorDataThisTurn monitorData,
            EDoorEachMonitorEnterData eachData)
        {
            String elwCode = monitorData.RmdElw.Code;
            ElwInfo ei = ElwUtil.GetElwInfo(elwCode);

            //1. Elw 가격이 없는 경우
            // 4's koi가격
            SetAsDefaultPrice(monitorData);
            double actual = ms.CalculateElwReqPrice(monitorData, eachData);
            double expected =
                ElwOptionUtil.ConvertOptionPriceToElwPrice(ei, 0.8);
            Assert.AreEqual(expected, actual);

            //2. Elw 가격이 있는데 4's koi가격보다 낮은 경우
            // 4's koi가격
            double elwPrice =
                ElwOptionUtil.ConvertOptionPriceToElwPrice(ei, 0.5);
            monitorData.RmdElw.BidPrice1 = elwPrice;
            actual = ms.CalculateElwReqPrice(monitorData, eachData);
            expected =
                ElwOptionUtil.ConvertOptionPriceToElwPrice(ei, 0.8);
            Assert.AreEqual(expected, actual);

            //3. Elw 가격이 3's koi bidPrice보다 작은 경우
            // Elw BidPrice + 1tick 가격이 리턴
            double elwPriceOfKoi_3 = ElwOptionUtil.ConvertOptionPriceToElwPrice(
                ei, monitorData.RmdKoi_3.BidPrice1);
            TickValue tv = ProductUtil.Ins().GetTick(elwCode, elwPriceOfKoi_3);
            double elwBidPrice = elwPriceOfKoi_3 - tv.DownTickValue * 2;
            expected = elwPriceOfKoi_3 - tv.DownTickValue;
            monitorData.RmdElw.BidPrice1 = elwBidPrice;
            actual = ms.CalculateElwReqPrice(monitorData, eachData);
            Assert.AreEqual(expected, actual);

            //4. Elw 가격이 2's koi bidPrice보다 작은 경우(3's koi 초과)
            // 3's koi BidPrice해당 BidPrice
            double elwPriceOfKoi_2 = ElwOptionUtil.ConvertOptionPriceToElwPrice(
                ei, monitorData.RmdKoi_2.BidPrice1);
            tv = ProductUtil.Ins().GetTick(elwCode, elwPriceOfKoi_2);
            elwBidPrice = elwPriceOfKoi_2 - tv.DownTickValue * 2;
            expected = ElwOptionUtil.ConvertOptionPriceToElwPrice(
                ei, monitorData.RmdKoi_3.BidPrice1);
            monitorData.RmdElw.BidPrice1 = elwBidPrice;
            actual = ms.CalculateElwReqPrice(monitorData, eachData);
            Assert.AreEqual(expected, actual);

            //5. Elw 가격이 너무 낮은 경우(4's koi)
            SetAsDefaultPrice(monitorData);
            actual = ms.CalculateElwReqPrice(monitorData, eachData);
            expected =
                ElwOptionUtil.ConvertOptionPriceToElwPrice(ei, 0.8);
            Assert.AreEqual(expected, actual);

            //6. Koi 0's 가격이 너무 낮은 경우(-1)
            SetAsDefaultPrice(monitorData);
            monitorData.RmdKoi_0.BidPrice1 = 0.69;
            actual = ms.CalculateElwReqPrice(monitorData, eachData);
            Assert.AreEqual(-1, actual);

            //7. Koi 1's 가격이 너무 낮은 경우(해당사항 없음)
            //8. Koi 2's 가격이 너무 낮은 경우(해당사항 없음)

            //9. Koi 3's 가격이 너무 낮은 경우(-1)
            SetAsDefaultPrice(monitorData);
            monitorData.RmdKoi_3.BidPrice1 = 0.19;
            actual = ms.CalculateElwReqPrice(monitorData, eachData);
            Assert.AreEqual(-1, actual);

            //10. Koi 4's 가격이 너무 낮은 경우(-1)
            SetAsDefaultPrice(monitorData);
            monitorData.RmdKoi_4.BidPrice1 = 0.19;
            actual = ms.CalculateElwReqPrice(monitorData, eachData);
            Assert.AreEqual(-1, actual);

            //11. 0's 매수호가 - 0.5 경우
            SetAsDefaultPrice(monitorData);
            monitorData.RmdKoi_0.BidPrice1 = 1.4;
            actual = ms.CalculateElwReqPrice(monitorData, eachData);
            expected =
                ElwOptionUtil.ConvertOptionPriceToElwPrice(ei, 1.4 - 0.5);
        }
Exemplo n.º 4
0
        void EDoorEachMonitorEnterDataTest(
            EDoorEachMonitorEnterData data)
        {
            EDoorEachMonitorEnterData_Accessor acc =
                new EDoorEachMonitorEnterData_Accessor(
                    new PrivateObject(data));

            Assert.AreEqual(acc.CurEDoorOrderState, EDoorEachMonitorEnterData.EDoorOrderState.Idle);

            Assert.AreEqual(acc.LiveOrder, null);

            // KOI 0, 1, 2, 3, 4와 ElwInfo 점검
            Assert.AreEqual(acc.KOI_0.CallPut, acc.EI.CallPut);
            Assert.AreEqual(acc.KOI_1.CallPut, acc.EI.CallPut);
            Assert.AreEqual(acc.KOI_2.CallPut, acc.EI.CallPut);
            Assert.AreEqual(acc.KOI_3.CallPut, acc.EI.CallPut);
            Assert.AreEqual(acc.KOI_4.CallPut, acc.EI.CallPut);

            // strike 점검
            Assert.AreEqual(acc.KOI_0.Strike, acc.EI.Strike);

            if (acc.EI.CallPut == CallPutFlag.Call)
            {
                Assert.AreEqual(acc.KOI_0.Strike < acc.KOI_1.Strike, true);
                Assert.AreEqual(acc.KOI_1.Strike < acc.KOI_2.Strike, true);
                Assert.AreEqual(acc.KOI_2.Strike < acc.KOI_3.Strike, true);
                Assert.AreEqual(acc.KOI_3.Strike < acc.KOI_4.Strike, true);
            }
            else
            {
                Assert.AreEqual(acc.KOI_0.Strike > acc.KOI_1.Strike, true);
                Assert.AreEqual(acc.KOI_1.Strike > acc.KOI_2.Strike, true);
                Assert.AreEqual(acc.KOI_2.Strike > acc.KOI_3.Strike, true);
                Assert.AreEqual(acc.KOI_3.Strike > acc.KOI_4.Strike, true);
            }
        }