public async void Start(TimeSpan interval, KiteConnect.Kite kite, IEnumerable <RangeBreakOutConfiguration> stockSymbols) { _kite = kite; _configurations = stockSymbols; if (_isCancelled) { _isCancelled = false; await CheckAndOrderStockWhenRangeBreaks(); } }
public async void Start(TimeSpan interval, KiteConnect.Kite kite, IEnumerable <StockSymbols> stockSymbols) { _stockSybolsHighLow = new Dictionary <string, Tuple <decimal, decimal> >(); _kite = kite; _stockSymbols = stockSymbols.Distinct().Select(s => s.DisplayName).ToArray(); _stockSybolsHighLow = _stockSymbols.ToDictionary(key => key, value => new Tuple <decimal, decimal>(0, 0)); if (!_isCancelled) { _isCancelled = true; await CheckHighLowTick(); } }
public int UpdateSymbol(ApiClient apiClient, KiteConnect.Kite kite, string exchange) { string directory = "Stocks"; if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } string clientDirectory = directory + "\\" + apiClient; if (!Directory.Exists(clientDirectory)) { Directory.CreateDirectory(clientDirectory); } string filePath = clientDirectory + "\\" + exchange + "_Stocks.config"; var instruments = kite.GetInstruments(exchange); XSerializer.Instance.SaveConfiguration <List <KiteConnect.Instrument> >(filePath, instruments); return(instruments.Count); }
public void Start(JobbingStockBase stockBase, KiteConnect.Kite kite) { if (stockBase.Status == JobbingStatus.NotStarted) { var clonedObject = stockBase.CloneObject() as JobbingStockBase; if (!_jobbingStocks.Any(s => s.Symbol == clonedObject.Symbol && s.Exchange == clonedObject.Exchange)) { _jobbingStocks.Add(clonedObject); } var stock = _jobbingStocks.FirstOrDefault(s => s.Symbol == clonedObject.Symbol && s.Exchange == clonedObject.Exchange); if (stock != null) { stock.Start(kite); } } else { Stop(stockBase.Symbol, stockBase.Exchange); } }