private static double GetMiningBahtPerDay(string coinSymbol, string algorithm, PoolName pool, ExchangeName exchangeName, MiningCalculator calc) { double hashRate = HashPower.GetAlgorithmHashRate(algorithm); calc.MyHashRate = hashRate; System.Diagnostics.Debug.WriteLine(string.Format("My hashrate of algor {0} = {1} ", algorithm, calc.MyHashRate)); double bahtPerDay = calc.GetTotalFiatMoneyMiningPerday(coinSymbol, pool, exchangeName, FiatCurrency.THB); System.Diagnostics.Debug.WriteLine(string.Format("Total baht per day at {0} of {1} ==========> {2} Baht ", exchangeName, coinSymbol, bahtPerDay)); return(bahtPerDay); }
private static double GetMiningFiatPerDay(string coinSymbol, string algorithm, PoolName pool, ExchangeName exchangeName) { double hashRate = HashPower.GetAlgorithmHashRate(algorithm); _calc.MyHashRate = hashRate; if (_isDebug) { Console.WriteLine(string.Format("My hashrate of algor {0} = {1} ", algorithm, _calc.MyHashRate)); } double moneyPerDay = _calc.GetTotalFiatMoneyMiningPerday(coinSymbol, pool, exchangeName, _fiat); if (_isDebug) { Console.WriteLine(string.Format("Total money per day at {0} of {1} ==========> {2} {3} ", exchangeName, coinSymbol, moneyPerDay, _fiat)); } return(moneyPerDay); }
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); } }
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; } } }