/// <summary>
        /// Update and save new OHLC data if needed
        /// </summary>
        /// <param name="cpts"></param>
        private void UpdateAndSaving(CurrencyPairTimeSeries cpts)
        {
            bool doSave = true;

            if (OHLCData.ContainsKey(cpts.GetTimeSeriesKey()))
            {
                DateTime lastDate = StaticLibrary.UnixTimeStampToDateTime(OHLCData[cpts.GetTimeSeriesKey()].Last().Time);
                if (DateTime.UtcNow.Subtract(lastDate).TotalSeconds > 2 * cpts.Freq.GetFrequency(inSecs: true))
                {
                    if (UseInternet)
                    {
                        UpdateData(cpts);
                    }
                }
                else
                {
                    doSave = false;
                }
            }
            else
            {
                throw new NotImplementedException("You should have loaded the data before you got there (readed from csv or downloaded)");
            }
            if (doSave && SaveableFrequency(cpts.Freq))
            {
                SaveOHLC(cpts);
            }
        }
        /// <summary>
        /// Create, Update and Save OHLC data as much as needed
        /// </summary>
        /// <param name="cpts"></param>
        private void LoadOHLCCore(CurrencyPairTimeSeries cpts)
        {
            CurrencyPair ccyPair = cpts.CurPair;
            Frequency    freq    = cpts.Freq;

            if (OHLCData.ContainsKey(cpts.GetTimeSeriesKey()))
            {
                UpdateAndSaving(cpts);
            }
            else
            {
                if (SaveableFrequency(freq) && File.Exists(GetOHLCLibraryPath(ccyPair, freq)))
                {
                    OHLCData[cpts.GetTimeSeriesKey()] = ReadOHLC(ccyPair, freq).Pairs[ccyPair.GetRequestID()];
                    UpdateAndSaving(cpts);
                }
                else
                {
                    OHLCData[cpts.GetTimeSeriesKey()] = GetKrakenOHLC(ccyPair, freq).Pairs[ccyPair.GetRequestID()];
                    SaveOHLC(cpts);
                }
            }
        }
        /// <summary>
        /// Add to loaded OHLC data the new information from Kraken
        /// </summary>
        /// <param name="cpts"></param>
        private void UpdateData(CurrencyPairTimeSeries cpts)
        {
            string      cpID        = cpts.CurPair.GetRequestID();
            List <OHLC> newData     = GetKrakenOHLC(cpts.CurPair, cpts.Freq).Pairs[cpts.CurPair.GetRequestID()];
            List <OHLC> currentData = OHLCData[cpts.GetTimeSeriesKey()];
            int         lastDate    = currentData.Last().Time;

            foreach (OHLC item in newData)
            {
                if (lastDate < item.Time)
                {
                    currentData.Add(item);
                }
            }
        }
        /// <summary>
        /// Write additional OHLC information locally
        /// </summary>
        /// <param name="cpts"></param>
        private void SaveOHLC(CurrencyPairTimeSeries cpts)
        {
            string pathLib = GetOHLCLibraryPath(cpts.CurPair, cpts.Freq);

            this.PublishInfo($"Saving OHLC: {cpts.CurPair.ToString()} {cpts.Freq.ToString()}");
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Time,Open,High,Low,Close,Volume,Vwap,Count");
            foreach (OHLC item in OHLCData[cpts.GetTimeSeriesKey()])
            {
                //Console.WriteLine($"Saving data: {UnixTimeStampToDateTime(item.Time)}");
                if (StaticLibrary.UnixTimeStampToDateTime(item.Time + cpts.Freq.GetFrequency(true)) < DateTime.UtcNow)
                {
                    sb.AppendLine($"{item.Time},{item.Open},{item.High},{item.Low},{item.Close},{item.Volume},{item.Vwap},{item.Count}");
                }
                else
                {
                    this.PublishInfo($"Stopped at line: {StaticLibrary.UnixTimeStampToDateTime(item.Time)}");
                }
            }
            File.WriteAllText(pathLib, sb.ToString());
        }