コード例 #1
0
        private void GetHistoryCandle()
        {
            try
            {
                var klineString = kline.GetHistory();
                var klines      = JConverter.JsonConver <List <object[]> >(klineString);

                foreach (var k in klines)
                {
                    var ohlcPoint = new OhlcPoint()
                    {
                        Open  = Convert.ToDouble(k[1], new CultureInfo("en-US")),
                        High  = Convert.ToDouble(k[2], new CultureInfo("en-US")),
                        Low   = Convert.ToDouble(k[3], new CultureInfo("en-US")),
                        Close = Convert.ToDouble(k[4], new CultureInfo("en-US"))
                    };
                    OhclValues.Add(ohlcPoint);
                    LabelsX.Add(Convert.ToInt64(k[0]).UnixToDateTime().ToString(formatX));
                }
            }
            catch (Exception ex)
            {
                // запись логов в БД
            }
        }
コード例 #2
0
ファイル: ChartService.cs プロジェクト: zubr404/BinanceClient
        private void GetHistoryCandle()
        {
            try
            {
                candles.Clear();
                kline = new Kline(SelectedPair, SelectedInterval);
                var klineString = kline.GetHistory();
                var klines      = JConverter.JsonConver <List <object[]> >(klineString);

                foreach (var k in klines)
                {
                    var ohlcPoint = new Charts.Models.Candle(
                        Convert.ToInt64(k[0], new CultureInfo("en-US")),
                        Convert.ToDouble(k[2], new CultureInfo("en-US")),
                        Convert.ToDouble(k[3], new CultureInfo("en-US")),
                        Convert.ToDouble(k[1], new CultureInfo("en-US")),
                        Convert.ToDouble(k[4], new CultureInfo("en-US")));
                    candles.Add(ohlcPoint);
                }
            }
            catch (Exception ex)
            {
                // запись логов в БД
            }
        }