public GreekPositions greekPositions() { //QlArray q_array = new QlArray(); //q_array.set(1, 1.0); GreekPositions gps = new GreekPositions(); GreekPosition gp1 = new GreekPosition(); gp1.Greek_ = new Greek(Greek.Type.Delta, 1.2); gp1.Greek_.associated_ID_ = "testAssociated_1"; gp1.Greek_.UnderCode_ = "testUnderCode_1"; gp1.GreekPositionAmount_ = 1.2; GreekPosition gp2 = new GreekPosition(); gp2.Greek_ = new Greek(Greek.Type.Delta, 2.1); gp2.Greek_.associated_ID_ = "testAssociated_2"; gp2.Greek_.UnderCode_ = "testUnderCode_2"; gp2.GreekPositionAmount_ = 2.1; gps.GreekPositionList_.Add(gp1); gps.GreekPositionList_.Add(gp2); return gps; }
// 그냥 셀렉트하면 댐. // 데일리 greekPosition을 direct로 계산해서 쌓아놈. // modle point로 구분하기 때문에..financial product랑은 다르게 상품이 동일한건 없고 죄다 다름. // 그냥 공통의 insurance_product는 없다고 보면댐. // position은 단순 데일리를 쌓기 위한것임. public GreekPositions greekPositions() { GreekPositions gps = new GreekPositions(); // SELECT 함. //gps.GreekPositionList_ = // option 별로 그릭이 나옴. List<Greek> greekList = this.Insurance_product_.greek(); foreach (Greek greek in greekList) { GreekPosition gp = new GreekPosition(); gp.Greek_ = greek; gp.GreekPositionAmount_ = this.Quantity_ * greek.Value_; gps.merge(gp); } return gps; }
public void merge(GreekPosition greekPosition) { // foreach (GreekPosition grk in this.GreekPositionList_) { grk.merge(grk); } }
public void merge(GreekPosition greekPosition) { if (this.Greek_.type_ == greekPosition.Greek_.type_ && this.Greek_.UnderCode_ == greekPosition.Greek_.UnderCode_) { this.GreekPositionAmount_ += greekPosition.GreekPositionAmount_; } else { return; } }
private double calculate_tradeQuantity(GreekPosition greekPosition, Financial_instrument financial_instrument) { // 100% 매치 // 90% 언더헤지 // 110% 오버헤지 double greekPositionAmount = greekPosition.GreekPositionAmount_; double quantity = 0.0; double mathched_fi_greek = 0.0; List<Greek> fi_greeks = financial_instrument.greeks(); foreach (Greek gp in fi_greeks) { if ( gp.UnderCode_ == greekPosition.Greek_.UnderCode_ && gp.type_ == greekPosition.Greek_.type_ ) { quantity = greekPositionAmount / mathched_fi_greek; quantity = quantity * this.Setting_.HedgeRatio_; } } return quantity; }
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; }