Long time loading data MarketSeries
Created at 02 Nov 2018, 04:49
FR
Long time loading data MarketSeries
02 Nov 2018, 04:49
Is it possible to somehow speed up the loading of timeseries?
From 2 to 5 seconds for one timeseries, is a long time for me.
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; namespace cAlgo { [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class TestSpeedLoadSeries : Indicator { [Parameter(DefaultValue = 0.0)] public double Parameter { get; set; } [Output("Main")] public IndicatorDataSeries Result { get; set; } string[] m_SymbolNames = new string[] {"EURUSD", "GBPUSD", "EURGBP", "GBPJPY"}; TimeFrame[] m_TimeFrames = new TimeFrame[] {TimeFrame.Minute30, TimeFrame.Hour, TimeFrame.Hour4, TimeFrame.Daily}; protected override void Initialize() { MarketSeries SymbolSeries; DateTime dtStart =DateTime.UtcNow; Print("{0} Start symbols load test - {1}, {2}", dtStart, Symbol.Code, TimeFrame); foreach (string symbol in m_SymbolNames) { SymbolSeries =MarketData.GetSeries(symbol, TimeFrame); Print("{0} {1}, {2} loaded [{3}]", DateTime.UtcNow, SymbolSeries.SymbolCode, SymbolSeries.TimeFrame, SymbolSeries.OpenTime.Count); } Print("{0} Test finished [{1}]", DateTime.UtcNow, (DateTime.UtcNow - dtStart)); dtStart =DateTime.UtcNow; Print("{0} Start timeframes load test", dtStart); foreach (TimeFrame timeframe in m_TimeFrames) { SymbolSeries =MarketData.GetSeries(Symbol, timeframe); Print("{0} {1}, {2} loaded [{3}]", DateTime.UtcNow, SymbolSeries.SymbolCode, SymbolSeries.TimeFrame, SymbolSeries.OpenTime.Count); } Print("{0} Test finished [{1}]", DateTime.UtcNow, (DateTime.UtcNow - dtStart)); } public override void Calculate(int index){} } }
Results
02.11.2018 2:30:16 Start symbols load test - EURUSD, Hour 02.11.2018 2:30:16 EURUSD, Hour loaded [2001] 02.11.2018 2:30:18 GBPUSD, Hour loaded [8916] 02.11.2018 2:30:21 EURGBP, Hour loaded [8916] 02.11.2018 2:30:23 GBPJPY, Hour loaded [8916] 02.11.2018 2:30:23 Test finished [00:00:07.4986188] 02.11.2018 2:30:23 Start timeframes load test 02.11.2018 2:30:26 EURUSD, Minute30 loaded [8934] 02.11.2018 2:30:26 EURUSD, Hour loaded [2002] 02.11.2018 2:30:29 EURUSD, Hour4 loaded [8952] 02.11.2018 2:30:31 EURUSD, Daily loaded [8728] 02.11.2018 2:30:31 Test finished [00:00:08.0427303] -------------------------------------------------------------------------------------- 02.11.2018 2:30:57 Start symbols load test - EURUSD, Minute 02.11.2018 2:30:57 EURUSD, Minute loaded [2002] 02.11.2018 2:31:00 GBPUSD, Minute loaded [9071] 02.11.2018 2:31:04 EURGBP, Minute loaded [9069] 02.11.2018 2:31:09 GBPJPY, Minute loaded [9109] 02.11.2018 2:31:09 Test finished [00:00:11.2230958] 02.11.2018 2:31:09 Start timeframes load test 02.11.2018 2:31:11 EURUSD, Minute30 loaded [8935] 02.11.2018 2:31:13 EURUSD, Hour loaded [8925] 02.11.2018 2:31:16 EURUSD, Hour4 loaded [8952] 02.11.2018 2:31:18 EURUSD, Daily loaded [8728] 02.11.2018 2:31:18 Test finished [00:00:09.5303209]