Ejemplo n.º 1
0
        // 15 자리
        public static string getNewTradeID(TradeInfo.TradeType tradeType,
                                            Financial_instrument.InstrumentType instType,
                                            DateTime tradeDate)
        {
            string id = "";

            // (1)
            id += "T";

            // 세부코드(13) : date (6) , fp_master_type (3) , trade order (4)

            // date (6)
            id += tradeDate.ToString("yyyyMMdd").Substring(2, 6);

            // type (3) 
            if (tradeType == TradeInfo.TradeType.KRX) { id += "100"; }
            else if (tradeType == TradeInfo.TradeType.Clearing) { id += "S01"; }
            else if (tradeType == TradeInfo.TradeType.OTC) { id += "S02"; }
            else if (tradeType == TradeInfo.TradeType.Dynamic_Hedge) { id += "302"; }
            else { id += "Z99"; }

            // order (4)

            int max = IDGenerator.getTradeSeq(tradeDate);

            id += getLetter((max + 1), 4);

            // 에러코드(1)
            id += "9";

            return id;

            
        }
Ejemplo n.º 2
0
        public void add(TradeInfo hedgeTrade)
        {
            TradeInfoHistory_DAO dao = new TradeInfoHistory_DAO();

            this.history_orderd_list_.Add(hedgeTrade);

            dao.insert(hedgeTrade);

        }
Ejemplo n.º 3
0
        public void db_implement_check(TradeInfo ti)
        {
            clsHITM_TRADEINFO_TB clstb = new clsHITM_TRADEINFO_TB();

            // #JOB_TRADEINFOCREATE
            TradeInfo.CreateTradeInfo(clstb);


        }
Ejemplo n.º 4
0
        private void accumulate(TradeInfo ti)
        {
            // add financial master
            //this.FinancialMasterManager_.addFinancialMaster(ti.Financial_instrument_,this.tra);

            //TradingInfo_DAO.insert(ti);

            this.ProfitLossCalculator_.accumulate(ti);

            //        
        }
Ejemplo n.º 5
0
        public void tradeBooking_check(TradeInfo ti,DateTime tradingDate)
        { 
            // trade 함

            HedgeTradingViewModel htvm = new HedgeTradingViewModel();

            htvm.FinanceBook_ = FinanceBook.CreateBookFromUI("RootBook");
            htvm.TradeMaker_.TradingDate_ = tradingDate;
            htvm.FinancialMasterManager_ = new FinancialMasterManager();
            htvm.ProfitLossCalculator_ = new ProfitLossCalculator();

            htvm.doTrade(ti);
        }
Ejemplo n.º 6
0
        // trade 를 실행함. trade가 성공 하면 Booking 함. ( 수정 : 마감시에 부킹함 )
        public void doTrade(TradeInfo hedgeTrade)
        {
            //trade를 기록함.

            // 


            // sell -> 
            //

            // 상쇄 ?

            // if this position List Has a instrument aleady exist
            // then add quantity

        }
