Exemplo n.º 1
0
        private void UpdateGlobalRate()
        {
            var totalRate = MinersManager.GetTotalRate();

            if (ConfigManager.GeneralConfig.AutoScaleBTCValues && totalRate < 0.1)
            {
                toolStripStatusLabelBTCDayText.Text =
                    "mBTC/" + International.GetText(ConfigManager.GeneralConfig.TimeUnit.ToString());
                toolStripStatusLabelGlobalRateValue.Text =
                    (totalRate * 1000 * _factorTimeUnit).ToString("F5", CultureInfo.InvariantCulture);
            }
            else
            {
                toolStripStatusLabelBTCDayText.Text =
                    "BTC/" + International.GetText(ConfigManager.GeneralConfig.TimeUnit.ToString());
                toolStripStatusLabelGlobalRateValue.Text =
                    (totalRate * _factorTimeUnit).ToString("F6", CultureInfo.InvariantCulture);
            }

            toolStripStatusLabelBTCDayValue.Text = ExchangeRateApi
                                                   .ConvertToActiveCurrency((totalRate * _factorTimeUnit * Globals.BitcoinUsdRate))
                                                   .ToString("F2", CultureInfo.InvariantCulture);
            toolStripStatusLabelBalanceText.Text = (ExchangeRateApi.ActiveDisplayCurrency + "/") +
                                                   International.GetText(
                ConfigManager.GeneralConfig.TimeUnit.ToString()) + "     " +
                                                   International.GetText("Form_Main_balance") + ":";
        }
Exemplo n.º 2
0
        private void BalanceCallback(object sender, EventArgs e)
        {
            Helpers.ConsolePrint("NICEHASH", "Balance update");
            var balance = NiceHashStats.Balance;

            if (balance > 0)
            {
                if (ConfigManager.GeneralConfig.AutoScaleBTCValues && balance < 0.1)
                {
                    toolStripStatusLabelBalanceBTCCode.Text  = "mBTC";
                    toolStripStatusLabelBalanceBTCValue.Text =
                        (balance * 1000).ToString("F5", CultureInfo.InvariantCulture);
                }
                else
                {
                    toolStripStatusLabelBalanceBTCCode.Text  = "BTC";
                    toolStripStatusLabelBalanceBTCValue.Text = balance.ToString("F6", CultureInfo.InvariantCulture);
                }

                //Helpers.ConsolePrint("CurrencyConverter", "Using CurrencyConverter" + ConfigManager.Instance.GeneralConfig.DisplayCurrency);
                var amount = (balance * Globals.BitcoinUsdRate);
                amount = ExchangeRateApi.ConvertToActiveCurrency(amount);
                toolStripStatusLabelBalanceDollarText.Text  = amount.ToString("F2", CultureInfo.InvariantCulture);
                toolStripStatusLabelBalanceDollarValue.Text = $"({ExchangeRateApi.ActiveDisplayCurrency})";
            }
        }
Exemplo n.º 3
0
        public void AddRateInfo(string groupName, string deviceStringInfo, ApiData iApiData, double paying,
                                bool isApiGetException)
        {
            var apiGetExceptionString = isApiGetException ? "**" : "";

            var speedString =
                Helpers.FormatDualSpeedOutput(iApiData.AlgorithmID, iApiData.Speed, iApiData.SecondarySpeed) +
                iApiData.AlgorithmName + apiGetExceptionString;
            var rateBtcString      = FormatPayingOutput(paying);
            var rateCurrencyString = ExchangeRateApi
                                     .ConvertToActiveCurrency(paying * Globals.BitcoinUsdRate * _factorTimeUnit)
                                     .ToString("F2", CultureInfo.InvariantCulture)
                                     + $" {ExchangeRateApi.ActiveDisplayCurrency}/" +
                                     International.GetText(ConfigManager.GeneralConfig.TimeUnit.ToString());

            try
            {
                // flowLayoutPanelRatesIndex may be OOB, so catch
                ((GroupProfitControl)flowLayoutPanelRates.Controls[_flowLayoutPanelRatesIndex++])
                .UpdateProfitStats(groupName, deviceStringInfo, speedString, rateBtcString, rateCurrencyString);
            }
            catch { }

            UpdateGlobalRate();
        }
