Skip to content

Commit bdb11f8

Browse files
committed
Uses coinpaprika in crex24 fail case
1 parent 265fbe2 commit bdb11f8

File tree

9 files changed

+148
-73
lines changed

9 files changed

+148
-73
lines changed

Core/Tools.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ public class LiquidityPrices
665665
public decimal BuyPrice;
666666
public decimal SellPrice;
667667

668-
public LiquidityPrices(PoolAPI.Orderbook orderbook, decimal volumeForSell_valueForBuy = 0)
668+
public LiquidityPrices(ExternalApi.Orderbook orderbook, decimal volumeForSell_valueForBuy = 0)
669669
{
670670
if (orderbook == null || (orderbook.buyLevels.Count == 0 && orderbook.sellLevels.Count == 0) || volumeForSell_valueForBuy == 0) { BuyPrice = 0; SellPrice = 0; return; }
671671

Janelas/Dashboard.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public void ChangeChartZoom(object sender, RoutedEventArgs e)
148148
break;
149149
}
150150

151-
ViewModel.DashboardChart.UpdateAxes(new[] { PoolAPI.XMR_nanopool.pointsHistory_user, PoolAPI.RVN_nanopool.pointsHistory_user }.SelectMany(d => d).GroupBy(kvp => kvp.Key, (key, kvps) => new { Key = key, Value = kvps.Sum(kvp => kvp.Value) }).ToDictionary(x => x.Key, x => x.Value), (int)Pages.Dashboard.chart_zoom_interval.TotalSeconds);
151+
ViewModel.DashboardChart.UpdateAxes(new[] { ExternalApi.XMR_nanopool.pointsHistory_user, ExternalApi.RVN_nanopool.pointsHistory_user }.SelectMany(d => d).GroupBy(kvp => kvp.Key, (key, kvps) => new { Key = key, Value = kvps.Sum(kvp => kvp.Value) }).ToDictionary(x => x.Key, x => x.Value), (int)Pages.Dashboard.chart_zoom_interval.TotalSeconds);
152152
}
153153

154154
public TimeSpan chart_zoom_interval { get; set; } = new TimeSpan(0, 24, 0, 0);

