Skip to content

Commit

Permalink
Add support for displaying NiceHash profitability from WhatToMine.com
Browse files Browse the repository at this point in the history
  • Loading branch information
nwoolls committed Feb 4, 2020
1 parent debba50 commit d8c1479
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion MultiMiner.WhatToMine/Extensions/CoinInformationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ static class CoinInformationExtensions
{
public static void PopulateFromJson(this CoinInformation coinInformation, Data.ApiCoinInformation apiCoinInformation)
{
coinInformation.Symbol = apiCoinInformation.Tag;
coinInformation.Symbol = FixSymbolName(apiCoinInformation.Tag, apiCoinInformation.Algorithm);
coinInformation.Algorithm = FixAlgorithmName(apiCoinInformation.Algorithm);
coinInformation.CurrentBlocks = apiCoinInformation.Last_Block;
coinInformation.Difficulty = apiCoinInformation.Difficulty;
Expand All @@ -26,11 +26,25 @@ public static void PopulateFromJson(this CoinInformation coinInformation, Data.A
coinInformation.Price = apiCoinInformation.Exchange_Rate;
}

private static string FixSymbolName(string symbol, string algorithm)
{
string result = symbol;

if ("NICEHASH".Equals(result))
{
result = "NiceHash:" + algorithm.Replace(AlgorithmFullNames.SHA256, AlgorithmNames.SHA256);
}

return result;
}

private static string FixAlgorithmName(string algorithm)
{
string result = algorithm;
if (algorithm.Equals(ApiContext.ScryptNFactor, StringComparison.OrdinalIgnoreCase))
{
result = AlgorithmFullNames.ScryptN;
}
else
{
KnownAlgorithm knownAlgorithm = KnownAlgorithms.Algorithms.SingleOrDefault(a => a.Name.Equals(algorithm, StringComparison.OrdinalIgnoreCase));
Expand Down

0 comments on commit d8c1479

Please sign in to comment.