//public DayPositions dayPositions(DayPositions preDayPositions,DateTime nextDate) // 쌓인 Trade를 통해 현재 포지션을 기준으로 새 포지션을 계산해 줌. // 이거 우선 같은 걸로 merge 해야함..? //public void calcaultePositionBooking(DayPositions dayPositions, string bookCode) public void calcaultePositionBooking(DayPositions dayPositions) { // merge() ? // trade type에 따라 다른 cumulateposition을 불러야 대나..? foreach (TradeInfo trade in this.TradeInfoList_) { Position tradePosition = trade.build_position(); tradePosition.DAO_.BOOK_CD = trade.DAO_.BOOK_CD; bool exist = false; foreach (Position p in dayPositions.PositionList_) { if (tradePosition.DAO_.INSTRUMENT_ID == p.DAO_.INSTRUMENT_ID ) { exist = true; p.cumulatePosition(tradePosition); p.DAO_.Update(); } } if ( !exist ) { dayPositions.PositionList_.Add(tradePosition); tradePosition.DAO_.Insert(); } } this.TradeInfoList_.Clear(); }
// 일별로 ETL 작업을 하면 쓸모없는 method // 전일 Position을 기준으로 당일 포지션을 만들음. public void makePositionFromPreDate(DateTime preDate, DateTime refDate) { DayPositions dps = new DayPositions(); dps.loadPosition(preDate); DayPositions nextDps = dps.nextDateClone(refDate); nextDps.insertALL(); }
public void evaluate(DayPositions dayPositions, DateTime refDate) { foreach (Position pos in dayPositions.PositionList_) { // market Data Load //pos.Financial_instrument_.marketDataUpdate(refDate); //pos.DailyPL_ = new ProfitLoss(); //pos.WeeklyPL_ = new ProfitLoss(); } }
public DayPositions nextDateClone(DateTime nextDate) { DayPositions dps = new DayPositions(); foreach (Position p in this.PositionList_) { dps.PositionList_.Add(p.nextDateClone(nextDate)); } return dps; }
public DayPositions preDayPositions(DateTime tradingDate) { DayPositions dps = new DayPositions(); dps.loadPosition(tradingDate); return dps; }
//public bool isOpen(DateTime refDate) //{ // FP_BookInfo_DAO dao = new FP_BookInfo_DAO(); // return dao.isOpen(this.bookCode_, refDate); //} // history ------------------------------------------------------------ public DayPositions getHistoryPosition(DateTime refDate) { DayPositions dayPositions = new DayPositions(); return dayPositions; }
public void build_tradingPosition() { // trading list ProfitLossCalculator plCalc = new ProfitLossCalculator(); plCalc.ReferenceDate_ = this.ReferenceDate_; plCalc.loadTradeInfo(); // 만들어진 빈거를 ㄱㄱ DayPositions dps = new DayPositions(); dps.loadPosition(this.ReferenceDate_); // Trading 한거를 여기다가 덮어 씌움. // 더해 plCalc.calcaultePositionBooking(dps); }