Esempio n. 1
0
            protected override State <Config> Run(TradingProvider trading, DataProvider data)
            {
                OrderUpdate buyOrder =
                    trading.ExecuteFullMarketOrderBuy(AlgorithmConfiguration.TradingPairs.First());
                Portfolio portfolio = trading.GetPortfolio();

                _limitSell = trading.PlaceLimitOrderSell(
                    AlgorithmConfiguration.TradingPairs.First(),
                    portfolio.GetAllocation(AlgorithmConfiguration.TradingPairs.First().Left).Free,
                    buyOrder.AverageFilledPrice * AlgorithmConfiguration.TakeProfit);
                SetTimer(TimeSpan.FromHours(AlgorithmConfiguration.StopTime));
                return(new NothingState <Config>());
            }