.crypto will now show CoinMarketCap rank. Small refactor

This commit is contained in:
Kwoth
2022-01-31 11:50:49 +01:00
parent 3e0bbd8ada
commit 2d90ecaa51
5 changed files with 131 additions and 83 deletions

View File

@@ -1,37 +1,84 @@
#nullable disable
using Newtonsoft.Json;
using System.Text.Json.Serialization;
namespace NadekoBot.Modules.Searches.Common;
public class CryptoResponse
{
public List<CryptoResponseData> Data { get; set; }
public List<CmcResponseData> Data { get; set; }
}
public class CryptoResponseData
public class CmcQuote
{
public string Id { get; set; }
[JsonPropertyName("price")]
public double Price { get; set; }
[JsonPropertyName("volume_24h")]
public double Volume24h { get; set; }
[JsonPropertyName("volume_change_24h")]
public double VolumeChange24h { get; set; }
[JsonPropertyName("percent_change_1h")]
public double PercentChange1h { get; set; }
[JsonPropertyName("percent_change_24h")]
public double PercentChange24h { get; set; }
[JsonPropertyName("percent_change_7d")]
public double PercentChange7d { get; set; }
[JsonPropertyName("market_cap")]
public double MarketCap { get; set; }
[JsonPropertyName("market_cap_dominance")]
public double MarketCapDominance { get; set; }
[JsonPropertyName("fully_diluted_market_cap")]
public double FullyDilutedMarketCap { get; set; }
[JsonPropertyName("last_updated")]
public DateTime LastUpdated { get; set; }
}
public class CmcResponseData
{
[JsonPropertyName("id")]
public int Id { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("symbol")]
public string Symbol { get; set; }
[JsonPropertyName("slug")]
public string Slug { get; set; }
[JsonProperty("cmc_rank")]
public int Rank { get; set; }
[JsonPropertyName("cmc_rank")]
public int CmcRank { get; set; }
public CurrencyQuotes Quote { get; set; }
}
[JsonPropertyName("num_market_pairs")]
public int NumMarketPairs { get; set; }
public class CurrencyQuotes
{
public Quote Usd { get; set; }
}
[JsonPropertyName("circulating_supply")]
public double? CirculatingSupply { get; set; }
public class Quote
{
public double Price { get; set; }
public double Market_Cap { get; set; }
public string Percent_Change_1h { get; set; }
public string Percent_Change_24h { get; set; }
public string Percent_Change_7d { get; set; }
public double? Volume_24h { get; set; }
[JsonPropertyName("total_supply")]
public double? TotalSupply { get; set; }
[JsonPropertyName("max_supply")]
public double? MaxSupply { get; set; }
[JsonPropertyName("last_updated")]
public DateTime LastUpdated { get; set; }
[JsonPropertyName("date_added")]
public DateTime DateAdded { get; set; }
[JsonPropertyName("tags")]
public List<string> Tags { get; set; }
[JsonPropertyName("quote")]
public Dictionary<string, CmcQuote> Quote { get; set; }
}