Пример #1
0
        public void TestGetMiningPriceAtCrex24PerdayByMultiGpu()
        {
            BsodAPI api = new BsodAPI();

            HashPower.SetupHardware("1080ti", 18);
            HashPower.SetupHardware("1070ti", 6);
            HashPower.SetupHardware("1070", 7);

            CryptoCurrency coins = api.LoadCurrency();

            MiningCalculator calc = new MiningCalculator();

            SortedDictionary <string, double> prices = new SortedDictionary <string, double>();

            foreach (string symbol in CurrencyName.Symbols)
            {
                if (coins[symbol] != null)
                {
                    double bahtPerDay = GetMiningBahtPerDay(symbol, coins[symbol].algo, PoolName.Bsod, ExchangeName.Crex24, calc);
                    prices.Add(symbol + " (" + coins[symbol].algo + ")", bahtPerDay);
                }
            }

            foreach (KeyValuePair <string, double> item in prices)
            {
                Debug.WriteLine(string.Format("{0} = {1} ", item.Key, item.Value));
            }

            Assert.AreEqual(0, 0);
        }
Пример #2
0
        public void TestGetTotalBahtAutoBtcMiningPerDayFromZergPool()
        {
            string json  = System.IO.File.ReadAllText("myrig.json");
            Rig    myRig = JsonConvert.DeserializeObject <Rig>(json);

            HashPower.SetupHardware(myRig);

            MiningCalculator calc = new MiningCalculator();

            foreach (string algorithmName in AlgoritmName.Symbols)
            {
                calc.MyHashRate = HashPower.GetAlgorithmHashRate(algorithmName);
                double btcCurrentPerDay = calc.GetTotalFiatMoneyMiningPerday(algorithmName, PoolName.Zerg, true, FiatCurrency.THB);
                double btc24HoursPerDay = calc.GetTotalFiatMoneyMiningPerday(algorithmName, PoolName.Zerg, false, FiatCurrency.THB);
                Debug.WriteLine(string.Format("{0} estimate_current: {1} baht estimate_24hour: {2} baht ", algorithmName, btcCurrentPerDay.ToString("N2"), btc24HoursPerDay.ToString("N2")));
                Assert.AreEqual(true, btcCurrentPerDay > -1);
            }
        }
Пример #3
0
        public void TestGetTotalBahtAllPoolAllExchange()
        {
            double  keepMoreThan = 0;
            BsodAPI bsod         = new BsodAPI();
            GosAPI  gos          = new GosAPI();

            string json  = System.IO.File.ReadAllText("myrig.json");
            Rig    myRig = JsonConvert.DeserializeObject <Rig>(json);

            HashPower.SetupHardware(myRig);

            Console.WriteLine("Start loading pool data. Please wait ...");
            MiningCalculator calc      = new MiningCalculator();
            CryptoCurrency   bsodCoins = calc.PoolCoins[0];
            CryptoCurrency   gosCoins  = calc.PoolCoins[1];

            Console.WriteLine("Analyzing ...");

            SortedDictionary <string, double> prices = new SortedDictionary <string, double>();
            StringBuilder result = new StringBuilder();

            foreach (string symbol in CurrencyName.Symbols)
            {
                if (bsodCoins != null && bsodCoins[symbol] != null)
                {
                    double bahtPerDay = GetMiningBahtPerDay(symbol, bsodCoins[symbol].algo, PoolName.Bsod, ExchangeName.CryptoBridge, calc);
                    if (bahtPerDay > keepMoreThan)
                    {
                        prices.Add(symbol + " (" + bsodCoins[symbol].algo + ") mining@bsod sale@crypto-bridge ", bahtPerDay);
                        result.AppendLine(string.Format("{0},{1},{2},{3},{4}", symbol, bsodCoins[symbol].algo, "bsod", "crypto-bridge", bahtPerDay));
                    }

                    bahtPerDay = GetMiningBahtPerDay(symbol, bsodCoins[symbol].algo, PoolName.Bsod, ExchangeName.Crex24, calc);
                    if (bahtPerDay > keepMoreThan)
                    {
                        prices.Add(symbol + " (" + bsodCoins[symbol].algo + ") mining@bsod sale@crex24", bahtPerDay);
                        result.AppendLine(string.Format("{0},{1},{2},{3},{4}", symbol, bsodCoins[symbol].algo, "bsod", "crex24", bahtPerDay));
                    }
                }

                if (gosCoins != null && gosCoins[symbol] != null)
                {
                    double bahtPerDay = GetMiningBahtPerDay(symbol, gosCoins[symbol].algo, PoolName.Gos, ExchangeName.CryptoBridge, calc);
                    if (bahtPerDay > keepMoreThan)
                    {
                        prices.Add(symbol + " (" + gosCoins[symbol].algo + ") mining@gos sale@crypto-bridge", bahtPerDay);
                        result.AppendLine(string.Format("{0},{1},{2},{3},{4}", symbol, gosCoins[symbol].algo, "gos", "crypto-bridge", bahtPerDay));
                    }

                    bahtPerDay = GetMiningBahtPerDay(symbol, gosCoins[symbol].algo, PoolName.Gos, ExchangeName.Crex24, calc);
                    if (bahtPerDay > keepMoreThan)
                    {
                        prices.Add(symbol + " (" + gosCoins[symbol].algo + ") mining@gos sale@crex24", bahtPerDay);
                        result.AppendLine(string.Format("{0},{1},{2},{3},{4}", symbol, gosCoins[symbol].algo, "gos", "crex24", bahtPerDay));
                    }
                }
            }

            Console.WriteLine("1080ti x 18 ");
            Console.WriteLine("1070ti x 6");
            Console.WriteLine("1070 x 7 ");


            foreach (KeyValuePair <string, double> item in prices)
            {
                if (item.Value > 0)
                {
                    string line = string.Format("{0} = {1} ", item.Key, item.Value);
                    Console.WriteLine(line);
                }
            }


            Assert.AreEqual(0, 0);
        }
