Esempio n. 1
0
        public async Task StartAsync()
        {
            Console.WriteLine($"Starting {Market}");
            Strategy     = new HoldUntilPriceDropsStrategy();
            _traderGrain = _orleansClient.GetGrain <ITraderGrain>(Market);
            await _traderGrain.SetMarketAsync(Market);

            TraderState = await _traderGrain.GetTraderData();

            TraderState.Trades = TraderState.Trades ?? new List <Trade>();

            Strategy.Settings     = TraderSettings.Default;
            _lastCandleUpdateTime = DateTime.UtcNow;
            var candlesResponse = await _cryptoApi.GetCandlesAsync(Market, TickInterval.OneHour);

            _coinTrader.Candles = candlesResponse.Content;
            Console.WriteLine($"Downloaded {candlesResponse.Content.Count} candles for {Market}");
            if (TraderState.Trades.Count == 0)
            {
                TraderState.Trades.Add(new Trade {
                    Status = TradeStatus.Empty
                });
            }

            _coinTrader.IsInTestMode = IsInTestMode;
            _coinTrader.Initialize(TraderState);
            CanUpdate = true;
            if (!IsInTestMode)
            {
                await UpdateOrders();
            }
        }
Esempio n. 2
0
        public async Task StartAsync()
        {
            _traderGrain = _orleansClient.GetGrain <ITraderGrain>(Market);
            await _traderGrain.UpdateTrades(new List <Trade>());

            await _traderGrain.SetMarketAsync(Market);

            var traderState = await _traderGrain.GetTraderData();

            Trades = traderState.Trades ?? new List <Trade>();

            Strategy.Settings = TraderSettings.Default;
            if (Trades.Count == 0)
            {
                Trades.Add(new Trade {
                    Status = TradeStatus.Empty
                });
            }
        }
Esempio n. 3
0
        public async Task StartAsync()
        {
            Strategy     = new HoldUntilPriceDropsStrategy();
            _traderGrain = _orleansClient.GetGrain <ITraderGrain>(Market);
            await _traderGrain.UpdateTrades(new List <Trade>());

            await _traderGrain.SetMarketAsync(Market);

            TraderState = await _traderGrain.GetTraderData();

            TraderState.Trades = TraderState.Trades ?? new List <Trade>();

            Strategy.Settings = TraderSettings.Default;
            if (TraderState.Trades.Count == 0)
            {
                TraderState.Trades.Add(new Trade {
                    Status = TradeStatus.Empty
                });
            }
            _cryptoBroker.Initialize(TraderState);
        }