private void Button_Click(object sender, RoutedEventArgs e) { double[] x = Enumerable.Range(2000, 1000).Select(i => i / 10.0).ToArray(); this.viewModel_.xData_ = x; this.viewModel_.calculate(); OptionViewModel_1928 sumOption = OptionViewModel_1928.Sum(this.viewModel_.OptionViewModelList_); sumOption.convertAbs(); this.sumBindingPanel_.DataContext = sumOption; this.OPTION_POSITIONDataGrid_.Items.Refresh(); }
public static OptionViewModel_1928 Sum(ObservableCollection <OptionViewModel_1928> ovmList) { OptionViewModel_1928 resultOvm_1928 = new OptionViewModel_1928(); resultOvm_1928.name_ = "총계"; foreach (var item in ovmList) { resultOvm_1928.unit_ += item.unit_; resultOvm_1928.evalAmt_ += item.evalAmt_; resultOvm_1928.deltaCal_ += item.deltaCal_; resultOvm_1928.gammaCal_ += item.gammaCal_; resultOvm_1928.vegaCal_ += item.vegaCal_; resultOvm_1928.deltaPosition_ += item.deltaPosition_; resultOvm_1928.totalRisk_ += item.totalRisk_; resultOvm_1928.deltaRisk_ += item.deltaRisk_; resultOvm_1928.gammaRisk_ += item.gammaRisk_; resultOvm_1928.vegaRisk_ += item.vegaRisk_; } return(resultOvm_1928); }
public static OptionViewModel_1928 Sum(ObservableCollection<OptionViewModel_1928> ovmList) { OptionViewModel_1928 resultOvm_1928 = new OptionViewModel_1928(); resultOvm_1928.name_ = "총계"; foreach (var item in ovmList) { resultOvm_1928.unit_ += item.unit_; resultOvm_1928.evalAmt_ += item.evalAmt_; resultOvm_1928.deltaCal_ += item.deltaCal_; resultOvm_1928.gammaCal_ += item.gammaCal_; resultOvm_1928.vegaCal_ += item.vegaCal_; resultOvm_1928.deltaPosition_ += item.deltaPosition_; resultOvm_1928.totalRisk_ += item.totalRisk_; resultOvm_1928.deltaRisk_ += item.deltaRisk_; resultOvm_1928.gammaRisk_ += item.gammaRisk_; resultOvm_1928.vegaRisk_ += item.vegaRisk_; } return resultOvm_1928; }
public void loadDataFromExcelSheet(Excel.Worksheet activeWorksheet) { this.optionViewModelList_.Clear(); this.call_strikeData_.Clear(); this.put_strikeData_.Clear(); this.call_imvolData_.Clear(); this.put_imvolData_.Clear(); Excel.Range rngColumnA = activeWorksheet.get_Range("A1:A300"); try { Excel.Range callNameRng = rngColumnA.Find("종목명"); Excel.Range callDataRng = callNameRng.CurrentRegion; int callOptionCount = callDataRng.Rows.Count; for (int i = 1; i < callOptionCount; i++) { OPTION_POSITION_1928_Table_DAO dao = new OPTION_POSITION_1928_Table_DAO(); dao.POSITIONNAME_ = (string)callNameRng.get_Offset(i, 0).Value; dao.SELLBUY_ = (callNameRng.get_Offset(i, 1).Value2).ToString(); dao.UNIT_ = (callNameRng.get_Offset(i, 2).Value2).ToString(); dao.EVALAMT_ = (callNameRng.get_Offset(i, 3).Value2).ToString(); dao.DELTA_ = (callNameRng.get_Offset(i, 4).Value2).ToString(); dao.GAMMA_ = (callNameRng.get_Offset(i, 5).Value2).ToString(); dao.VEGA_ = (callNameRng.get_Offset(i, 6).Value2).ToString(); dao.IMVOL_ = (callNameRng.get_Offset(i, 7).Value2).ToString(); dao.DELTAPOSITION_ = (callNameRng.get_Offset(i, 8).Value2).ToString(); dao.TOTALRISK_ = (callNameRng.get_Offset(i, 9).Value2).ToString(); dao.DELTARISK_ = (callNameRng.get_Offset(i, 10).Value2).ToString(); dao.GAMMARISK_ = (callNameRng.get_Offset(i, 11).Value2).ToString(); dao.VEGARISK_ = (callNameRng.get_Offset(i, 12).Value2).ToString(); dao.DEEPOTM_ = (callNameRng.get_Offset(i, 13).Value2).ToString(); dao.REMAINDAYS_ = (callNameRng.get_Offset(i, 14).Value2).ToString(); OptionViewModel_1928 ovm_1928 = new OptionViewModel_1928(); ovm_1928.Brush_ = BrushesViewModel.BrushList_[i - 1]; ovm_1928.build(dao); if (ovm_1928.ImVol_ > 5) { if (ovm_1928.CallPutEnum_ == Option.Type.Call) { if (!(this.call_strikeData_.Contains(ovm_1928.Strike_))) { this.call_strikeData_.Add(ovm_1928.Strike_); this.call_imvolData_.Add(ovm_1928.ImVol_); } } else if (ovm_1928.CallPutEnum_ == Option.Type.Put) { if (!(this.put_strikeData_.Contains(ovm_1928.Strike_))) { this.put_strikeData_.Add(ovm_1928.Strike_); this.put_imvolData_.Add(ovm_1928.ImVol_); } } else { } } this.optionViewModelList_.Add(ovm_1928); } Excel.Range kospiNameRng = rngColumnA.Find("KOSPI200"); this.gbmParaViewModel_.CurrentPrice_ = Convert.ToDouble((kospiNameRng.get_Offset(0, 1).Value2).ToString()); this.put_strikeData_.Reverse(); this.put_imvolData_.Reverse(); this.gbmParaViewModel_.Call_Interpolation_ = this.call_imvolFitting(); this.gbmParaViewModel_.Put_Interpolation_ = this.put_imvolFitting(); } catch (Exception) { System.Windows.MessageBox.Show("Load PowerBase TR_1928 Data."); throw; } }
public void loadDataFromExcelSheet(Excel.Worksheet activeWorksheet) { this.optionViewModelList_.Clear(); this.call_strikeData_.Clear(); this.put_strikeData_.Clear(); this.call_imvolData_.Clear(); this.put_imvolData_.Clear(); Excel.Range rngColumnA = activeWorksheet.get_Range("A1:A300"); try { Excel.Range callNameRng = rngColumnA.Find("종목명"); Excel.Range callDataRng = callNameRng.CurrentRegion; int callOptionCount = callDataRng.Rows.Count; for (int i = 1; i < callOptionCount; i++) { OPTION_POSITION_1928_Table_DAO dao = new OPTION_POSITION_1928_Table_DAO(); dao.POSITIONNAME_ = (string)callNameRng.get_Offset(i, 0).Value; dao.SELLBUY_ = (callNameRng.get_Offset(i, 1).Value2).ToString(); dao.UNIT_ = (callNameRng.get_Offset(i, 2).Value2).ToString(); dao.EVALAMT_ = (callNameRng.get_Offset(i, 3).Value2).ToString(); dao.DELTA_ = (callNameRng.get_Offset(i, 4).Value2).ToString(); dao.GAMMA_= (callNameRng.get_Offset(i, 5).Value2).ToString(); dao.VEGA_ = (callNameRng.get_Offset(i, 6).Value2).ToString(); dao.IMVOL_ = (callNameRng.get_Offset(i, 7).Value2).ToString(); dao.DELTAPOSITION_ = (callNameRng.get_Offset(i, 8).Value2).ToString(); dao.TOTALRISK_ = (callNameRng.get_Offset(i, 9).Value2).ToString(); dao.DELTARISK_ = (callNameRng.get_Offset(i, 10).Value2).ToString(); dao.GAMMARISK_ = (callNameRng.get_Offset(i, 11).Value2).ToString(); dao.VEGARISK_ = (callNameRng.get_Offset(i, 12).Value2).ToString(); dao.DEEPOTM_ = (callNameRng.get_Offset(i, 13).Value2).ToString(); dao.REMAINDAYS_ = (callNameRng.get_Offset(i, 14).Value2).ToString(); OptionViewModel_1928 ovm_1928 = new OptionViewModel_1928(); ovm_1928.Brush_ = BrushesViewModel.BrushList_[i - 1]; ovm_1928.build(dao); if (ovm_1928.ImVol_ > 5 ) { if (ovm_1928.CallPutEnum_ == Option.Type.Call) { if (!(this.call_strikeData_.Contains(ovm_1928.Strike_))) { this.call_strikeData_.Add(ovm_1928.Strike_); this.call_imvolData_.Add(ovm_1928.ImVol_); } } else if (ovm_1928.CallPutEnum_ == Option.Type.Put) { if (!(this.put_strikeData_.Contains(ovm_1928.Strike_))) { this.put_strikeData_.Add(ovm_1928.Strike_); this.put_imvolData_.Add(ovm_1928.ImVol_); } } else { } } this.optionViewModelList_.Add(ovm_1928); } Excel.Range kospiNameRng = rngColumnA.Find("KOSPI200"); this.gbmParaViewModel_.CurrentPrice_ = Convert.ToDouble((kospiNameRng.get_Offset(0, 1).Value2).ToString()); this.put_strikeData_.Reverse(); this.put_imvolData_.Reverse(); this.gbmParaViewModel_.Call_Interpolation_ = this.call_imvolFitting(); this.gbmParaViewModel_.Put_Interpolation_ = this.put_imvolFitting(); } catch (Exception) { System.Windows.MessageBox.Show("Load PowerBase TR_1928 Data."); throw; } }