Пример #4
0
        static void Main(string[] args)
        {
            Console.CancelKeyPress += Console_CancelKeyPress;
            BsodAPI bsod = new BsodAPI();
            GosAPI  gos  = new GosAPI();

            Console.WriteLine("Start loading pool data. Please wait ...");
            _calc = new MiningCalculator();

            ParseArgument(args);

            Rig myRig = ReadRigConfig("myrig.json");

            HashPower.SetupHardware(myRig);

            string input = "";

            while (input != Environment.NewLine && input != "q")
            {
                CryptoCurrency bsodCoins            = _calc.PoolCoins[0];
                CryptoCurrency gosCoins             = _calc.PoolCoins[1];
                CryptoCurrency iceCoins             = _calc.PoolCoins[2];
                Algorithm      zergAlgorithm        = _calc.PoolAlgorithms[0];
                Algorithm      phiAlgorithm         = _calc.PoolAlgorithms[1];
                Algorithm      zpoolAlgorithm       = _calc.PoolAlgorithms[2];
                Algorithm      ahashAlgorithm       = _calc.PoolAlgorithms[3];
                Algorithm      blockMasterAlgorithm = _calc.PoolAlgorithms[4];

                Console.WriteLine("Analyzing ...");

                #region monitor mode
                if (_needMonitor) // monitor mode
                {
                    foreach (GpuInfo gpu in myRig.Chipsets)
                    {
                        Console.WriteLine(string.Format("{0} x {1} ", gpu.Name, gpu.Count));
                    }
                    string algorithmName = _monitorCoin.ToLower();

                    Console.WriteLine("Monitoring " + zpoolAlgorithm[algorithmName] != null ? algorithmName : _monitorCoin);
                    Console.WriteLine();

                    string symbol = _monitorCoin;

                    _coinsResult.Clear();

                    ExploreMining(bsodCoins, symbol, PoolName.Bsod);
                    ExploreMining(gosCoins, symbol, PoolName.Gos);
                    ExploreMining(iceCoins, symbol, PoolName.IceMining);

                    // display result
                    _coinsResult.Sort();
                    foreach (CryptoCurrencyResult coin in _coinsResult)
                    {
                        string line = string.Format("{0} {1}(24hr)\t{2}@{3} \tsale@{4}", coin.h24_btc.ToString("N2"), _fiat, coin.symbol, coin.Pool, coin.Exchange);
                        Console.WriteLine(line);
                    }

                    if (zergAlgorithm[algorithmName] != null)
                    {
                        _calc.MyHashRate = HashPower.GetAlgorithmHashRate(algorithmName);
                        double btcCurrentPerDay = _calc.GetTotalFiatMoneyMiningPerday(algorithmName, PoolName.Zerg, true, _fiat);
                        double btc24HoursPerDay = _calc.GetTotalFiatMoneyMiningPerday(algorithmName, PoolName.Zerg, false, _fiat);

                        AlgorithmResult algorAtZerg = new AlgorithmResult();
                        algorAtZerg.name             = algorithmName;
                        algorAtZerg.Pool             = PoolName.Zerg;
                        algorAtZerg.estimate_current = btcCurrentPerDay;
                        algorAtZerg.estimate_last24h = btc24HoursPerDay;
                        _algorsResult.Add(algorAtZerg);

                        if (_needToShowCoinsNumPerDay)
                        {
                            ShowNumOfBtcMiningPerDay(algorithmName, PoolName.Zerg);
                        }
                    }


                    if (phiAlgorithm[algorithmName] != null)
                    {
                        _calc.MyHashRate = HashPower.GetAlgorithmHashRate(algorithmName);
                        double btcCurrentPerDay = _calc.GetTotalFiatMoneyMiningPerday(algorithmName, PoolName.PhiPhi, true, _fiat);
                        double btc24HoursPerDay = _calc.GetTotalFiatMoneyMiningPerday(algorithmName, PoolName.PhiPhi, false, _fiat);

                        AlgorithmResult algorAtPhi = new AlgorithmResult();
                        algorAtPhi.name             = algorithmName;
                        algorAtPhi.Pool             = PoolName.PhiPhi;
                        algorAtPhi.estimate_current = btcCurrentPerDay;
                        algorAtPhi.estimate_last24h = btc24HoursPerDay;
                        _algorsResult.Add(algorAtPhi);

                        if (_needToShowCoinsNumPerDay)
                        {
                            ShowNumOfBtcMiningPerDay(algorithmName, PoolName.PhiPhi);
                        }
                    }


                    if (ahashAlgorithm[algorithmName] != null)
                    {
                        _calc.MyHashRate = HashPower.GetAlgorithmHashRate(algorithmName);
                        double btcCurrentPerDay = _calc.GetTotalFiatMoneyMiningPerday(algorithmName, PoolName.AhashPool, true, _fiat);
                        double btc24HoursPerDay = _calc.GetTotalFiatMoneyMiningPerday(algorithmName, PoolName.AhashPool, false, _fiat);

                        AlgorithmResult algorAtAhash = new AlgorithmResult();
                        algorAtAhash.name             = algorithmName;
                        algorAtAhash.Pool             = PoolName.AhashPool;
                        algorAtAhash.estimate_current = btcCurrentPerDay;
                        algorAtAhash.estimate_last24h = btc24HoursPerDay;
                        _algorsResult.Add(algorAtAhash);

                        if (_needToShowCoinsNumPerDay)
                        {
                            ShowNumOfBtcMiningPerDay(algorithmName, PoolName.AhashPool);
                        }
                    }

                    if (blockMasterAlgorithm[algorithmName] != null)
                    {
                        _calc.MyHashRate = HashPower.GetAlgorithmHashRate(algorithmName);
                        double btcCurrentPerDay = _calc.GetTotalFiatMoneyMiningPerday(algorithmName, PoolName.BlockMaster, true, _fiat);
                        double btc24HoursPerDay = _calc.GetTotalFiatMoneyMiningPerday(algorithmName, PoolName.BlockMaster, false, _fiat);

                        AlgorithmResult algorAtBlockMaster = new AlgorithmResult();
                        algorAtBlockMaster.name             = algorithmName;
                        algorAtBlockMaster.Pool             = PoolName.BlockMaster;
                        algorAtBlockMaster.estimate_current = btcCurrentPerDay;
                        algorAtBlockMaster.estimate_last24h = btc24HoursPerDay;
                        _algorsResult.Add(algorAtBlockMaster);

                        if (_needToShowCoinsNumPerDay)
                        {
                            ShowNumOfBtcMiningPerDay(algorithmName, PoolName.BlockMaster);
                        }
                    }

                    if (zpoolAlgorithm[algorithmName] != null)
                    {
                        _calc.MyHashRate = HashPower.GetAlgorithmHashRate(algorithmName);
                        double btcCurrentPerDay = _calc.GetTotalFiatMoneyMiningPerday(algorithmName, PoolName.Zpool, true, _fiat);
                        double btc24HoursPerDay = _calc.GetTotalFiatMoneyMiningPerday(algorithmName, PoolName.Zpool, false, _fiat);

                        AlgorithmResult algorAtZpool = new AlgorithmResult();
                        algorAtZpool.name             = algorithmName;
                        algorAtZpool.Pool             = PoolName.Zpool;
                        algorAtZpool.estimate_current = btcCurrentPerDay;
                        algorAtZpool.estimate_last24h = btc24HoursPerDay;
                        _algorsResult.Add(algorAtZpool);

                        if (_needToShowCoinsNumPerDay)
                        {
                            ShowNumOfBtcMiningPerDay(algorithmName, PoolName.Zpool);
                        }
                    }

                    _algorsResult.Sort();
                    foreach (AlgorithmResult algor in _algorsResult)
                    {
                        string line = string.Format("{0} {1}(24hr)\t{2} {3}(current) \t{4}@{5}", algor.estimate_last24h.ToString("N2"), _fiat, algor.estimate_current.ToString("N2"), _fiat, algor.name, algor.Pool);
                        Console.WriteLine(line);
                        _result.AppendLine(string.Format("{0},{1},{2},{3},{4}", algor.name, algor.Pool, "bx", algor.estimate_last24h.ToString("F2"), algor.estimate_current.ToString("F2")));
                    }


                    _calc.RefreshPool();


                    if (_needWriteFile)
                    {
                        System.IO.File.WriteAllText(_filename, _result.ToString());
                        Console.WriteLine("File {0} saved.", _filename);
                    }
                }
                #endregion monitor mode

                #region normal mode
                else // normal mode
                {
                    foreach (string symbol in CurrencyName.Symbols)
                    {
                        ExploreMining(bsodCoins, symbol, PoolName.Bsod);
                        ExploreMining(gosCoins, symbol, PoolName.Gos);
                        ExploreMining(iceCoins, symbol, PoolName.IceMining);
                    }

                    _coinsResult.Sort();

                    // display

                    Console.WriteLine();
                    Console.WriteLine("Analyzing gpu ...");
                    foreach (GpuInfo gpu in myRig.Chipsets)
                    {
                        Console.WriteLine(string.Format("{0} x {1} ", gpu.Name, gpu.Count));
                    }
                    Console.WriteLine();

                    foreach (CryptoCurrencyResult coin in _coinsResult)
                    {
                        string line = string.Format("{0} {1}(24hr)\t{2}@{3} \tsale@{4}", coin.h24_btc.ToString("N2"), _fiat, coin.symbol, coin.Pool, coin.Exchange);
                        _result.AppendLine(string.Format("{0},{1},{2},{3},{4}", coin.symbol, coin.algo, coin.Pool, coin.Exchange, coin.h24_btc.ToString("F2")));
                        Console.WriteLine(line);
                    }

                    Console.WriteLine();
                    Console.WriteLine("Analyzing auto btc pool ...");
                    Console.WriteLine();

                    foreach (string algorithmName in AlgoritmName.Symbols)
                    {
                        _calc.MyHashRate = HashPower.GetAlgorithmHashRate(algorithmName);
                        ExploreMiningDetail(algorithmName, PoolName.Zerg);
                        ExploreMiningDetail(algorithmName, PoolName.PhiPhi);
                        ExploreMiningDetail(algorithmName, PoolName.AhashPool);
                        ExploreMiningDetail(algorithmName, PoolName.Zpool);
                        ExploreMiningDetail(algorithmName, PoolName.BlockMaster);
                    }

                    _algorsResult.Sort();
                    foreach (AlgorithmResult algor in _algorsResult)
                    {
                        string line = string.Format("{0} {1}(24hr)  \t{2} {3}(current) \t{4}@{5}", algor.estimate_last24h.ToString("N2"), _fiat, algor.estimate_current.ToString("N2"), _fiat, algor.name, algor.Pool);
                        Console.WriteLine(line);
                        _result.AppendLine(string.Format("{0},{1},{2},{3},{4}", algor.name, algor.Pool, "bx", algor.estimate_last24h.ToString("F2"), algor.estimate_current.ToString("F2")));
                    }


                    if (_needWriteFile)
                    {
                        System.IO.File.WriteAllText(_filename, _result.ToString());
                        Console.WriteLine("File {0} saved.", _filename);
                    }
                }
                #endregion normal mode

                #region dig mode
                if (_needDig)
                {
                    Console.WriteLine();
                    DoMining();
                }
                #endregion dig mode

                if (_miners != null)
                {
                    Console.WriteLine();
                    Console.WriteLine(string.Format("Next watch in {0} hour.", _miners.SwapTime));
                    int sleepTime = _miners.SwapTime > int.MaxValue ? 3600000 : (int)(_miners.SwapTime * 3600000);
                    System.Threading.Thread.Sleep(sleepTime);

                    Console.WriteLine("Start reloading pool data. Please wait ...");
                    _calc.RefreshPool();
                    _calc.RefreshPrice();
                }
                else
                {
                    Console.ReadLine();
                    return;
                }
            }
        }