Ejemplo n.º 7
0
 public override void cumulateTradeInfo(TradeInfo tradeInfo)
 {
     //this.DAO_.TRADE_ID = tradeInfo.DAO_.TRADE_ID;
     //this.DAO_.INSTRUMENT_ID = tradeInfo.DAO_.INSTRUMENT_ID;
     //this.DAO_.TRADE_DT = tradeInfo.DAO_.TRADE_DT;
     //this.DAO_.TRADE_SEQ = tradeInfo.DAO_.TRADE_SEQ;
     //this.DAO_.TRADE_TYP = tradeInfo.DAO_.TRADE_TYP; // clearing ?
     this.DAO_.TRADE_UNIT = this.DAO_.TRADE_UNIT + tradeInfo.DAO_.TRADE_UNIT;
     //this.DAO_.TRADE_MULTIPLIER = tradeInfo.DAO_.TRADE_MULTIPLIER;
     //this.DAO_.TRADE_CURR = tradeInfo.DAO_.TRADE_CURR;
     //this.DAO_.CURR_RATE = tradeInfo.DAO_.CURR_RATE; 기존과 weight를 구해서 더함.
     this.DAO_.TRADE_INDEX = tradeInfo.DAO_.TRADE_INDEX;
     this.DAO_.TRADE_INDEXUNIT = tradeInfo.DAO_.TRADE_INDEXUNIT;
     this.DAO_.TRADE_QNT = tradeInfo.DAO_.TRADE_QNT;
     this.DAO_.ACCOUNT_AMT = tradeInfo.DAO_.ACCOUNT_AMT;
     this.DAO_.TRADE_FEE = tradeInfo.DAO_.TRADE_FEE;
     this.DAO_.TRADE_PL = tradeInfo.DAO_.TRADE_PL;
     this.DAO_.TRADE_FEE_PAYMENT_DT = tradeInfo.DAO_.TRADE_FEE_PAYMENT_DT;
     this.DAO_.COUNTER_ID = tradeInfo.DAO_.COUNTER_ID;
 }
Ejemplo n.º 8
0
        //// fake booking (trading)
        //public void futuresTrade()
        //{
        //    // Trading Data (TradeInfo) 생성

        //    double quantity = 2.0;
        //    double index = 272.2;

        //    this.TradeMaker_.TradingDate_ = this.TradingDate_;
        //    TradeInfo ti = this.TradeMaker_.makeKOSPI200IndexFuturesTradeInfo(quantity, index);

        //    // accumulate
        //    this.accumulate(ti);
        //}

        //public void irsTrade()
        //{
        //    // Trading Data (TradeInfo) 생성

        //    double quantity = 2.0;
        //    double index = 0.032;

        //    this.TradeMaker_.TradingDate_ = this.TradingDate_;
        //    TradeInfo ti = this.TradeMaker_.makeVanillaIRSTradeInfo(quantity, index);

        //    // accumulate
        //    this.accumulate(ti);
        //}

        private void accumulate(TradeInfo ti)
        {
            // add financial master and empty calculation result
            this.FinancialMasterManager_.addFinancialMaster(ti.Financial_instrument_,
                                                            this.TradingDate_,
                                                            this.FinanceBook_.BookCode_);

            // 
            ti.DAO_.BOOK_CD = this.FinanceBook_.BookCode_;

            // insert
            ti.DAO_.Insert();
            this.TradeMaker_.trade_seq_ += 1;

            // cash_flow
            ti.cash_instock_insert(this.FinanceBook_.BookCode_);

            this.ProfitLossCalculator_.accumulate(ti);

            //        
        }
Ejemplo n.º 9
0
        // 구현 다 된건가 확인
        public void class_implement_check(TradeInfo ti)
        {
            // interface check

            // trade
            ti.cumulateTradeInfo(ti);
            Position p1 = ti.build_position();
            Position p2 = Position.CreatePosition(p1.DAO_);

            // position
            p1.cumulatePosition(p2);
            
            // fi

            TradeInfo copyTi = TradeInfo.CreateTradeInfo(ti.DAO_);

            //Financial_instrument.CreateInstrument();

            // create 관련 확인


        }
Ejemplo n.º 10
0
 public override void cumulateTradeInfo(TradeInfo tradeInfo)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 11
0
 public void accumulate(TradeInfo ti)
 {
     this.TradeInfoList_.Add(ti);
 }
Ejemplo n.º 12
0
 public abstract void cumulateTradeInfo(TradeInfo tradeInfo);
Ejemplo n.º 13
0
 public void testAll(TradeInfo ti)
 {
     this.class_implement_check(ti);
 }
Ejemplo n.º 14
0
        //private int trade_seq_;

        public void doTrade(TradeInfo ti)
        {
            this.accumulate(ti);
        }
Ejemplo n.º 15
0
 public void insert(TradeInfo hedgeTrade)
 {
     // insert
 }