private void AddCommandExecute(object obj) { if (System.IO.Directory.Exists(FolderPath)) { if (BuySellOnSignalSymbolConfigs == null) { BuySellOnSignalSymbolConfigs = new ObservableCollection <BuySellOnSignalSymbolConfig>(); } if (!BuySellOnSignalSymbolConfigs.Any(s => s.Exchange == SelectedExchange && s.Symbol == SelectedInstrument.TradingSymbol)) { Random r = new Random(); BuySellOnSignalSymbolConfig config = new BuySellOnSignalSymbolConfig() { Seperator = ",", SignalProfitType = SignalProfitType, StartTime = StartTime, TrailingStopLoss = TrailingStopLoss, ContractSize = ContractSize, TickProfit = TickProfit, Exchange = SelectedExchange, Symbol = SelectedInstrument.TradingSymbol, MaxLoss = MaxLoss, Extension = SelectedFileFormat, LotSize = SelectedInstrument.LotSize, MaxProfit = MaxProfit, MappedSymbolName = MappedSymbolName, DataDirectoryPath = FolderPath, DataFileExtesnion = SelectedFileFormat, }; string tradingSymbol = string.Format("{0}:{1}", config.Exchange, config.Symbol); if (SelectedReversalConfig != null) { config.ReversalInfoes = SelectedReversalConfig.ReversalInfoes; } BuySellOnSignalSymbolConfigs.Add(config); Events.RaiseAskForStockSubscriptionEvent(tradingSymbol, StockSubscribeMode.LTP, true); _configuredStocksDictionary[tradingSymbol] = config; } else { Application.Current.Dispatcher.Invoke(() => { MessageBox.Show(string.Format("Symbol '{0}' is already added to the list. Try adding different symbol!", SelectedInstrument.TradingSymbol), "Duplicate Stock", MessageBoxButton.OK, MessageBoxImage.Error); }); } } else { Application.Current.Dispatcher.Invoke(() => { MessageBox.Show("Please enter valid director path.", "Invalid Folder Path", MessageBoxButton.OK, MessageBoxImage.Error); }); } }
public void SquareOffPosition(BuySellOnSignalSymbolConfig config, int count) { Application.Current.Dispatcher.Invoke(() => { var result = MessageBox.Show("Performing this action will close all open position and will stop Robot Transaction. Do you want to continue?", "Delete Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Information); if (result == MessageBoxResult.Yes) { if (config != null) { BuySellSignalOrderManager.Instance.SquareOffAllPositions(config, count); } } }); }
internal void DeleteItem(BuySellOnSignalSymbolConfig buySellOnSignalSymbolConfig) { BuySellSignalOrderManager.Instance.Stop(buySellOnSignalSymbolConfig); Events.RaiseAskForStockSubscriptionEvent(string.Format("{0}:{1}", buySellOnSignalSymbolConfig.Exchange, buySellOnSignalSymbolConfig.Symbol), StockSubscribeMode.LTP, false); BuySellOnSignalSymbolConfigs.Remove(buySellOnSignalSymbolConfig); }