public void read_instrument(Kospi200Index_futures inst)
        {
            this.ViewModel_ = inst;
            this.masterTabItem_.DataContext = this.ViewModel_;
            this.cashFlowDataGrid_.ItemsSource = this.ViewModel_.FP_CashFlowList_;

        }
Beispiel #2
0
        // #CreateInstrument_ItemAdd
        public static Financial_instrument CreateInstrument(clsMAST_FP_INSTRUMENT_TB tb)
        {
            int type = tb.FP_MASTER_TYP;

            Financial_instrument fi = new Unknown_fi_instrument();

            if (type == (int)clsMAST_FP_INSTRUMENT_TB.FP_MASTER_TYP_Type.Kospi200_IndexFutures)
            {
                fi = new Kospi200Index_futures();
            }
            else if (type == (int)clsMAST_FP_INSTRUMENT_TB.FP_MASTER_TYP_Type.Kospi200_IndexOption_Call 
                || type == (int)clsMAST_FP_INSTRUMENT_TB.FP_MASTER_TYP_Type.Kospi200_IndexOption_Put)
            {
                fi = new Kospi200Index_option();
            }
            else if (type == (int)clsMAST_FP_INSTRUMENT_TB.FP_MASTER_TYP_Type.VanillaIRS)
            {
                fi = new VanillaIRS_instrument();
            }
            else if (type == (int)clsMAST_FP_INSTRUMENT_TB.FP_MASTER_TYP_Type.VanillaSwap)
            {
                fi = new Vanilla_Swap();
            }
            else if (type == (int)clsMAST_FP_INSTRUMENT_TB.FP_MASTER_TYP_Type.Ftp_DepositLoan)
            {
                fi = new Ftp_DepositLoan();
            }
            else if (type == (int)clsMAST_FP_INSTRUMENT_TB.FP_MASTER_TYP_Type.Money_Cash)
            {
                fi = new CurrencyCash();
            }

            else
            {
                //fi = new Unknown_instrument();
            }

            fi.baseDAO_ = tb;
            fi.loadDetail(tb.INSTRUMENT_ID);

            return fi;
        }
Beispiel #3
0
        // code parsing or 어쩌구.
        public static Kospi200Index_futures CreateKOSPI200F(DateTime tradeDate,
                                                            string krxCode,
                                                            int quantity,
                                                            double tradeIndex)
        {
            // 장내 이므로 불러옴.
            clsTRADABLE_KRX_INDEXFUTURES_TB clstb = new clsTRADABLE_KRX_INDEXFUTURES_TB();

            clstb.INST_KRX_CD = krxCode;
            clstb.SelectOwn();

            Kospi200Index_futures inst = new Kospi200Index_futures();

            string inst_ID = IDGenerator.getNewInstrumentID(inst.InstrumentType_, tradeDate, inst);

            inst.baseDAO_.INSTRUMENT_ID = inst_ID;
            inst.baseDAO_.INSTRUMENT_NM = clstb.INST_NM;

            //inst.baseDAO_.FP_MASTER_TYP = Convert.ToInt32(inst.InstrumentType_); // 아직 구분 못했음. 우선 그냥 instType으로 넣음.

            inst.baseDAO_.FP_MASTER_TYP = IDGenerator.KRXCodetoFP_MASTER_TYP(krxCode);
            inst.baseDAO_.NOTIONAL = Convert.ToDouble(clstb.INDEX_MULTIPLIER);
            inst.baseDAO_.PRICE = tradeIndex;
            inst.baseDAO_.QUANTITY = quantity;
            inst.baseDAO_.CURR = "KRW";
            inst.baseDAO_.FX_RATE = 1.0;
            //inst.baseDAO_.NOTIONAL = Math.Abs(quantity * tradeIndex * clstb.INDEX_MULTIPLIER);
            //inst.baseDAO_.CURR = "KRW";

            //inst.baseDAO_.BUY_SELL = (quantity > 0) ? (int)clsMAST_FP_INSTRUMENT_TB.BUY_SELL_Type.Buy : 
            //                                          (int)clsMAST_FP_INSTRUMENT_TB.BUY_SELL_Type.Sell ;

            //inst.baseDAO_.QUANTITY = Math.Abs(quantity);

            inst.baseDAO_.EFFECTIVE_DT = tradeDate.ToString("yyyyMMdd");
            inst.baseDAO_.MATURITY_DT = clstb.MATURITY_DT;
            inst.baseDAO_.BOOKED_DT = tradeDate.ToString("yyyyMMdd");
            inst.baseDAO_.CLOSED_DT = "20991231";

            inst.indexFuturesDAO_.INSTRUMENT_ID = inst_ID;
            inst.indexFuturesDAO_.INSTRUMENT_TYP = Convert.ToInt32(inst.InstrumentType_); // 내부 타입인데..

            inst.indexFuturesDAO_.NOTIONAL = Math.Abs(quantity * tradeIndex * clstb.INDEX_MULTIPLIER);
            inst.indexFuturesDAO_.QUANTITY = quantity;
            inst.indexFuturesDAO_.INDEX_MULTIPLIER = clstb.INDEX_MULTIPLIER;
            inst.indexFuturesDAO_.UNDERLYING_INDEX_CD = clstb.UNDERLYING_CD;

            inst.indexFuturesDAO_.CURR = "KRW";
            inst.indexFuturesDAO_.EFFECTIVE_DT = tradeDate.ToString("yyyyMMdd");
            inst.indexFuturesDAO_.MATURITY_DT = clstb.MATURITY_DT;

            CalendarManager cm = new CalendarManager(tradeDate, CalendarManager.CountryType.SOUTH_KOREA);


            // CF
            FP_SimpleCashFlow fp_simple = new FP_SimpleCashFlow();
            fp_simple.DAO_ = new clsMAST_CF_SIMPLE_TB();

            DateTime maturityDate = ConvertingTool.ToDateTime(clstb.MATURITY_DT);

            fp_simple.DAO_.LEG_ID = inst_ID;
            fp_simple.DAO_.LEG_TYP = (int)clsMAST_SWAP_TB.LEG_TYP_Type.SIMPLE;
            fp_simple.DAO_.NOTIONAL = inst.indexFuturesDAO_.NOTIONAL;
            fp_simple.DAO_.AMOUNT = 0.0;

            fp_simple.DAO_.CALC_START_DT = tradeDate.ToString("yyyyMMdd");
            fp_simple.DAO_.CALC_END_DT = maturityDate.ToString("yyyyMMdd"); 
            fp_simple.DAO_.CASHFLOW_DT = maturityDate.ToString("yyyyMMdd");
            fp_simple.DAO_.PAY_RECEIVE = 1;
            fp_simple.DAO_.PAYMENT_DT = fp_simple.DAO_.CASHFLOW_DT;

            inst.FP_CashFlowList_.Add(fp_simple);

            return inst;

        }