public class OptionGetHandler { public object Execute_Option_Options(OptionRequest request) { return(null); }
private void Launch_Click(object sender, RoutedEventArgs e) { // When clicking on Launch button, we call the OptionRequest Class we builded in the TASAP COM Project //OptionRequest OptionRequest = OptionRequestMaker.MakeOptionRequest(variable, min, max, optionType, (int)StockPriceSlider.Value, (int)StrikePriceSlider.Value, (int)MaturitySlider.Value, (int)RfRateSlider.Value, (int)VolatilitySlider.Value); logicalError = false; yParam.IsEnabled = true; yParam.UnselectAll(); bool checkedval = false; foreach (RadioButton rb in rblist) { if (rb.IsChecked == true) { checkedval = true; switch (rb.Name) { case "Strike_Price": // for the strike price if (stringToFloat(Strike_PriceValmin.Text) >= stringToFloat(Strike_PriceValmax.Text)) { MessageBox.Show("Min value can't be lower than the max value."); logicalError = true; break; } else { OptionRequest = OptionRequestMaker.MakeOptionRequest("variable", "strike", Strike_PriceValmin.Text, Strike_PriceValmax.Text, optionType, MaturityVal.Text, RfRateVal.Text, StockPriceVal.Text, VolatilityVal.Text); break; } case "Stock_Price": if (stringToFloat(Stock_PriceValmin.Text) >= stringToFloat(Stock_PriceValmax.Text)) { MessageBox.Show("Min value can't be lower than the max value."); logicalError = true; break; } else { OptionRequest = OptionRequestMaker.MakeOptionRequest("variable", "spot", Stock_PriceValmin.Text, Stock_PriceValmax.Text, optionType, MaturityVal.Text, RfRateVal.Text, StrikePriceVal.Text, VolatilityVal.Text); break; } case "Volatility": if (stringToFloat(VolatilityValmin.Text) >= stringToFloat(VolatilityValmax.Text)) { MessageBox.Show("Min value can't be lower than the max value."); logicalError = true; break; } else { OptionRequest = OptionRequestMaker.MakeOptionRequest("variable", "sigma", VolatilityValmin.Text, VolatilityValmax.Text, optionType, MaturityVal.Text, RfRateVal.Text, StockPriceVal.Text, StrikePriceVal.Text); break; } } } } if (!checkedval) { OptionRequest = OptionRequestMaker.MakeOptionRequest(optionType, (StockPriceVal.Text), (StrikePriceVal.Text), (MaturityVal.Text), (RfRateVal.Text), (VolatilityVal.Text)); } if (!logicalError) { answerGreecs = OptionRequest.Rfq_Handler(checkedval); if (!checkedval) { PayoffVal.Content = answerGreecs.greecsdico.Values.ElementAt(2).ToString(); } BuildChart(); } }
public static Option ToModel(this OptionRequest dto, IMapper mapper) { return(mapper.Map <Option>(dto)); }