Esempio n. 1
0
        // code parsing or 어쩌구.
        public static Kospi200Index_option CreateKOSPI200_Option(DateTime tradeDate,
                                                            string krxCode,
                                                            int quantity,
                                                            double tradeIndex)
        {
            // 장내 이므로 불러옴.
            clsTRADABLE_KRX_INDEXOPTION_TB clstb = new clsTRADABLE_KRX_INDEXOPTION_TB();

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

            Kospi200Index_option inst = new Kospi200Index_option();

            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 = 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 * clstb.STRIKE * 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";

            clsTRADABLE_KRX_INDEXOPTION_TB clstb_tradable = new clsTRADABLE_KRX_INDEXOPTION_TB();
            clstb_tradable.INST_KRX_CD = krxCode;
            clstb_tradable.SelectOwn();

            inst.indexOptionDAO_.INSTRUMENT_ID = inst_ID;
            inst.indexOptionDAO_.INSTRUMENT_TYP = Convert.ToInt32(inst.InstrumentType_); // 내부 타입인데..
            
            inst.indexOptionDAO_.NOTIONAL = Math.Abs(quantity * clstb.STRIKE * clstb.INDEX_MULTIPLIER);
            inst.indexOptionDAO_.QUANTITY = quantity;
            inst.indexOptionDAO_.INDEX_MULTIPLIER = clstb_tradable.INDEX_MULTIPLIER;
            inst.indexOptionDAO_.UNDERLYING_INDEX_CD = clstb.UNDERLYING_CD;
            inst.indexOptionDAO_.OPTION_TYP = 0;
            inst.indexOptionDAO_.STRIKE = clstb_tradable.STRIKE;
            inst.indexOptionDAO_.CURR = "KRW";
            inst.indexOptionDAO_.EFFECTIVE_DT = tradeDate.ToString("yyyyMMdd");
            inst.indexOptionDAO_.MATURITY_DT = clstb.MATURITY_DT;

            return inst;


        }
Esempio n. 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;
        }