Janelas/Popups/Calculator.xaml.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ private void TimerUpdate_Elapsed(object sender, System.Timers.ElapsedEventArgs e
5757

5858
if ("RandomX".Equals(User.Settings.Device.cpu.Algorithm, StringComparison.OrdinalIgnoreCase))
5959
{
60-
CPUestimated_day_Coins = CPU_hashrate_decimal / 1000 * PoolAPI.XMR_nanopool.approximated_earnings.data.day.bitcoins.SubtractFee(Server.SoftwareParameters.ServerConfig.DynamicFee) / PoolAPI.Crex24.PaymentCoinBTC_Orderbook.buyLevels[0].price;
61-
CPUestimated_day_Bitcoin = CPUestimated_day_Coins * (decimal)PoolAPI.Crex24.PaymentCoinBTC_Orderbook.sellLevels[0].price;
60+
CPUestimated_day_Coins = CPU_hashrate_decimal / 1000 * ExternalApi.XMR_nanopool.approximated_earnings.data.day.bitcoins.SubtractFee(Server.SoftwareParameters.ServerConfig.DynamicFee) / ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.buyLevels[0].price;
61+
CPUestimated_day_Bitcoin = CPUestimated_day_Coins * (decimal)ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.sellLevels[0].price;
6262
}
6363
if ("KawPow".Equals(User.Settings.Device.cpu.Algorithm, StringComparison.OrdinalIgnoreCase))
6464
{
65-
CPUestimated_day_Coins = CPU_hashrate_decimal / 1000 * PoolAPI.RVN_nanopool.approximated_earnings.data.day.bitcoins.SubtractFee(Server.SoftwareParameters.ServerConfig.DynamicFee) / PoolAPI.Crex24.PaymentCoinBTC_Orderbook.buyLevels[0].price;
66-
CPUestimated_day_Bitcoin = CPUestimated_day_Coins * (decimal)PoolAPI.Crex24.PaymentCoinBTC_Orderbook.sellLevels[0].price;
65+
CPUestimated_day_Coins = CPU_hashrate_decimal / 1000 * ExternalApi.RVN_nanopool.approximated_earnings.data.day.bitcoins.SubtractFee(Server.SoftwareParameters.ServerConfig.DynamicFee) / ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.buyLevels[0].price;
66+
CPUestimated_day_Bitcoin = CPUestimated_day_Coins * (decimal)ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.sellLevels[0].price;
6767
}
68-
CPUestimated_day_USD = CPUestimated_day_Bitcoin * (decimal)PoolAPI.BitcoinPrice.BTCUSD;
68+
CPUestimated_day_USD = CPUestimated_day_Bitcoin * (decimal)ExternalApi.BitcoinPrice.BTCUSD;
6969
CPUestimated_day_Coins_string = Math.Round(CPUestimated_day_Coins, 5).ToString();
7070
CPUestimated_day_Sats_string = ((decimal)Math.Round(CPUestimated_day_Bitcoin, 8)).ToString();
7171
CPUestimated_day_USD_string = Math.Round(CPUestimated_day_USD, 2).ToString();
@@ -81,15 +81,15 @@ private void TimerUpdate_Elapsed(object sender, System.Timers.ElapsedEventArgs e
8181

8282
if ("RandomX".Equals(User.Settings.Device.opencl.Algorithm, StringComparison.OrdinalIgnoreCase))
8383
{
84-
OPENCLestimated_day_Coins = OPENCL_hashrate_decimal / 1000 * PoolAPI.XMR_nanopool.approximated_earnings.data.day.bitcoins.SubtractFee(Server.SoftwareParameters.ServerConfig.DynamicFee) / PoolAPI.Crex24.PaymentCoinBTC_Orderbook.buyLevels[0].price;
85-
OPENCLestimated_day_Bitcoin = OPENCLestimated_day_Coins * (decimal)PoolAPI.Crex24.PaymentCoinBTC_Orderbook.sellLevels[0].price;
84+
OPENCLestimated_day_Coins = OPENCL_hashrate_decimal / 1000 * ExternalApi.XMR_nanopool.approximated_earnings.data.day.bitcoins.SubtractFee(Server.SoftwareParameters.ServerConfig.DynamicFee) / ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.buyLevels[0].price;
85+
OPENCLestimated_day_Bitcoin = OPENCLestimated_day_Coins * (decimal)ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.sellLevels[0].price;
8686
}
8787
if ("KawPow".Equals(User.Settings.Device.opencl.Algorithm, StringComparison.OrdinalIgnoreCase))
8888
{
89-
OPENCLestimated_day_Coins = OPENCL_hashrate_decimal / 1000 * PoolAPI.RVN_nanopool.approximated_earnings.data.day.bitcoins.SubtractFee(Server.SoftwareParameters.ServerConfig.DynamicFee) / PoolAPI.Crex24.PaymentCoinBTC_Orderbook.buyLevels[0].price;
90-
OPENCLestimated_day_Bitcoin = OPENCLestimated_day_Coins * (decimal)PoolAPI.Crex24.PaymentCoinBTC_Orderbook.sellLevels[0].price;
89+
OPENCLestimated_day_Coins = OPENCL_hashrate_decimal / 1000 * ExternalApi.RVN_nanopool.approximated_earnings.data.day.bitcoins.SubtractFee(Server.SoftwareParameters.ServerConfig.DynamicFee) / ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.buyLevels[0].price;
90+
OPENCLestimated_day_Bitcoin = OPENCLestimated_day_Coins * (decimal)ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.sellLevels[0].price;
9191
}
92-
OPENCLestimated_day_USD = OPENCLestimated_day_Bitcoin * (decimal)PoolAPI.BitcoinPrice.BTCUSD;
92+
OPENCLestimated_day_USD = OPENCLestimated_day_Bitcoin * (decimal)ExternalApi.BitcoinPrice.BTCUSD;
9393
OPENCLestimated_day_Coins_string = Math.Round(OPENCLestimated_day_Coins, 5).ToString();
9494
OPENCLestimated_day_Sats_string = ((decimal)Math.Round(OPENCLestimated_day_Bitcoin, 8)).ToString();
9595
OPENCLestimated_day_USD_string = Math.Round(OPENCLestimated_day_USD, 2).ToString();
@@ -105,15 +105,15 @@ private void TimerUpdate_Elapsed(object sender, System.Timers.ElapsedEventArgs e
105105

106106
if ("RandomX".Equals(User.Settings.Device.cuda.Algorithm, StringComparison.OrdinalIgnoreCase))
107107
{
108-
CUDAestimated_day_Coins = CUDA_hashrate_decimal / 1000 * PoolAPI.XMR_nanopool.approximated_earnings.data.day.bitcoins.SubtractFee(Server.SoftwareParameters.ServerConfig.DynamicFee) / PoolAPI.Crex24.PaymentCoinBTC_Orderbook.buyLevels[0].price;
109-
CUDAestimated_day_Bitcoin = CUDAestimated_day_Coins * (decimal)PoolAPI.Crex24.PaymentCoinBTC_Orderbook.sellLevels[0].price;
108+
CUDAestimated_day_Coins = CUDA_hashrate_decimal / 1000 * ExternalApi.XMR_nanopool.approximated_earnings.data.day.bitcoins.SubtractFee(Server.SoftwareParameters.ServerConfig.DynamicFee) / ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.buyLevels[0].price;
109+
CUDAestimated_day_Bitcoin = CUDAestimated_day_Coins * (decimal)ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.sellLevels[0].price;
110110
}
111111
if ("KawPow".Equals(User.Settings.Device.cuda.Algorithm, StringComparison.OrdinalIgnoreCase))
112112
{
113-
CUDAestimated_day_Coins = CUDA_hashrate_decimal / 1000 * PoolAPI.RVN_nanopool.approximated_earnings.data.day.bitcoins.SubtractFee(Server.SoftwareParameters.ServerConfig.DynamicFee) / PoolAPI.Crex24.PaymentCoinBTC_Orderbook.buyLevels[0].price;
114-
CUDAestimated_day_Bitcoin = CUDAestimated_day_Coins * (decimal)PoolAPI.Crex24.PaymentCoinBTC_Orderbook.sellLevels[0].price;
113+
CUDAestimated_day_Coins = CUDA_hashrate_decimal / 1000 * ExternalApi.RVN_nanopool.approximated_earnings.data.day.bitcoins.SubtractFee(Server.SoftwareParameters.ServerConfig.DynamicFee) / ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.buyLevels[0].price;
114+
CUDAestimated_day_Bitcoin = CUDAestimated_day_Coins * (decimal)ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.sellLevels[0].price;
115115
}
116-
CUDAestimated_day_USD = CUDAestimated_day_Bitcoin * (decimal)PoolAPI.BitcoinPrice.BTCUSD;
116+
CUDAestimated_day_USD = CUDAestimated_day_Bitcoin * (decimal)ExternalApi.BitcoinPrice.BTCUSD;
117117
CUDAestimated_day_Coins_string = Math.Round(CUDAestimated_day_Coins, 5).ToString();
118118
CUDAestimated_day_Sats_string = ((decimal)Math.Round(CUDAestimated_day_Bitcoin, 8)).ToString();
119119
CUDAestimated_day_USD_string = Math.Round(CUDAestimated_day_USD, 2).ToString();

Janelas/Popups/ExhangeRates.xaml.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,23 @@ public ExchangeRates(decimal exchangeRatePontosRandomXToMiningCoin, decimal exch
2929
{
3030
CoinName = User.Settings.User.PayCoin != null ? User.Settings.User.PayCoin.CoinName : "Coins";
3131

32-
BTCToCoinRate = decimal.Round(BTCToBTCRate / (PoolAPI.Crex24.PaymentCoinBTC_Orderbook.buyLevels[0].price + PoolAPI.Crex24.PaymentCoinBTC_Orderbook.buyLevels[0].price) / 2);
32+
BTCToCoinRate = decimal.Round(BTCToBTCRate / (ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.buyLevels[0].price + ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.buyLevels[0].price) / 2);
3333
BTCToBTCRate = 1;
34-
BTCToUSDRate = decimal.Round(PoolAPI.BitcoinPrice.BTCUSD, 2);
34+
BTCToUSDRate = decimal.Round(ExternalApi.BitcoinPrice.BTCUSD, 2);
3535

36-
PointRandomXToCoinRate = decimal.Round(exchangeRatePontosRandomXToMiningCoin * (PoolAPI.Crex24.XMRBTC_Orderbook.sellLevels[0].price / PoolAPI.Crex24.PaymentCoinBTC_Orderbook.sellLevels[0].price), 6);
37-
PointRandomXToBTCRate = decimal.Round((PoolAPI.Crex24.XMRBTC_Orderbook.buyLevels[0].price + PoolAPI.Crex24.XMRBTC_Orderbook.sellLevels[0].price) / 2 * exchangeRatePontosRandomXToMiningCoin / BTCToBTCRate, 8);
38-
PointRandomXToUSDRate = decimal.Round((PoolAPI.Crex24.XMRBTC_Orderbook.buyLevels[0].price + PoolAPI.Crex24.XMRBTC_Orderbook.sellLevels[0].price) / 2 * exchangeRatePontosRandomXToMiningCoin / BTCToBTCRate * BTCToUSDRate, 6);
36+
PointRandomXToCoinRate = decimal.Round(exchangeRatePontosRandomXToMiningCoin * (ExternalApi.ExchangeOrderbooks.XMRBTC.sellLevels[0].price / ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.sellLevels[0].price), 6);
37+
PointRandomXToBTCRate = decimal.Round((ExternalApi.ExchangeOrderbooks.XMRBTC.buyLevels[0].price + ExternalApi.ExchangeOrderbooks.XMRBTC.sellLevels[0].price) / 2 * exchangeRatePontosRandomXToMiningCoin / BTCToBTCRate, 8);
38+
PointRandomXToUSDRate = decimal.Round((ExternalApi.ExchangeOrderbooks.XMRBTC.buyLevels[0].price + ExternalApi.ExchangeOrderbooks.XMRBTC.sellLevels[0].price) / 2 * exchangeRatePontosRandomXToMiningCoin / BTCToBTCRate * BTCToUSDRate, 6);
3939

40-
PointKawPowToCoinRate = decimal.Round(exchangeRatePontosKawPowToMiningCoin * (PoolAPI.Crex24.RVNBTC_Orderbook.sellLevels[0].price / PoolAPI.Crex24.PaymentCoinBTC_Orderbook.sellLevels[0].price), 6);
41-
PointKawPowToBTCRate = decimal.Round((PoolAPI.Crex24.RVNBTC_Orderbook.buyLevels[0].price + PoolAPI.Crex24.RVNBTC_Orderbook.sellLevels[0].price) / 2 * exchangeRatePontosKawPowToMiningCoin / BTCToBTCRate, 8);
42-
PointKawPowToUSDRate = decimal.Round((PoolAPI.Crex24.RVNBTC_Orderbook.buyLevels[0].price + PoolAPI.Crex24.RVNBTC_Orderbook.sellLevels[0].price) / 2 * exchangeRatePontosKawPowToMiningCoin / BTCToBTCRate * BTCToUSDRate, 6);
40+
PointKawPowToCoinRate = decimal.Round(exchangeRatePontosKawPowToMiningCoin * (ExternalApi.ExchangeOrderbooks.RVNBTC.sellLevels[0].price / ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.sellLevels[0].price), 6);
41+
PointKawPowToBTCRate = decimal.Round((ExternalApi.ExchangeOrderbooks.RVNBTC.buyLevels[0].price + ExternalApi.ExchangeOrderbooks.RVNBTC.sellLevels[0].price) / 2 * exchangeRatePontosKawPowToMiningCoin / BTCToBTCRate, 8);
42+
PointKawPowToUSDRate = decimal.Round((ExternalApi.ExchangeOrderbooks.RVNBTC.buyLevels[0].price + ExternalApi.ExchangeOrderbooks.RVNBTC.sellLevels[0].price) / 2 * exchangeRatePontosKawPowToMiningCoin / BTCToBTCRate * BTCToUSDRate, 6);
4343

4444
CoinToCoinRate = 1;
4545
CoinToPointRandomXRate = decimal.Round(CoinToCoinRate / PointRandomXToCoinRate, 2);
4646
CoinToPointKawPowRate = decimal.Round(CoinToCoinRate / PointKawPowToCoinRate, 2);
47-
CoinToBTCRate = decimal.Round((PoolAPI.Crex24.PaymentCoinBTC_Orderbook.buyLevels[0].price + PoolAPI.Crex24.PaymentCoinBTC_Orderbook.buyLevels[0].price) / 2 / BTCToBTCRate, 8);
48-
CoinToUSDRate = decimal.Round((PoolAPI.Crex24.PaymentCoinBTC_Orderbook.buyLevels[0].price + PoolAPI.Crex24.PaymentCoinBTC_Orderbook.buyLevels[0].price) / 2 / BTCToBTCRate * BTCToUSDRate, 6);
47+
CoinToBTCRate = decimal.Round((ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.buyLevels[0].price + ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.buyLevels[0].price) / 2 / BTCToBTCRate, 8);
48+
CoinToUSDRate = decimal.Round((ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.buyLevels[0].price + ExternalApi.ExchangeOrderbooks.PaymentCoinBTC.buyLevels[0].price) / 2 / BTCToBTCRate * BTCToUSDRate, 6);
4949

5050
loadingVisualElement.Visibility = Visibility.Hidden;
5151
AllContent.Visibility = Visibility.Visible;

PoolAPI/BTCPrice.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace TrueMiningDesktop.PoolAPI
1+
namespace TrueMiningDesktop.ExternalApi
22
{
33
public class BitcoinPrice
44
{
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Collections.Generic;
22

3-
namespace TrueMiningDesktop.PoolAPI
3+
namespace TrueMiningDesktop.ExternalApi
44
{
55
public class BuyLevel
66
{
@@ -20,10 +20,10 @@ public class Orderbook
2020
public List<SellLevel> sellLevels = new List<SellLevel>();
2121
}
2222

23-
public class Crex24
23+
public class ExchangeOrderbooks
2424
{
25-
public static Orderbook XMRBTC_Orderbook = new Orderbook();
26-
public static Orderbook RVNBTC_Orderbook = new Orderbook();
27-
public static Orderbook PaymentCoinBTC_Orderbook = new Orderbook();
25+
public static Orderbook XMRBTC = new Orderbook();
26+
public static Orderbook RVNBTC = new Orderbook();
27+
public static Orderbook PaymentCoinBTC = new Orderbook();
2828
}
2929
}

PoolAPI/XMR_nanopool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Collections.Generic;
22

3-
namespace TrueMiningDesktop.PoolAPI
3+
namespace TrueMiningDesktop.ExternalApi
44
{
55
public class Minute
66
{

0 commit comments

Comments
 (0)