Esempio n. 1
0
        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;
        
        }
Esempio n. 2
0
        // #CREATETRADEINFO_ITEMADD
        public static TradeInfo CreateTradeInfo(clsHITM_TRADEINFO_TB tb)
        {
            int type = tb.FP_MASTER_TYP;

            TradeInfo ti = new UnknownType_TradeInfo();

            if (type == (int)clsMAST_FP_INSTRUMENT_TB.FP_MASTER_TYP_Type.Kospi200_IndexFutures)
            {
                ti = new Kospi200FuturesTradeInfo();
            }
            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)
            {
                ti = new Kospi200OptionTradeInfo();
            }
            else if (type == (int)clsMAST_FP_INSTRUMENT_TB.FP_MASTER_TYP_Type.VanillaIRS)
            {
                ti = new VanillaIRSTradeInfo();
            }
            else if (type == (int)clsMAST_FP_INSTRUMENT_TB.FP_MASTER_TYP_Type.VanillaSwap)
            {
                ti = new Vanilla_SwapTradeInfo();
            }
            else if (type == (int)clsMAST_FP_INSTRUMENT_TB.FP_MASTER_TYP_Type.Ftp_DepositLoan)
            {
                ti = new Ftp_DepositLoanTradeInfo();
            }
            else
            {
                //fi = new Unknown_instrument();
            }

            ti.DAO_ = tb;
            //fi.baseDAO_ = tb;
            //fi.loadDetail(tb.INSTRUMENT_ID);

            return ti;
        }