示例#1
0
        //заполняем список при запуске
        private async void FillingListCurrencies()
        {
            GetSourceHTMLClient GetHTML = new GetSourceHTMLClient(1);

            GetHTML.OnConsoleSend += consoleForm.AddString;
            //получаем весь список от API
            string InputLongString = await GetHTML.GetMarketSummariesAsync();

            CheckConnection(InputLongString);

            listCurrencies.Items.Clear();
            Regex rgx = new Regex(@"""MarketName"":""([A-Z]+-\w[A-Z]+)"""); //поиск значений

            foreach (Match match in rgx.Matches(InputLongString))
            {
                string MarketName = match.Groups[1].Value;
                ListCurrenciesArray.Add(MarketName);  //заполнение массива для поиска
                listCurrencies.Items.Add(MarketName); //заполнение ListBox
            }
        }
示例#2
0
        public async void UpdateInfoAsync(string chartTimestamp)
        {
            Label LabelMarket             = _elementsOnPanel[1] as Label;
            Label LabelRSIValue           = _elementsOnPanel[4] as Label;
            Label LabelHighValue          = _elementsOnPanel[6] as Label;
            Label LabelLowValue           = _elementsOnPanel[7] as Label;
            Label LabelVolumeValue        = _elementsOnPanel[8] as Label;
            Label LabelLastValue          = _elementsOnPanel[9] as Label;
            Label LabelBaseVolume         = _elementsOnPanel[10] as Label;
            Label LabelStochRSIFast       = _elementsOnPanel[12] as Label;
            Label LabelStochRSISlow       = _elementsOnPanel[13] as Label;
            Label LabelStochasticFast     = _elementsOnPanel[15] as Label;
            Label LabelStochasticSlow     = _elementsOnPanel[16] as Label;
            Label MACDValuelabel          = _elementsOnPanel[18] as Label;
            Label MACDSignalValuelabel    = _elementsOnPanel[19] as Label;
            Label MACDHistogramValuelabel = _elementsOnPanel[20] as Label;

            GetSourceHTMLClient _queryAPI = new GetSourceHTMLClient(1);

            _queryAPI.OnConsoleSend += _consoleForm_Ref.AddString;

            Conclusion_TechAnalisis conclusion_TechAnalisis = new Conclusion_TechAnalisis();
            Color colorElement = Color.Gray;

            //получаем общую инормацию для пары
            string _summariesResponse = await _queryAPI.GetMarketSummariesAsync();

            //await Task.Delay(1000);
            //получаем данные графика
            string _responseChart = await _queryAPI.GetMarketTicksAsync(_marketName, chartTimestamp);

            if (_summariesResponse == null || _responseChart == null)
            {
                onUpdateEnd();
                return;
            }

            ParsingResponse parsingResponse = new ParsingResponse();
            //получаем массив значений свечного графика
            List <string[]> marketChartArr = parsingResponse.CandleChart(_responseChart);

            TechAnalisis techAnalisis = new TechAnalisis();

            double[] arrayCloseValue = techAnalisis.GetArrayCloseValue(marketChartArr);
            double[] arrayHighValue  = techAnalisis.GetArrayHighValue(marketChartArr);
            double[] arrayLowValue   = techAnalisis.GetArrayLowValue(marketChartArr);

            string[] _marketStats = new string[5];
            _marketStats = parsingResponse.GetMarketStats(_summariesResponse, LabelMarket.Text);//получение значени High Low Last Volume Base volume

            LabelHighValue.Text   = LanguageString.DynamicElements.HighValuelabel_Text + _marketStats[0];
            LabelLowValue.Text    = LanguageString.DynamicElements.LowValuelabel_Text + _marketStats[1];
            LabelVolumeValue.Text = LanguageString.DynamicElements.VolumeValuelabel_Text + _marketStats[2];
            LabelLastValue.Text   = LanguageString.DynamicElements.LastValuelabel_Text + _marketStats[3];
            double FormatBaseVolume = Convert.ToDouble(_marketStats[4], SettingsVariable.ConvertCulture);

            LabelBaseVolume.Text = LanguageString.DynamicElements.BaseValuelabel_Text + FormatBaseVolume.ToString("0.##");

            if (arrayCloseValue.Length != 0)
            {
                //проверка длины полученного маcсива и значения параметров индикатора
                int _rsiPeriod            = CheackIndicatorParam(SettingsVariable.rsiPeriod, arrayCloseValue.Length);
                int _stochasticsSmooth    = CheackIndicatorParam(SettingsVariable.stochasticsSmooth, arrayCloseValue.Length);
                int _stochasticsPeriod    = CheackIndicatorParam(SettingsVariable.stochasticsPeriod, arrayCloseValue.Length);
                int _stochasticsRSISmooth = CheackIndicatorParam(SettingsVariable.stochasticsRSISmooth, arrayCloseValue.Length);
                int _stochasticsRSIPeriod = CheackIndicatorParam(SettingsVariable.stochasticsRSIPeriod, arrayCloseValue.Length);
                int _fastMAPeriod         = CheackIndicatorParam(SettingsVariable.fastMAPeriod, arrayCloseValue.Length);
                int _slowMAPeriod         = CheackIndicatorParam(SettingsVariable.slowMAPeriod, arrayCloseValue.Length);
                int _signalMAPeriod       = CheackIndicatorParam(SettingsVariable.signalMAPeriod, arrayCloseValue.Length);

                //RSI
                double[] RSIValueArray = techAnalisis.RSIArrayWithSMMA(_rsiPeriod, arrayCloseValue);
                //заполнение поля последним значением RSI
                colorElement            = conclusion_TechAnalisis.RSIvalue_Conclusion(RSIValueArray[RSIValueArray.Length - 1]);
                LabelRSIValue.BackColor = colorElement;
                LabelRSIValue.Text      = RSIValueArray[RSIValueArray.Length - 1].ToString("0.##");

                //Stochastic
                double[] FullStochasticKline = techAnalisis.FullStochasticOscillator(arrayCloseValue, arrayHighValue, arrayLowValue, _stochasticsSmooth, _stochasticsPeriod);
                LabelStochasticFast.Text = FullStochasticKline[RSIValueArray.Length - 1].ToString("0.##");
                double[] FullStochasticDline = techAnalisis.GetSMAArray(FullStochasticKline, _stochasticsSmooth);
                LabelStochasticSlow.Text      = FullStochasticDline[RSIValueArray.Length - 1].ToString("0.##");
                colorElement                  = conclusion_TechAnalisis.StochasticValue_Conclusion(FullStochasticKline[RSIValueArray.Length - 1], FullStochasticDline[RSIValueArray.Length - 1]);
                LabelStochasticFast.BackColor = colorElement;
                LabelStochasticSlow.BackColor = colorElement;

                //StochasticRSI K Line
                double[] StochasticKlineOfRSI = techAnalisis.FullStochasticKlineOfRSI(RSIValueArray, _stochasticsRSISmooth, _rsiPeriod, _stochasticsRSIPeriod);
                //заполнение поля последним значением StochRSIFast
                LabelStochRSIFast.Text = StochasticKlineOfRSI[StochasticKlineOfRSI.Length - 1].ToString("0.##");
                //StochasticRSI D Line
                double[] StochasticDlineOfRSI = techAnalisis.GetSMAArray(StochasticKlineOfRSI, _stochasticsRSISmooth);
                //заполнение поля последним значением StochRSISlow
                LabelStochRSISlow.Text      = StochasticDlineOfRSI[StochasticDlineOfRSI.Length - 1].ToString("0.##");
                colorElement                = conclusion_TechAnalisis.StochasticRSIvalue_Conclusion(StochasticKlineOfRSI[StochasticKlineOfRSI.Length - 1], StochasticDlineOfRSI[StochasticDlineOfRSI.Length - 1]);
                LabelStochRSIFast.BackColor = colorElement;
                LabelStochRSISlow.BackColor = colorElement;

                //MACD
                double[] MACD = techAnalisis.GetMACDArray(arrayCloseValue, _fastMAPeriod, _slowMAPeriod);
                //заполнение поля последним значением SlowMAPeriod
                MACDValuelabel.Text = MACD[MACD.Length - 1].ToString("0.########");
                double[] SignalLineMACD = techAnalisis.GetSignalLineArray(MACD, _signalMAPeriod);
                //заполнение поля последним значением SignalMAPeriod
                MACDSignalValuelabel.Text = SignalLineMACD[SignalLineMACD.Length - 1].ToString("0.########");
                double[] MACDHistogramArray = techAnalisis.GetMACDHistogramArray(MACD, SignalLineMACD, _slowMAPeriod, _signalMAPeriod);
                //заполнение поля последним значением MACDHistogram
                MACDHistogramValuelabel.Text = MACDHistogramArray[MACDHistogramArray.Length - 1].ToString("0.########");

                colorElement                      = conclusion_TechAnalisis.MACDvalue_Conclusion(MACD, SignalLineMACD, MACDHistogramArray);
                MACDValuelabel.BackColor          = colorElement;
                MACDSignalValuelabel.BackColor    = colorElement;
                MACDHistogramValuelabel.BackColor = colorElement;
            }
            //событие окончания обновления пары
            onUpdateEnd();
        }