Пример #1
0
        public static async Task <JArray> GetCacheAge(BacktestOptions backtestOptions, IDataStoreBacktest dataStore)
        {
            JArray jArrayResult = new JArray();

            foreach (var globalSymbol in backtestOptions.Coins)
            {
                backtestOptions.Coin = globalSymbol;

                Candle currentHistoricalDataFirst = await dataStore.GetBacktestFirstCandle(backtestOptions);

                Candle currentHistoricalDataLast = await dataStore.GetBacktestLastCandle(backtestOptions);

                if (currentHistoricalDataFirst != null && currentHistoricalDataLast != null)
                {
                    JObject currentResult = new JObject();
                    currentResult["Exchange"]        = backtestOptions.Exchange.ToString();
                    currentResult["Coin"]            = globalSymbol;
                    currentResult["CandlePeriod"]    = backtestOptions.CandlePeriod;
                    currentResult["FirstCandleDate"] = currentHistoricalDataFirst.Timestamp.ToUniversalTime();
                    currentResult["LastCandleDate"]  = currentHistoricalDataLast.Timestamp.ToUniversalTime();
                    jArrayResult.Add(currentResult);
                }
            }
            return(jArrayResult);
        }
Пример #2
0
        public static void GetCacheAgeConsole(BacktestOptions backtestOptions, IDataStoreBacktest dataStore)
        {
            Console.WriteLine("\tBacktest StartDate: " + Convert.ToDateTime(backtestOptions.StartDate).ToUniversalTime() + " UTC");
            if (backtestOptions.EndDate != DateTime.MinValue)
            {
                Console.WriteLine("\tBacktest EndDate: " + Convert.ToDateTime(backtestOptions.EndDate).ToUniversalTime() + " UTC");
            }
            else
            {
                Console.WriteLine("\tBacktest EndDate: " + DateTime.UtcNow + " UTC");
            }

            Console.WriteLine("");

            int dataCount = 0;

            foreach (var globalSymbol in backtestOptions.Coins)
            {
                backtestOptions.Coin = globalSymbol;

                Candle currentHistoricalDataFirst = dataStore.GetBacktestFirstCandle(backtestOptions).Result;
                Candle currentHistoricalDataLast  = dataStore.GetBacktestLastCandle(backtestOptions).Result;
                if (currentHistoricalDataFirst != null && currentHistoricalDataLast != null)
                {
                    Console.WriteLine("\tAvailable Cache for " + backtestOptions.Exchange + " " + globalSymbol + " Period: " + backtestOptions.CandlePeriod + "min  - from " + currentHistoricalDataFirst.Timestamp.ToUniversalTime() + " until " + currentHistoricalDataLast.Timestamp.ToUniversalTime());
                    dataCount = dataCount + 1;
                }
            }

            if (dataCount == 0)
            {
                Console.WriteLine("\tNo data - Please run 4. Refresh candle data first");
            }

            Console.WriteLine();
        }