public CurrentPriceModel GetCurrentPrice(string market) { if (_currentPrices.Count > 0) { CurrentPriceModel result = _currentPrices.Dequeue(); return(result); } GetTotalSimulation(market); exit = true; return(new CurrentPriceModel(0, 0, 0, 0)); }
public void CheckOptions() { _CurrentPrice = _BitrexService.GetCurrentPrice(_Market); if (_CurrentPrice.Avg > 0 && _CurrentPrice.Avg != _LastCurrentPrice.Avg) { _CurrentTrend.Add(_CurrentPrice); _CurrentTrend.RemoveAt(0); if (_OrderStatus.Equals(CURRENTLYBUYING)) { CheckCurrentlyBuying(); } else if (_OrderStatus.Equals(CURRENTLYSELLING)) { CheckCurrentlySelling(); } else if (_OrderStatus.Equals(PLANINGTOBUY)) { CheckPlanningToBuy(); } else { CheckPlaningToSell(); } _LastCurrentPrice = _CurrentPrice; } else { if (_OrderStatus.Equals(CURRENTLYBUYING)) { CheckCurrentlyBuying(); } else if (_OrderStatus.Equals(CURRENTLYSELLING)) { CheckCurrentlySelling(); } } }
public TradingLogicManager(string market, IBittrexService bittrexService, string orderStatus) { _BitrexService = bittrexService; _Market = market; _CurrentPrice = _BitrexService.GetCurrentPrice(_Market); _LastTransactionPrice = _CurrentPrice.Last; _OrderStatus = orderStatus; if (_OrderStatus == PLANINGTOBUY) { //get base coin _CurrentBalance = _BitrexService.GetBalance(_Market.Split('-')[0]); } else { //get Alt Coin _CurrentBalance = _BitrexService.GetBalance(_Market.Split('-')[1]); } _CurrentTrend = new List <CurrentPriceModel>(); _LastCurrentPrice = _CurrentPrice; for (int i = 0; i < 20; i++) { _CurrentTrend.Add(new CurrentPriceModel(_CurrentPrice.Last, _CurrentPrice.Bid, _CurrentPrice.Ask, _CurrentPrice.Avg)); } }