diff --git a/src/CoinMarketCap.cs b/src/CoinMarketCap.cs new file mode 100644 index 0000000..b1e977d --- /dev/null +++ b/src/CoinMarketCap.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Kalakoi.Crypto.CoinMarketCap +{ + /// + /// Provides access to the CoinMarketCap service. + /// + public static class CoinMarketCap + { + /// + /// Gets global data about all curencies and assets. + /// + /// Fiat currency to convert to. + /// Object containing global data. + public static async Task GetGlobalData(Currencies Currency = Currencies.USD) => + await GlobalData.GetDataAsync(Currency).ConfigureAwait(false); + + /// + /// Gets all available tickers with accompanying data. + /// + /// Fiat currency to convert to. + /// List of all tickers with data. + public static async Task> GetAllTickersAsync(Currencies Currency = Currencies.USD) => + await Ticker.GetTickersAsync(Currency, 0, 0).ConfigureAwait(false); + + /// + /// Gets a selection of tickers with accompanying data. + /// + /// Fiat currency to convert to. + /// Rank to start from. + /// Number of tickers to return. + /// List of tickers with data. + public static async Task> GetTickersAsync(Currencies Currency = Currencies.USD, int Start = 0, int Limit = 100) => + await Ticker.GetTickersAsync(Currency, Start, Limit).ConfigureAwait(false); + + /// + /// Gets specific ticker with accompanying data. + /// + /// ID of ticker to pull. + /// Fiat currency to convert to. + /// Ticker data. + public static async Task GetTickerAsync(string ID, Currencies Currency = Currencies.USD) => + await Ticker.GetTickerAsync(ID, Currency).ConfigureAwait(false); + + /// + /// Gets currency ID from ticker symbol. + /// + /// Ticker symbol. + /// Currency ID. + public static async Task GetIDFromSymbol(string Symbol) + { + foreach (Ticker t in await GetAllTickersAsync().ConfigureAwait(false)) + if (t.Symbol == Symbol) + return t.ID; + return string.Empty; + } + } +} diff --git a/src/Kalakoi.Crypto.CoinMarketCap.csproj b/src/Kalakoi.Crypto.CoinMarketCap.csproj new file mode 100644 index 0000000..a36253d --- /dev/null +++ b/src/Kalakoi.Crypto.CoinMarketCap.csproj @@ -0,0 +1,66 @@ + + + + + Debug + AnyCPU + {A41A69B4-4CAA-4E26-B8AD-B153BA1F7487} + Library + Properties + Kalakoi.Crypto.CoinMarketCap + Kalakoi.Crypto.CoinMarketCap + v4.7 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Newtonsoft.Json.11.0.1-beta1\lib\net45\Newtonsoft.Json.dll + True + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/packages.config b/src/packages.config new file mode 100644 index 0000000..beaeddf --- /dev/null +++ b/src/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file