public static void SaveHistoryData(Excel_instrumentViewModel e_inst) { Excel_parameterViewModel e_paraVM = e_inst.Excel_parameterViewModel_; //DateTime tradeDate = e_inst.MasterInformationViewModel_.Trade_date_; DateTime effectiveDate = e_inst.Excel_interfaceViewModel_.Excel_issueInfoViewModel_.EffectiveDate_; //string historyUnderStr = e_paraVM.historyUnderData(effectiveDate); string historyUnderStr = e_inst.Excel_interfaceViewModel_.Excel_underlyingCalcInfoViewModel_.historyUnderData(effectiveDate, e_paraVM.ReferenceDate_); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(historyUnderStr); string itemCode = e_paraVM.ItemCode_; string refDateStr = e_paraVM.ReferenceDate_.ToString("yyyyMMdd"); bool exists = System.IO.Directory.Exists(path_ + refDateStr); if (!exists) { System.IO.Directory.CreateDirectory(path_ + refDateStr); } try { xmlDoc.Save(path_ + refDateStr + "\\" + itemCode + "_" + refDateStr + "_historyData.xml"); } catch (Exception) { OutputLogViewModel.addResult("history Xml save fail!"); } }
public static void SaveInstrument(Excel_instrumentViewModel e_instVM) { //positionDB.booking(this.viewModel_) string productXmlStr = e_instVM.Excel_interfaceViewModel_.productXml(); //이놈은 나중에 다른 배치로 돌거임.. //string parameterXmlStr = this.viewModel_.Excel_parameterViewModel_.paraXml(); // < date , value > // //string underHistDataStr = this.viewModel_.Excel_parameterViewModel_.historyUnderData(); // 현재 program foler로 저장됨 //System.IO.File.WriteAllText("testProductInfo.xml", productXmlStr); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(productXmlStr); string itemCode = e_instVM.MasterInformationViewModel_.Item_code_; try { xmlDoc.Save(path_ + itemCode + ".xml"); } catch (Exception) { OutputLogViewModel.addResult("Instrument Xml save fail!"); } }
public static void SaveParameter(Excel_parameterViewModel e_paraVM) { string parameterXmlStr = e_paraVM.paraXml(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(parameterXmlStr); string itemCode = e_paraVM.ItemCode_; string refDateStr = e_paraVM.ReferenceDate_.ToString("yyyyMMdd"); bool exists = System.IO.Directory.Exists(path_ + refDateStr); if (!exists) { System.IO.Directory.CreateDirectory(path_ + refDateStr); } try { xmlDoc.Save(path_ + refDateStr + "\\" + itemCode + "_" + refDateStr + ".xml"); } catch (Exception) { OutputLogViewModel.addResult("parameter Xml save fail!"); } }
public static Excel_couponScheduleViewModel CreateExcel_couponSchedule(string typeStr) { if (typeStr == "excel_fixedCouponSchedule") { return(new Excel_fixedCouponScheduleViewModel()); } else if (typeStr == "excel_vanillaFloatingCouponSchedule") { return(new Excel_vanillaFloatingCouponScheduleViewModel()); } else if (typeStr == "excel_floatingCouponSchedule") { return(new Excel_floatingCouponScheduleViewModel()); } else if (typeStr == "excel_multiCondi_structuredCouponSchedule") { return(new Excel_multiCondi_structuredCouponScheduleViewModel()); } else if (typeStr == "excel_multiCondi_structuredAccrualCouponSchedule") { return(new Excel_multiCondi_structuredAccrualCouponScheduleViewModel()); } else if (typeStr == "excel_multiCondi_multiRng_structuredAccrualCouponSchedule") { return(new Excel_multiCondi_multiRng_structuredAccrualCouponScheduleViewModel()); } else { OutputLogViewModel.addResult("Excel_couponScheduleViewModel CreateExcel_couponSchedule( " + typeStr + ") : unknown Type"); throw new NotImplementedException(); } }
// product 화면에 underlying이 추가댔을 경우 그 이벤트를 받는 놈. public override void instrumentEventObserver(object sender, PropertyChangedEventArgs e) { Excel_underlyingCalcInfoViewModel senderVM = sender as Excel_underlyingCalcInfoViewModel; int count = senderVM.Excel_underlyingInfoViewModel_.Count; if (count > 0) { Excel_underlyingInfoViewModel e_uivm = senderVM.Excel_underlyingInfoViewModel_[count - 1]; //// model associated type defined class //UnderlyingModelSetting ums = new UnderlyingModelSetting(); // 원래 setting 해논 놈을 씀 UnderlyingModelSetting_ Excel_underlyingInfo_paraViewModel e_uipvm = this.UnderlyingModelSetting_.getUnderlyingParameterModel(e_uivm); this.excel_underlyingCalcInfo_paraViewModel_. Excel_underlyingInfo_paraViewModel_.Add(e_uipvm); this.excel_underlyingCalcInfo_paraViewModel_. Excel_correlationInfo_paraViewModel_.addUnderlying(e_uipvm.UnderNameTrans_.Value_); } else { OutputLogViewModel.addResult("input underlying num is 0"); } }
public double loadData(string code, DateTime refDate) { INDEX_DATA_Table_DAO dao = new INDEX_DATA_Table_DAO(); dao.INDEX_DATE_ = refDate.ToString(StringFormat.DbDateFormat_); dao.INDEX_CODE_ = code; double result = 0.0; try { dao.select(DataBaseConnectManager.ConnectionFactory("myDB")); } catch (Exception) { OutputLogViewModel.addResult("index data load error , code : " + code + " date : " + refDate.ToString(StringFormat.DbDateFormat_)); } try { result = Convert.ToDouble(dao.INDEX_VALUE_); } catch (Exception) { OutputLogViewModel.addResult("data converting error , code : " + code + " date : " + refDate.ToString(StringFormat.DbDateFormat_)); } return(result); }
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { underCalcIDTypeEnum?item = this.underCalcIDTypeCombBox_.SelectedItem as underCalcIDTypeEnum?; string underType = item.ToString(); if (underType.ToUpper() == "MAXIMUM") { this.SelectedUnderCalcIDTypeViewModel_ = new Excel_maximumUnderlyingCalcIDViewModel(); } else if (underType.ToUpper() == "MINIMUM") { this.SelectedUnderCalcIDTypeViewModel_ = new Excel_minimumUnderlyingCalcIDViewModel(); } else if (underType.ToUpper() == "AVERAGE") { this.SelectedUnderCalcIDTypeViewModel_ = new Excel_averageUnderlyingCalcIDViewModel(); } else if (underType.ToUpper() == "CHOICE") { this.SelectedUnderCalcIDTypeViewModel_ = new Excel_choiceUnderlyingCalcIDViewModel(); } else { OutputLogViewModel.addResult("no exist underType : " + underType); } //// 이거 위로 prop 안으로 집어넣어야하나..? ㅇㅇ 집어 넣었음 , 다시뺌 this.selectedUnderCalcIDTypeViewModel_.setUnderlying(this.Excel_underlyingCalcInfoViewModel_); this.selectedUnderCalcIDGrid_.Children.Clear(); this.selectedUnderCalcIDGrid_.Children.Add(this.selectedUnderCalcIDTypeViewModel_.view()); }
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItem item = this.kiCalcTypeCombBox_.SelectedItem as ComboBoxItem; string underType = item.Content.ToString(); if (underType.ToUpper() == "SIMPLE KI") { this.SelectedViewModel_ = new Excel_simpleKiEventCalcViewModel(); } else if (underType.ToUpper() == "DUAL KI") { this.SelectedViewModel_ = new Excel_dualKiEventCalcViewModel(); } else if (underType.ToUpper() == "TARGET KI") { this.SelectedViewModel_ = new Excel_targetKiEventCalcViewModel(); } else { OutputLogViewModel.addResult("no exist underType : " + underType); } //// 이거 위로 prop 안으로 집어넣어야하나..? ㅇㅇ 집어 넣었음 this.SelectedViewModel_.defaultSetting(); this.SelectedViewModel_.setUnderlying(this.excel_underlyingCalcInfoViewModel_); this.selectedKICalcGrid_.Children.Clear(); this.selectedKICalcGrid_.Children.Add(this.SelectedViewModel_.view()); }
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItem item = this.fixedBond_subtypeCombBox_.SelectedItem as ComboBoxItem; string underType = item.Content.ToString(); if (underType.ToUpper() == "SIMPLE") { this.SelectedViewModel_ = new Excel_fixedBond_constantRateViewModel(); } //else if (underType.ToUpper() == "STEPDOWN_NOKI") //{ // this.SelectedViewModel_ = new Excel_hifive_stepDown_nokiViewModel(); //} //else if (underType.ToUpper() == "STEPUP_KI") //{ // this.SelectedViewModel_ = new Excel_hifive_stepUp_nokiViewModel(); //} else { OutputLogViewModel.addResult("no exist underType : " + underType); } //// 이거 위로 prop 안으로 집어넣어야하나..? ㅇㅇ 집어 넣었음 this.selectedViewModel_.setUnderlying(this.excel_underlyingCalcInfoViewModel_); this.selectedSubtypeGrid_.Children.Clear(); this.selectedSubtypeGrid_.Children.Add(this.SelectedViewModel_.view()); }
public int deleteDefinedIndex(string nameStr) { SqlCeConnection connection = new SqlCeConnection(this.connectionStr_); try { DataTable tb = new DataTable(); connection.Open(); SqlCeCommand delCommand = connection.CreateCommand(); //delCommand.CommandText = "DELETE FROM CORRELATION WHERE DATE ='" + ReferenceDate_.ToString("yyyy-MM-dd") + "'"; //delCommand.ExecuteNonQuery(); string name = QueryStr.wrapComma(nameStr); delCommand.CommandText = "DELETE FROM INDEX_TICKER_INFO WHERE NAME=" + name; delCommand.ExecuteNonQuery(); delCommand.CommandText = "DELETE FROM INDEXDATA WHERE NAME=" + name; delCommand.ExecuteNonQuery(); connection.Close(); return(0); } catch (SqlCeException e) { connection.Close(); OutputLogViewModel.addResult("DataBase Connection Error : DB Load" + e.Errors); return(1); } }
public void setExportCode() { SqlCeConnection connection = new SqlCeConnection(connectionStr_); if (this.export_itemcode_ == null) { OutputLogViewModel.addResult("null input!"); return; } try { DataTable tb = new DataTable(); SqlCeCommand updateCommand = connection.CreateCommand(); connection.Open(); string itemCode = QueryStr.wrapComma(this.item_code_); string exportItemCodeWrap = QueryStr.wrapComma(this.export_itemcode_); updateCommand.CommandText = "UPDATE MASTERINFORMATION SET EXPORT_ITEMCODE = " + exportItemCodeWrap + " WHERE ITEM_CODE = " + itemCode; updateCommand.ExecuteNonQuery(); connection.Close(); } catch (SqlCeException) { connection.Close(); OutputLogViewModel.addResult("DataBase Connection Error : DB Load"); throw; } }
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { //ComboBoxItem item = this.optionTypeCombBox_.SelectedItem as ComboBoxItem; compositeOption_subtypeEnum?item = this.optionTypeCombBox_.SelectedItem as compositeOption_subtypeEnum?; string optionType = item.ToString(); if (optionType.ToUpper() == "VANILLA CALL/PUT" || optionType.ToUpper() == "VANILLA_CALL_PUT") { this.selectedOptionTypeViewModel_ = new Excel_vanillaCallPutViewModel(); } else if (optionType.ToUpper() == "UP IN/OUT CALL" || optionType.ToUpper() == "UP_INOUT_CALL") { this.selectedOptionTypeViewModel_ = new Excel_upInOutCallViewModel(); } else if (optionType.ToUpper() == "DOWN IN/OUT PUT" || optionType.ToUpper() == "DOWN_INOUT_PUT") { OutputLogViewModel.addResult("no exist optionType : " + optionType); } else if (optionType.ToUpper() == "DIGITAL CALL/PUT" || optionType.ToUpper() == "DIGITAL_CALL_PUT") { this.selectedOptionTypeViewModel_ = new Excel_digitalCallPutViewModel(); } else { OutputLogViewModel.addResult("no exist optionType : " + optionType); } this.selectedOptionTypeViewModel_.setInterfaceViewModel(this.interfaceViewModel_); this.selectedOptionTypeViewModel_.DefaultSetting(this.interfaceViewModel_); this.selectedOptionGrid_.Children.Clear(); this.selectedOptionGrid_.Children.Add(this.selectedOptionTypeViewModel_.view()); }
public void insertHistoryDB() { INDEX_DATA_Table_DAO dao = new INDEX_DATA_Table_DAO(); dao.INDEX_CODE_ = this.Code_; dao.INDEX_NAME_ = this.Name_; try { dao.deleteIndex(DataBaseConnectManager.ConnectionFactory("myDB")); foreach (var item in this.TimeSeries_) { dao.INDEX_DATE_ = QueryStr.wrapComma(item.Key); dao.INDEX_VALUE_ = QueryStr.wrapComma(item.Value); dao.insert(DataBaseConnectManager.ConnectionFactory("myDB")); } } catch (SqlCeException) { OutputLogViewModel.addResult("DataBase Connection Error : DB Load"); throw; } }
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { multiAssetCompositeOption_subtypeEnum?item = this.optionTypeCombBox_.SelectedItem as multiAssetCompositeOption_subtypeEnum?; string optionType = item.ToString(); if (optionType.ToUpper() == "VANILLA CALL/PUT" || optionType.ToUpper() == "MULTI_VANILLA_CALL_PUT") { this.SelectedOptionTypeViewModel_ = new Excel_multiAsset_vanillaCallPutViewModel(); } else if (optionType.ToUpper() == "UP IN/OUT CALL" || optionType.ToUpper() == "MULTI_UP_INOUT_CALL") { this.SelectedOptionTypeViewModel_ = new Excel_multiAsset_upInOutCallViewModel(); } else if (optionType.ToUpper() == "DOWN IN/OUT PUT" || optionType.ToUpper() == "MULTI_DOWN_INOUT_PUT") { OutputLogViewModel.addResult("no exist optionType : " + optionType); } //else if (optionType.ToUpper() == "DIGITAL CALL/PUT" || optionType.ToUpper() == "Multi_Digital_Call_Put") //{ // this.selectedOptionTypeViewModel_ = new Excel_(); //} else { OutputLogViewModel.addResult("no exist optionType : " + optionType); } this.selectedOptionTypeViewModel_.DefaultSetting(this.interfaceViewModel_); this.selectedOptionTypeViewModel_.setInterfaceViewModel(this.interfaceViewModel_); this.selectedOptionTypeViewModel_.setUnderlying(this.excel_underlyingCalcInfoViewModel_); this.selectedOptionGrid_.Children.Clear(); this.selectedOptionGrid_.Children.Add(this.selectedOptionTypeViewModel_.view()); }
private void loadInstrumentList(Excel_instrumentViewModel e_inst) { //bold로 표시한거 푸는것 this.rootBookViewModel_.clearSelection(); if (e_inst != null) { try { e_inst.loadDetailContext(); //this.rootBookViewModel_.clearSelection(); this.rootBookViewModel_.hasTradeInstrument(e_inst.Trade_id_); this.detailContentsGrid_.Children.Clear(); //e_inst.View_.UpdateLayout(); e_inst.dataContextRefesh(); this.detailContentsGrid_.Children.Add(e_inst.view(false)); this.bookFolderTreeView_.Items.Refresh(); } catch (Exception e) { OutputLogViewModel.addResult(e.Message); //throw; } } }
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { // //Enum으로 박 ComboBoxItem item = this.hifive_subtypeCombBox_.SelectedItem as ComboBoxItem; hifive_subtypeEnum?item = this.hifive_subtypeCombBox_.SelectedItem as hifive_subtypeEnum?; string underType = item.ToString(); //string underType = item.Content.ToString(); if (underType.ToUpper() == "STEPDOWN_KI") { this.SelectedViewModel_ = new Excel_hifive_stepDown_kiViewModel(); } else if (underType.ToUpper() == "STEPDOWN_NOKI") { this.SelectedViewModel_ = new Excel_hifive_stepDown_nokiViewModel(); } else if (underType.ToUpper() == "STEPUP_KI") { this.SelectedViewModel_ = new Excel_hifive_stepUp_nokiViewModel(); } else { OutputLogViewModel.addResult("no exist underType : " + underType); } this.selectedViewModel_.setUnderlying(this.excel_underlyingCalcInfoViewModel_); this.selectedSubtypeGrid_.Children.Clear(); this.selectedSubtypeGrid_.Children.Add(this.SelectedViewModel_.view()); }
public void loadDefinedIndexSymbolFromDB() { this.definedIndexSymbolList_.Clear(); SqlCeConnection connection = new SqlCeConnection(this.connectionStr_); try { SqlCeCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = "SELECT * FROM INDEX_TICKER_INFO"; SqlCeDataAdapter dataAdapter = new SqlCeDataAdapter(command.CommandText, connection); DataTable tb = new DataTable(); dataAdapter.Fill(tb); //string selectionStr = " DATE = '"++"' and CODE_A = '" + itemCode1 + "' and CODE_B = '" + itemCode2 + "'"; //DataRow[] results = tb.Select(selectionStr); //tb.Select(" foreach (DataRow row in tb.Rows) { string name = row["NAME"].ToString(); string krcode = row["KRCODE"].ToString(); string yahoo_ticker = row["YAHOO_TICKER"].ToString(); string bloomberg_ticker = row["BLOOMBERG_TICKER"].ToString(); string kap_ticker = row["KAP_TICKER"].ToString(); string kis_ticker = row["KIS_TICKER"].ToString(); string datasource = row["DATASOURCE"].ToString(); string time_download = row["TIME_DOWNLOAD"].ToString(); string index_type = row["INDEX_TYPE"].ToString(); this.definedIndexSymbolList_.Add(new IndexTickerInfo(name, krcode, yahoo_ticker, bloomberg_ticker, kap_ticker, kis_ticker, datasource, time_download, index_type )); } connection.Close(); } catch (SqlCeException) { connection.Close(); OutputLogViewModel.addResult("DataBase Connection Error : DB Load"); throw; } //this.definedIndexSymbolList_.Add("VGK"); //this.definedIndexSymbolList_.Add("^VIX"); //this.definedIndexSymbolList_.Add("005930.KS"); }
// 메모리에 어디까지 올릴건가 // 지금은 그냥 db access함 public void loadMasterInfo(string itemCode) { MATSER_INFO_Table_DAO mt_dao = new MATSER_INFO_Table_DAO(); mt_dao.KeyColumn_ = itemCode; mt_dao.select(DataBaseConnectManager.ConnectionFactory("myDB")); try { this.setFromDAO(mt_dao); } catch (Exception) { OutputLogViewModel.addResult("favor not implemeted"); } //DataTable tb = new DataTable(); //using (SqlCeConnection connection = new SqlCeConnection(connectionStr_)) //using (SqlCeCommand command = connection.CreateCommand()) //{ // string itemCodeWrap = QueryStr.wrapComma(itemCode); // command.CommandText = "SELECT TRADE_ID, ITEM_CODE , ITEM_NAME , NOTIONAL , TYPE, " + // " TRADE_DATE , MATURITY_DATE , COUNTERPARTY , EXPORT_ITEMCODE FROM MASTERINFORMATION WHERE ITEM_CODE =" + itemCodeWrap; // connection.Open(); // SqlCeDataAdapter dataAdapter = new SqlCeDataAdapter(command.CommandText, connection); // dataAdapter.Fill(tb); //} //DataRow[] resultRows = tb.Select(); //string formatString = "yyyyMMdd"; //foreach (DataRow item in resultRows) //{ // this.tradeID_ = item["TRADE_ID"].ToString(); // this.itemCode_ = item["ITEM_CODE"].ToString(); // this.name_ = item["ITEM_NAME"].ToString(); // this.notional_ = item["NOTIONAL"].ToString(); // this.type_ = item["TYPE"].ToString(); // this.tradeDate_ = DateTime.ParseExact(item["TRADE_DATE"].ToString(), formatString,null); // this.maturityDate_ = DateTime.ParseExact(item["MATURITY_DATE"].ToString(), formatString, null); // this.conterParty_ = item["COUNTERPARTY"].ToString(); // this.export_ItemCode_ = item["EXPORT_ITEMCODE"].ToString(); //} this.dataContextRefersh(); }
public Excel_underlyingModel_paraViewModel underModel(Excel_underlyingInfoViewModel excel_uivm) { // if 이놈이 stock이면 string underType = excel_uivm.Excel_type_; if (underType.ToUpper() == "STOCK" || underType.ToUpper() == "EXCEL_STOCK" || underType.ToUpper() == "EQUITY") { return(this.StockParaSetting_.underModel(excel_uivm, owner_parameterSettingManager_.Excel_InstrumentViewModel_, owner_parameterSettingManager_.ReferenceDate_)); } else if (underType.ToUpper() == "INTERESTRATE" || underType.ToUpper() == "EXCEL_INTERESTRATE") { return(this.InterestRateParaSetting_.underModel(excel_uivm, owner_parameterSettingManager_.Excel_InstrumentViewModel_, owner_parameterSettingManager_.ReferenceDate_)); } else if (underType.ToUpper() == "FXRATE") { return(this.FxRateParaSetting_.underModel(excel_uivm, owner_parameterSettingManager_.Excel_InstrumentViewModel_, owner_parameterSettingManager_.ReferenceDate_)); } else if (underType.ToUpper() == "INDEX" || underType.ToUpper() == "INDEX_TYPE" || underType.ToUpper() == "EXCEL_INDEXTYPE") { Excel_indexTypeViewModel excel_itvm = excel_uivm as Excel_indexTypeViewModel; string subType = excel_itvm.Sub_type_.ToUpper(); if (subType == "STOCK") { return(this.StockParaSetting_.underModel(excel_uivm, owner_parameterSettingManager_.Excel_InstrumentViewModel_, owner_parameterSettingManager_.ReferenceDate_)); } else if (subType == "INTERESTRATE") { return(this.InterestRateParaSetting_.underModel(excel_uivm, owner_parameterSettingManager_.Excel_InstrumentViewModel_, owner_parameterSettingManager_.ReferenceDate_)); } else if (subType == "FXRATE") { return(this.FxRateParaSetting_.underModel(excel_uivm, owner_parameterSettingManager_.Excel_InstrumentViewModel_, owner_parameterSettingManager_.ReferenceDate_)); } else { OutputLogViewModel.addResult("unknown subtype in indexType underlying " + subType); throw new NotImplementedException(); } } else { OutputLogViewModel.addResult("unknown underlying type" + underType); throw new NotImplementedException(); //return new Excel_forwardModelViewModel(); } }
public void deleteDao(Excel_marketDataSymbol excel_marketDataSymbol) { try { excel_marketDataSymbol.buildDAO().delete(DataBaseConnectManager.ConnectionFactory("myDB")); //this.symbolDAOList_.Add(excel_marketDataSymbol.buildDAO()); } catch (Exception) { OutputLogViewModel.addResult("symbol data db insert error : " + this.addedDao_.SYMBOL_); } }
public IndexTickerInfo loadDefinedIndex(string nameStr) { SqlCeConnection connection = new SqlCeConnection(this.connectionStr_); try { SqlCeCommand command = connection.CreateCommand(); connection.Open(); string wrapName = QueryStr.wrapComma(nameStr); command.CommandText = "SELECT * FROM INDEX_TICKER_INFO WHERE NAME=" + wrapName; SqlCeDataAdapter dataAdapter = new SqlCeDataAdapter(command.CommandText, connection); DataTable tb = new DataTable(); dataAdapter.Fill(tb); IndexTickerInfo loadITI = new IndexTickerInfo(); foreach (DataRow row in tb.Rows) { string name = row["NAME"].ToString(); string krcode = row["KRCODE"].ToString(); string yahoo_ticker = row["YAHOO_TICKER"].ToString(); string bloomberg_ticker = row["BLOOMBERG_TICKER"].ToString(); string kap_ticker = row["KAP_TICKER"].ToString(); string kis_ticker = row["KIS_TICKER"].ToString(); string datasource = row["DATASOURCE"].ToString(); string time_download = row["TIME_DOWNLOAD"].ToString(); string index_type = row["INDEX_TYPE"].ToString(); loadITI = new IndexTickerInfo(name, krcode, yahoo_ticker, bloomberg_ticker, kap_ticker, kis_ticker, datasource, time_download, index_type ); } connection.Close(); return(loadITI); } catch (SqlCeException) { connection.Close(); OutputLogViewModel.addResult("DataBase Connection Error : DB Load"); throw; } }
public int updateDefinedIndex(IndexTickerInfo iti) { SqlCeConnection connection = new SqlCeConnection(this.connectionStr_); try { DataTable tb = new DataTable(); SqlCeCommand command = connection.CreateCommand(); connection.Open(); //delCommand.CommandText = "DELETE FROM CORRELATION WHERE DATE ='" + ReferenceDate_.ToString("yyyy-MM-dd") + "'"; //delCommand.ExecuteNonQuery(); string name = QueryStr.wrapComma(iti.Name_); string krcode = QueryStr.wrapComma(iti.KrCode_); string yahoo_ticker = QueryStr.wrapComma(iti.Yahoo_ticker_); string bloomberg_ticker = QueryStr.wrapComma(iti.Bloomberg_ticker_); string kap_ticker = QueryStr.wrapComma(iti.Kap_ticker_); string kis_ticker = QueryStr.wrapComma(iti.Kis_ticker_); string datasource = QueryStr.wrapComma(iti.Datasource_); string time_download = QueryStr.wrapComma(iti.Time_download_); string index_type = QueryStr.wrapComma(iti.Index_type_); command.CommandText = "DELETE FROM INDEX_TICKER_INFO WHERE NAME=" + name; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO INDEX_TICKER_INFO (NAME,KRCODE,YAHOO_TICKER,BLOOMBERG_TICKER," + "KAP_TICKER,KIS_TICKER,DATASOURCE,TIME_DOWNLOAD,INDEX_TYPE) " + " VALUES (" + name + "," + krcode + "," + yahoo_ticker + "," + bloomberg_ticker + "," + kap_ticker + "," + kis_ticker + "," + datasource + "," + time_download + "," + index_type + ")"; command.ExecuteNonQuery(); connection.Close(); return(0); } catch (SqlCeException) { connection.Close(); OutputLogViewModel.addResult("DataBase Connection Error : DB Load"); return(1); } }
public OutputLogView() { InitializeComponent(); OutputLogViewModel.initialize(); //밖에서 initialize함. // 미리 에러가 날수 있으므로.. //OutputLogViewModel.registerLogView(OutputAddTextBlock); //this.outputLogList_ = OutputLogViewModel.OutputList_; //this.OutputListView_.ItemsSource = this.OutputLogList_; this.OutputListView_.ItemsSource = OutputLogViewModel.OutputList_; //OutputLogViewModel.addResult("testError"); }
public override void setUnderlying(Excel_underlyingCalcInfoViewModel excel_under) { this.excel_underlyingCalcInfoViewModel_ = excel_under; try { this.baseUnderlyingValue_ = Convert.ToDouble(excel_under.Excel_underlyingInfoViewModel_[0].BasePrice_); } catch (Exception e) { OutputLogViewModel.addResult(e.Message); } }
//public ObservableCollection<DateTime> dates(int addingDays = 0) public void genDates(int addingDays = 0) { this.dates_.Clear(); //Period tenor = new Period(this.tenor_); QLNet.Calendar calendar = new SouthKorea(); Period tenor = new Period(this.frequencyEnum_); BusinessDayConvention bdc = this.businessDayConvEnum_; DateGeneration.Rule dateGen = this.dateGenEnum_; try { Schedule schedule = new Schedule(new Date(initialDate_), new Date(endDate_), tenor, calendar, bdc, bdc, dateGen, false); List <Date> ql_d = schedule.dates(); for (int i = 0; i < ql_d.Count; i++) { this.dates_.Add(ql_d[i]); } } catch (Exception) { OutputLogViewModel.addResult("schedule gen error"); } //test //for (int i = 0; i < 6; i++) //{ // this.dates_.Add(new DateTime()); //} //this.dates_ = d; //return d; }
public void bookingInstrument() { this.masterInformationViewModel_.bookingMasterInfo(); try { this.excel_interfaceViewModel_.bookingEvent(this.masterInformationViewModel_); } catch (Exception e) { OutputLogViewModel.addResult("bookingEvent error : " + e.Message); } this.excel_profitLossViewModel_.bookingPL(); }
public int advance(DateTime d, string periodStr, string businessDayConv) { try { Period period = new Period(periodStr); Date result = this.advance(d, period, BusinessDayConvention.ModifiedFollowing); return(result.serialNumber()); } catch (Exception e) { OutputLogViewModel.addResult("fail " + e.Message); return(new Date().serialNumber()); } }
public void loadParameterFromXml(XmlDocument xmlDoc = null) { //this.excel_parameterViewModel_.loadParameterFromXml(); //XmlDocument xmlDoc = XMLFileLoader.LoadParameter(this.masterInformationViewModel_.Item_code_, // this.excel_parameterViewModel_.ReferenceDate_); if (xmlDoc == null) { this.para_xmlDoc_ = XMLFileLoader.LoadParameter(this.masterInformationViewModel_.Item_code_, this.excel_parameterViewModel_.ReferenceDate_); } else { this.para_xmlDoc_ = xmlDoc; } try { if (this.para_xmlDoc_ != null) { XmlNode paraNode = this.para_xmlDoc_.SelectSingleNode("pricing/excel_parameter"); FpmlSerializedCSharp.Excel_parameter serial_excel_parameter = new FpmlSerializedCSharp.Excel_parameter(paraNode); this.excel_parameterViewModel_.setFromSerial(serial_excel_parameter); XmlNode resultNode = this.para_xmlDoc_.SelectSingleNode("pricing/pricingResult"); if (resultNode != null) { FpmlSerializedCSharp.PricingResult serial_pricingResult = new FpmlSerializedCSharp.PricingResult(resultNode); this.excel_parameterViewModel_.Excel_resultViewModel_.setFromSerial(serial_pricingResult); } } } catch (Exception e) { OutputLogViewModel.addResult("parameter load error : " + e.Message); } }
public Excel_yieldCurveViewModel discountYieldCurve(string currencyStr) { Excel_yieldCurveViewModel e_ycvm = new Excel_yieldCurveViewModel(); foreach (var item in this.excel_yieldCurveViewModel_) { if (item.Currency_ == currencyStr) { e_ycvm = item; } } if (e_ycvm.Code_ == "") { OutputLogViewModel.addResult("unknown currency"); } return(e_ycvm); }
public void insertDB() { INDEX_DATA_Table_DAO dao = new INDEX_DATA_Table_DAO(); dao.INDEX_DATE_ = this.Date_; dao.INDEX_CODE_ = this.Name_; dao.INDEX_NAME_ = this.Name_; dao.INDEX_VALUE_ = this.Value_; try { dao.delete(DataBaseConnectManager.ConnectionFactory("myDB")); dao.insert(DataBaseConnectManager.ConnectionFactory("myDB")); } catch (SqlCeException) { OutputLogViewModel.addResult("dataBase load error : " + this.Name_); } }