Пример #1
0
 public static void JapCandleInstall(ref JapCandle jc1, QuoteChart getchart1, int v)
 {
     jc1.Open     = getchart1.Chart.Result[0].Indicators.Quote[0].Open[v];
     jc1.Close    = getchart1.Chart.Result[0].Indicators.Quote[0].Close[v];
     jc1.Low      = getchart1.Chart.Result[0].Indicators.Quote[0].Low[v];
     jc1.High     = getchart1.Chart.Result[0].Indicators.Quote[0].High[v];
     jc1.Adjclose = getchart1.Chart.Result[0].Indicators.Adjclose[0].adjclose[v];
     jc1.Volume   = getchart1.Chart.Result[0].Indicators.Quote[0].Volume[v];
 }
Пример #2
0
        public static QuoteChart GetChart(string Ticker, string interval, string range)
        {
            WebRequest wrGETURL = WebRequest.Create("https://query1.finance.yahoo.com/v8/finance/chart/" + Ticker + "?interval=" + interval + "&range=" + range);
            var        sss      = wrGETURL.GetResponse().ReadToEnd();

            try
            {
                QuoteChart QC = JsonSerializer.DeserializeFromString <QuoteChart>(sss);
                return(QC);
            }
            catch
            {
                return(null);
            }
        }
Пример #3
0
 public Chart(QuoteChart getchart)
 {
     Candles = new List <JapCandle>();
     for (int i = 0; i < getchart.Chart.Result[0].Timestamp.Count; i++)
     {
         JapCandle jc = new JapCandle
                        (
             getchart.Chart.Result[0].Timestamp[i],
             getchart.Chart.Result[0].Indicators.Quote[0].Open[i],
             getchart.Chart.Result[0].Indicators.Quote[0].Close[i],
             getchart.Chart.Result[0].Indicators.Quote[0].Low[i],
             getchart.Chart.Result[0].Indicators.Quote[0].High[i],
             getchart.Chart.Result[0].Indicators.Adjclose[0].adjclose[i],
             getchart.Chart.Result[0].Indicators.Quote[0].Volume[i]
                        );
         Candles.Add(jc);
     }
 }