public static Kospi200FuturesTradeInfo makeKospi200f_tradeInfo(DateTime tradeDate,
                                                                       string availableTradeCD,
                                                                       int quantity,
                                                                       double tradeIndex)
        {
            Kospi200FuturesTradeInfo ifti = new Kospi200FuturesTradeInfo();

            Kospi200Index_futures index_futures = Kospi200Index_futures.CreateKOSPI200F(tradeDate,
                                                                                availableTradeCD, 
                                                                                quantity, 
                                                                                tradeIndex);

            index_futures.Index_ = tradeIndex;

            ifti.Financial_instrument_ = index_futures;

            // index multiplier
            clsTRADABLE_KRX_INDEXFUTURES_TB clstb = new clsTRADABLE_KRX_INDEXFUTURES_TB();
            clstb.INST_KRX_CD = availableTradeCD;

            if (clstb.SelectOwn() == 0)
                { throw new Exception("availableTradeCD does not exist : " + availableTradeCD); }

            double indexMultiplier = clstb.INDEX_MULTIPLIER;
            double tradeFeeRate = 0.00003; // 키움꺼임.

            ifti.DAO_ = new clsHITM_TRADEINFO_TB();

            ifti.DAO_.TRADE_ID = IDGenerator.getNewTradeID(TradeInfo.TradeType.Dynamic_Hedge,
                                                        index_futures.InstrumentType_,  
                                                        tradeDate);

            ifti.DAO_.INSTRUMENT_ID = index_futures.indexFuturesDAO_.INSTRUMENT_ID;

            ifti.DAO_.TRADE_DT = tradeDate.ToString("yyyyMMdd");
            ifti.DAO_.TRADE_TM = DateTime.Now.ToString("HHmmss");
            ifti.DAO_.TRADE_SEQ = IDGenerator.getTradeSeq(tradeDate);
            ifti.DAO_.TRADE_TYP = Convert.ToInt32(TradeInfo.TradeType.Dynamic_Hedge);
            ifti.DAO_.FP_MASTER_TYP = index_futures.baseDAO_.FP_MASTER_TYP;
            ifti.DAO_.TRADE_UNIT = Convert.ToInt32(tradeIndex * indexMultiplier);
            ifti.DAO_.TRADE_MULTIPLIER = indexMultiplier;
            ifti.DAO_.TRADE_CURR = "KRW";
            ifti.DAO_.CURR_RATE = 1.0;
            ifti.DAO_.TRADE_INDEX = tradeIndex;
            ifti.DAO_.TRADE_INDEXUNIT = 1.0;

            ifti.DAO_.TRADE_QNT = quantity;
            ifti.DAO_.TRADE_NOTIONAL_AMT = Math.Round(Math.Abs(Convert.ToDouble(quantity * tradeIndex * indexMultiplier)));
            ifti.DAO_.ACCOUNT_AMT = 0.0;// ifti.DAO_.TRADE_NOTIONAL_AMT;
            ifti.DAO_.TRADE_FEE = Math.Round(Math.Abs(ifti.DAO_.TRADE_NOTIONAL_AMT * tradeFeeRate));
            ifti.DAO_.TRADE_PL = 0.0;
            ifti.DAO_.TRADE_FEE_PAYMENT_DT = tradeDate.ToString("yyyyMMdd");
            ifti.DAO_.COUNTER_ID = "KRX";
            ifti.DAO_.BOOKED_FLAG = 0;

            return ifti;
        
        }
        public override void loadAvailableInst()
        {
            this.AvailableInstList_.Clear();

            clsTRADABLE_KRX_INDEXFUTURES_TB clstb = new clsTRADABLE_KRX_INDEXFUTURES_TB();

            DataTable dt = clstb.Select();

            foreach (DataRow dr in dt.Select())
            {
                this.AvailableInstList_.Add( clsTRADABLE_KRX_INDEXFUTURES_TB.Create(dr) );
            }

        }
        // 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;

        }
		public clsTRADABLE_KRX_INDEXFUTURES_TB Clone()
		{
			try
			{
				clsTRADABLE_KRX_INDEXFUTURES_TB cloneTB = new clsTRADABLE_KRX_INDEXFUTURES_TB();
				
				
				cloneTB._INST_KRX_CD = this._INST_KRX_CD;
				cloneTB._INST_NM = this._INST_NM;
				cloneTB._MATURITY_DT = this._MATURITY_DT;
				cloneTB._UNDERLYING_CD = this._UNDERLYING_CD;
				cloneTB._INDEX_MULTIPLIER = this._INDEX_MULTIPLIER;
				cloneTB._BROKER_CD = this._BROKER_CD; 
				
				return cloneTB;
			}
			catch(Exception ex)
			{
				throw new Exception(ex.Message);
			}
		}
		public static clsTRADABLE_KRX_INDEXFUTURES_TB Create(DataRow dr)
		{
			try
			{
				clsTRADABLE_KRX_INDEXFUTURES_TB tb = new clsTRADABLE_KRX_INDEXFUTURES_TB();
				
				
				tb._INST_KRX_CD = Convert.ToString(dr[0]);
				tb._INST_NM = Convert.ToString(dr[1]);
				tb._MATURITY_DT = Convert.ToString(dr[2]);
				tb._UNDERLYING_CD = Convert.ToString(dr[3]);
				tb._INDEX_MULTIPLIER = Convert.ToInt32(dr[4]);
				tb._BROKER_CD = Convert.ToString(dr[5]); 
				
				return tb;
			}
			catch(Exception ex)
			{
				throw new Exception(ex.Message);
			}
		}