Exemplo n.º 4
0
        private static (double fiatBalance, string fiatSymbol) getFiatFromBtcBalance(double btcBalance)
        {
            var usdAmount   = (BtcBalance * ExchangeRateApi.GetUsdExchangeRate());
            var fiatBalance = ExchangeRateApi.ConvertToActiveCurrency(usdAmount);
            var fiatSymbol  = ExchangeRateApi.ActiveDisplayCurrency;

            return(fiatBalance, fiatSymbol);
        }
        private void UpdateExchange()
        {
            var br           = ExchangeRateApi.GetUsdExchangeRate();
            var currencyRate = Tr("N/A");

            if (br > 0)
            {
                currencyRate = ExchangeRateApi.ConvertToActiveCurrency(br).ToString("F2");
            }

            toolTip1.SetToolTip(statusStrip1, $"1 BTC = {currencyRate} {ExchangeRateApi.ActiveDisplayCurrency}");

            Helpers.ConsolePrint("NICEHASH",
                                 "Current Bitcoin rate: " + br.ToString("F2", CultureInfo.InvariantCulture));
        }
Exemplo n.º 6
0
        private void UpdateExchange(object sender, EventArgs e)
        {
            FormHelpers.SafeInvoke(this, () =>
            {
                var br           = ExchangeRateApi.GetUsdExchangeRate();
                var currencyRate = Tr("N/A");
                if (br > 0)
                {
                    currencyRate = ExchangeRateApi.ConvertToActiveCurrency(br).ToString("F2");
                }

                toolTip1.SetToolTip(statusStrip1, $"1 BTC = {currencyRate} {ExchangeRateApi.ActiveDisplayCurrency}");

                Logger.Info("NICEHASH", $"Current Bitcoin rate: {br.ToString("F2", CultureInfo.InvariantCulture)}");
            });
        }
Exemplo n.º 7
0
        private void UpdateGlobalRate(double totalRate)
        {
            var factorTimeUnit   = TimeFactor.TimeUnit;
            var scaleBTC         = ConfigManager.GeneralConfig.AutoScaleBTCValues && totalRate < 0.1;
            var totalDisplayRate = totalRate * factorTimeUnit * (scaleBTC ? 1000 : 1);
            var displayTimeUnit  = Tr(ConfigManager.GeneralConfig.TimeUnit.ToString());

            toolStripStatusLabelBTCDayText.Text      = scaleBTC ? $"mBTC/{displayTimeUnit}" : $"BTC/{displayTimeUnit}";
            toolStripStatusLabelGlobalRateValue.Text = totalDisplayRate.ToString(scaleBTC ? "F5" : "F8", CultureInfo.InvariantCulture);

            var timeFactorRate = ExchangeRateApi
                                 .ConvertToActiveCurrency((totalRate * factorTimeUnit * ExchangeRateApi.GetUsdExchangeRate()));

            toolStripStatusLabelBTCDayValue.Text = timeFactorRate.ToString("F2", CultureInfo.InvariantCulture);
            toolStripStatusLabelBalanceText.Text = RatesAndStatsStates.Instance.LabelBalanceText;
        }
Exemplo n.º 8
0
        private void BitcoinExchangeCheck_Tick(object sender, EventArgs e)
        {
            Helpers.ConsolePrint("NICEHASH", "Bitcoin rate get");
            ExchangeRateApi.UpdateApi(textBoxWorkerName.Text.Trim());
            var br           = ExchangeRateApi.GetUsdExchangeRate();
            var currencyRate = International.GetText("BenchmarkRatioRateN_A");

            if (br > 0)
            {
                Globals.BitcoinUsdRate = br;
                currencyRate           = ExchangeRateApi.ConvertToActiveCurrency(br).ToString("F2");
            }

            toolTip1.SetToolTip(statusStrip1, $"1 BTC = {currencyRate} {ExchangeRateApi.ActiveDisplayCurrency}");

            Helpers.ConsolePrint("NICEHASH",
                                 "Current Bitcoin rate: " + Globals.BitcoinUsdRate.ToString("F2", CultureInfo.InvariantCulture));
        }