Add files via upload

This commit is contained in:
Kalakoi
2017-12-21 12:24:22 -05:00
committed by GitHub
parent 4f91cb4aca
commit dba381442f
3 changed files with 129 additions and 0 deletions

59
src/CoinMarketCap.cs Normal file
View File

@@ -0,0 +1,59 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Kalakoi.Crypto.CoinMarketCap
{
/// <summary>
/// Provides access to the CoinMarketCap service.
/// </summary>
public static class CoinMarketCap
{
/// <summary>
/// Gets global data about all curencies and assets.
/// </summary>
/// <param name="Currency">Fiat currency to convert to.</param>
/// <returns>Object containing global data.</returns>
public static async Task<GlobalData> GetGlobalData(Currencies Currency = Currencies.USD) =>
await GlobalData.GetDataAsync(Currency).ConfigureAwait(false);
/// <summary>
/// Gets all available tickers with accompanying data.
/// </summary>
/// <param name="Currency">Fiat currency to convert to.</param>
/// <returns>List of all tickers with data.</returns>
public static async Task<List<Ticker>> GetAllTickersAsync(Currencies Currency = Currencies.USD) =>
await Ticker.GetTickersAsync(Currency, 0, 0).ConfigureAwait(false);
/// <summary>
/// Gets a selection of tickers with accompanying data.
/// </summary>
/// <param name="Currency">Fiat currency to convert to.</param>
/// <param name="Start">Rank to start from.</param>
/// <param name="Limit">Number of tickers to return.</param>
/// <returns>List of tickers with data.</returns>
public static async Task<List<Ticker>> GetTickersAsync(Currencies Currency = Currencies.USD, int Start = 0, int Limit = 100) =>
await Ticker.GetTickersAsync(Currency, Start, Limit).ConfigureAwait(false);
/// <summary>
/// Gets specific ticker with accompanying data.
/// </summary>
/// <param name="ID">ID of ticker to pull.</param>
/// <param name="Currency">Fiat currency to convert to.</param>
/// <returns>Ticker data.</returns>
public static async Task<Ticker> GetTickerAsync(string ID, Currencies Currency = Currencies.USD) =>
await Ticker.GetTickerAsync(ID, Currency).ConfigureAwait(false);
/// <summary>
/// Gets currency ID from ticker symbol.
/// </summary>
/// <param name="Symbol">Ticker symbol.</param>
/// <returns>Currency ID.</returns>
public static async Task<string> GetIDFromSymbol(string Symbol)
{
foreach (Ticker t in await GetAllTickersAsync().ConfigureAwait(false))
if (t.Symbol == Symbol)
return t.ID;
return string.Empty;
}
}
}

View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A41A69B4-4CAA-4E26-B8AD-B153BA1F7487}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Kalakoi.Crypto.CoinMarketCap</RootNamespace>
<AssemblyName>Kalakoi.Crypto.CoinMarketCap</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.1-beta1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CoinMarketCap.cs" />
<Compile Include="CoinMarketCap\Currencies.cs" />
<Compile Include="CoinMarketCap\GlobalData.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="REST\RestServices.cs" />
<Compile Include="CoinMarketCap\Ticker.cs" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

4
src/packages.config Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="11.0.1-beta1" targetFramework="net47" />
</packages>