Example #1
0
                                makeVanillaIRS_tradeInfo(DateTime tradeDate,
                                                        string avavailableTradeCD, 
                                                        bool fixedPayFlag,
                                                        int quantity, 
                                                        double tradeIndex,
                                                        double spread)
        {
            VanillaIRSTradeInfo ifti = new VanillaIRSTradeInfo();

            clsTRADABLE_OTC_VANILLA_IRS_TB clstb = new clsTRADABLE_OTC_VANILLA_IRS_TB();
            clstb.INST_CD = avavailableTradeCD;

            clstb.SelectOwn();

            int maturityYear = ConvertingTool.TenorMuliplier(clstb.MATURITY_TENOR);

            double notioal = Math.Abs(quantity * 10000000000);

            //VanillaIRS_instrument irs = VanillaIRS_instrument.CreateFixedFloating(fixedPayFlag,
            //                                                                      notioal,
            //                                                                      tradeDate,
            //                                                                      maturityYear,
            //                                                                      tradeIndex,
            //                                                                      true);

            VanillaIRS_instrument irs = VanillaIRS_instrument.CreateTradableCode(avavailableTradeCD,
                                                fixedPayFlag, notioal, quantity,tradeDate, tradeIndex,spread);

            ifti.Financial_instrument_ = irs;

            double indexMultiplier = VanillaIRSTradeInfo.IndexMultiplier_;
            double tradeFeeRate = VanillaIRSTradeInfo.TradeFeeRate_;

            ifti.DAO_ = new DatabaseLayer.clsHITM_TRADEINFO_TB();

            ifti.DAO_.TRADE_ID = IDGenerator.getNewTradeID(TradeInfo.TradeType.OTC,irs.InstrumentType_, tradeDate);
            ifti.DAO_.INSTRUMENT_ID = irs.SwapDAO_.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.OTC);
            ifti.DAO_.FP_MASTER_TYP = irs.baseDAO_.FP_MASTER_TYP;
            ifti.DAO_.TRADE_UNIT = 10000000000;
            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 * ifti.DAO_.TRADE_UNIT)));
            ifti.DAO_.ACCOUNT_AMT = 0.0;
            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 = "OTC";
            ifti.DAO_.BOOKED_FLAG = 0;

            return ifti;
        }
Example #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;
        }
Example #3
0
        private TradeInfo match_trade(GreekPosition greekPosition)
        {
            TradeInfo tradeInfo = new VanillaIRSTradeInfo();

            tradeInfo.Financial_instrument_ = this.match_hedge_instrument(greekPosition.Greek_);
            tradeInfo.Quantity_ = this.calculate_tradeQuantity(greekPosition, tradeInfo.Financial_instrument_);

            return tradeInfo;

        }