//joint 해서 데이터를 우선 맹글음.
        public void dataLoad()
        {
            bool flag = SystemVariableManager.getFlag(SystemVariable.CALCULATION_BATCH_END_FLAG);

            if (!flag)
            {
                //error를 떨궈야함..
                return;
            }

            // join query
            //SelectQueryBuilder query = new SelectQueryBuilder();
            //query.SelectFromTables("MASTERINFORMATION","POSITION_PL","CALCULATION_PRICE");

            this.newDate_pl_dataList_ = new List <PL_Data>();

            DataTable jointTB = new DataTable();

            DataRow[] resultRows = jointTB.Select();

            foreach (DataRow item in resultRows)
            {
                // trade List에 대한 정의가 필요함
                // 여기서 로드 해서
                List <TradePLEvent> tradeList = new List <TradePLEvent>();

                PL_Data pre_pl = new PL_Data();

                pre_pl.loadFromDataRow(item);

                newDate_pl_dataList_.Add(
                    this.makePL(pre_pl, this.refDate_, tradeList));
            }
        }
        // nowPrice : 평가가격
        public PL_Data makePL(PL_Data prePL_Data, DateTime nowDate, List <TradePLEvent> teList)
        {
            PL_Data new_data = new PL_Data(nowDate);

            new_data.calculate(prePL_Data, teList);

            return(new_data);
        }
        //public void calculate(PL_Data prePL_Data,double nowPrice)
        //{
        //    this.calculate(prePL_Data, nowPrice, new List<TradePLEvent>());
        //}

        //public void calculate(PL_Data prePL_Data,double nowPrice, List<TradePLEvent> teList)
        //{
        //    this.CalcPrice_ = nowPrice;

        //    this.UnitPrice_ = prePL_Data.UnitPrice_;
        //    this.Notional_ = prePL_Data.Notional_;
        //    this.RemainNotional_ = prePL_Data.RemainNotional_;
        //    this.BookedPrice_ = prePL_Data.BookedPrice_;
        //    this.BookedNotional_ = prePL_Data.BookedNotional_;

        //    this.EvalPrice_ = (nowPrice / this.UnitPrice_) * this.RemainNotional_;
        //    this.TotalEvalFromBookValuePL_ = this.EvalPrice_ - this.RemainNotional_;

        //    foreach (TradePLEvent item in teList)
        //    {
        //        this.TradePL_ += item.tradePL();
        //    }

        //    // remainNotional이 증가하는 경우 생각
        //    this.DailyEvalPL_ = this.RemainNotional_ * (this.CalcPrice_ - prePL_Data.CalcPrice_) / this.UnitPrice_;
        //    this.TotalPL_ = this.DailyEvalPL_ + this.TradePL_;
        //}


        public void calculate(PL_Data prePL_Data, List <TradePLEvent> teList)
        {
            foreach (var item in teList)
            {
                item.calculate(this);
            }

            double eval_price = this.Remain_notional_ * (this.Calc_value_ / this.Unit_value_);

            this.Eval_price_    = eval_price;
            this.Total_eval_pl_ = eval_price - this.Book_notional_;
            this.Daily_eval_pl_ = this.Remain_notional_ * (this.Calc_value_ / this.Unit_value_ - prePL_Data.Calc_value_ / prePL_Data.Unit_value_);

            this.Total_pl_ = this.Total_eval_pl_ + this.Daily_eval_pl_ + this.Trade_pl_;
        }
        //public void calculate(PL_Data prePL_Data,double nowPrice)
        //{
        //    this.calculate(prePL_Data, nowPrice, new List<TradePLEvent>());
        //}

        //public void calculate(PL_Data prePL_Data,double nowPrice, List<TradePLEvent> teList)
        //{
        //    this.CalcPrice_ = nowPrice;

        //    this.UnitPrice_ = prePL_Data.UnitPrice_;
        //    this.Notional_ = prePL_Data.Notional_;
        //    this.RemainNotional_ = prePL_Data.RemainNotional_;
        //    this.BookedPrice_ = prePL_Data.BookedPrice_;
        //    this.BookedNotional_ = prePL_Data.BookedNotional_;

        //    this.EvalPrice_ = (nowPrice / this.UnitPrice_) * this.RemainNotional_;
        //    this.TotalEvalFromBookValuePL_ = this.EvalPrice_ - this.RemainNotional_;

        //    foreach (TradePLEvent item in teList)
        //    {
        //        this.TradePL_ += item.tradePL();
        //    }

        //    // remainNotional이 증가하는 경우 생각
        //    this.DailyEvalPL_ = this.RemainNotional_ * (this.CalcPrice_ - prePL_Data.CalcPrice_) / this.UnitPrice_;
        //    this.TotalPL_ = this.DailyEvalPL_ + this.TradePL_;
        //}


        public void calculate(PL_Data prePL_Data, List<TradePLEvent> teList)
        {

            foreach (var item in teList)
            {
                item.calculate(this);
            }

            double eval_price = this.Remain_notional_ * (this.Calc_value_ / this.Unit_value_);

            this.Eval_price_ = eval_price;
            this.Total_eval_pl_ = eval_price - this.Book_notional_;
            this.Daily_eval_pl_ = this.Remain_notional_ * (this.Calc_value_ / this.Unit_value_ - prePL_Data.Calc_value_ / prePL_Data.Unit_value_);

            this.Total_pl_ = this.Total_eval_pl_ + this.Daily_eval_pl_ + this.Trade_pl_;

        }
        //joint 해서 데이터를 우선 맹글음.
        public void dataLoad()
        {
            bool flag = SystemVariableManager.getFlag(SystemVariable.CALCULATION_BATCH_END_FLAG);

            if (!flag)
            {
                //error를 떨궈야함..
                return;
            }

            // join query
            //SelectQueryBuilder query = new SelectQueryBuilder();
            //query.SelectFromTables("MASTERINFORMATION","POSITION_PL","CALCULATION_PRICE");

            this.newDate_pl_dataList_ = new List<PL_Data>();

            DataTable jointTB = new DataTable();

            DataRow[] resultRows = jointTB.Select();

            foreach (DataRow item in resultRows)
            {
                // trade List에 대한 정의가 필요함
                // 여기서 로드 해서 
                List<TradePLEvent> tradeList = new List<TradePLEvent>();

                PL_Data pre_pl = new PL_Data();

                pre_pl.loadFromDataRow(item);

                newDate_pl_dataList_.Add(
                    this.makePL(pre_pl, this.refDate_, tradeList));
                    
            }

        }
Esempio n. 6
0
 public void calculate(PL_Data pL_Data)
 {
     //this.Remain_notional_ = Convert.ToDouble(item["REMAIN_NOTIONAL"]);
     //this.Trade_pl_ = Convert.ToDouble(item["TRADE_PL"]);
     //this.Etc_pl_ = Convert.ToDouble(item["ETC_PL"]);
 }
        // nowPrice : 평가가격
        public PL_Data makePL(PL_Data prePL_Data, DateTime nowDate, List<TradePLEvent> teList)
        {
            PL_Data new_data = new PL_Data(nowDate);

            new_data.calculate(prePL_Data,teList);

            return new_data;

        }