The CryptoWeather API allows for access to all of the cryptocurrency data and market forecast services provided. There are two primary categories of routes, public
and private
, where public
routes are accessible to the general public and do not require API authentication, and private
routes, which require API authentication. ## General Overview 1. All API methods adhere to RESTful best practices as closely as possible. As such, all API calls will be made via the standard HTTP protocol using the GET/POST/PUT/DELETE request types. 2. Every request returns the status as a JSON response with the following: - success, true if it was successful - code, the http status code (also in the response header) - 200 if response is successful - 400 if bad request - 401 if authorization JWT is wrong or limit exceeded - 404 wrong route - 500 for any internal errors - status, the status of the request, default success - errors, an array of any relevant error details 3. For any requests that are not successful an error message is specified and returned as an array for the errors key in the JSON response. 4. All authentication uses JSON Web Tokens (JWT), which is set as the Authorization entry in the header, see the following for more details. - http://jwt.io - https://scotch.io/tutorials/the-anatomy-of-a-json-web-token ## Code Example The following is a code example in Python, which demonstrates using the Python Requests library for both the public
and private
API routes. import requests HOST = \"https://api.cryptoweather.ai/v1\" # Your API key (JWT) API_KEY = \"<YOUR API KEY>\" # Example public request, no API key required. requests.get(\"{}/public/symbols\".format(HOST)).json() # Get the current btc price using the public route requests.get(\"{}/public/price-current/{}\".format(HOST, \"btc\")).json() # Example private request, API key required. Get the btc hourly forecasts headers = {\"Authorization\": \"Bearer {}\".format(API_KEY)} requests.get(\"{}/private/forecast/{}/{}\".format(HOST, \"btc\", \"1h\"), headers=headers).json()
This C# SDK is automatically generated by the Swagger Codegen project:
- API version:
- SDK version: 1.0.0
- Build package: io.swagger.codegen.languages.CSharpClientCodegen
- .NET 4.0 or later
- Windows Phone 7.1 (Mango)
- RestSharp - 105.1.0 or later
- Json.NET - 7.0.0 or later
- JsonSubTypes - 1.2.0 or later
The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:
Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742
Run the following command to generate the DLL
- [Mac/Linux]
/bin/sh build.sh
- [Windows]
build.bat
Then include the DLL (under the bin
folder) in the C# project, and use the namespaces:
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
A .nuspec
is included with the project. You can follow the Nuget quickstart to create and publish packages.
This .nuspec
uses placeholders from the .csproj
, so build the .csproj
directly:
nuget pack -Build -OutputDirectory out IO.Swagger.csproj
Then, publish to a local feed or other host and consume the new package via Nuget as usual.
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class Example
{
public void main()
{
// Configure OAuth2 access token for authorization: oauth2
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PrivateApi();
var symbol = btc; // string | The cryptocurrency symbol.
var interval = 1h; // string | The forecast interval, 1h or 1d.
var period = 7d; // string | The period for computing the accuracy, such as the past 7 days.
var cookie = csrf=b1820141-1bad-4a9c-93c0-52022817ce89; // string | e.g. csrf=b1820141-1bad-4a9c-93c0-52022817ce89 (optional)
var xCsrf = b1820141-1bad-4a9c-93c0-52022817ce89; // string | e.g. b1820141-1bad-4a9c-93c0-52022817ce89 (optional)
try
{
// Accuracy
PrivateAccuracyResponse result = apiInstance.V1PrivateAccuracySymbolIntervalPeriodGet(symbol, interval, period, cookie, xCsrf);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling PrivateApi.V1PrivateAccuracySymbolIntervalPeriodGet: " + e.Message );
}
}
}
}
All URIs are relative to https://api.cryptoweather.ai
Class | Method | HTTP request | Description |
---|---|---|---|
PrivateApi | V1PrivateAccuracySymbolIntervalPeriodGet | GET /v1/private/accuracy/{symbol}/{interval}/{period} | Accuracy |
PrivateApi | V1PrivateForecastAccuracySymbolIntervalPeriodGet | GET /v1/private/forecast-accuracy/{symbol}/{interval}/{period} | Forecast Accuracy |
PrivateApi | V1PrivateForecastSymbolIntervalGet | GET /v1/private/forecast/{symbol}/{interval} | Forecast |
PrivateApi | V1PrivateForecastTimeSymbolIntervalPeriodGet | GET /v1/private/forecast-time/{symbol}/{interval}/{period} | Forecast Time |
PrivateApi | V1PrivateTrendSymbolGet | GET /v1/private/trend/{symbol} | Trend |
PrivateApi | V1PrivateTrendTabularGet | GET /v1/private/trend-tabular | Trend Tabular |
PublicApi | V1PublicPriceChangeSymbolGet | GET /v1/public/price-change/{symbol} | Price Change |
PublicApi | V1PublicPriceCurrentSymbolGet | GET /v1/public/price-current/{symbol} | Price Current |
PublicApi | V1PublicPriceHistorySymbolPeriodIntervalGet | GET /v1/public/price-history/{symbol}/{period}/{interval} | Price History |
PublicApi | V1PublicSummaryGet | GET /v1/public/summary | Summary |
PublicApi | V1PublicSymbolsGet | GET /v1/public/symbols | Symbols |
PublicApi | V1PublicTrendSymbolGet | GET /v1/public/trend/{symbol} | Trend |
- Model.AccuracyRoute
- Model.DefaultResponse
- Model.ForecastAccuracyRoute
- Model.ForecastRoute
- Model.ForecastTimeRoute
- Model.PriceChangeRoute
- Model.PriceCurrentRoute
- Model.PriceHistoryRoute
- Model.PrivateAccuracyResponse
- Model.PrivateAccuracyResponseData
- Model.PrivateForecastAccuracyResponse
- Model.PrivateForecastAccuracyResponseData
- Model.PrivateForecastResponse
- Model.PrivateForecastResponseData
- Model.PrivateForecastResponseDataForecast
- Model.PrivateForecastTimeResponse
- Model.PrivateForecastTimeResponseData
- Model.PrivateTrendTabularResponse
- Model.PrivateTrendTabularResponseData
- Model.PrivateTrendTabularResponseDataTrendTabular
- Model.PublicPriceChangeResponse
- Model.PublicPriceChangeResponseData
- Model.PublicPriceChangeResponseDataPriceChange
- Model.PublicPriceCurrentResponse
- Model.PublicPriceCurrentResponseData
- Model.PublicPriceCurrentResponseDataCurrent
- Model.PublicPriceHistoryResponse
- Model.PublicPriceHistoryResponseData
- Model.PublicPriceHistoryResponseDataHistory
- Model.PublicPriceHistoryResponseDataPriceHistory
- Model.PublicSummaryResponse
- Model.PublicSummaryResponseColor
- Model.PublicSummaryResponseData
- Model.PublicSymbolsResponse
- Model.PublicSymbolsResponseData
- Model.PublicSymbolsResponseDataSymbols
- Model.PublicTrendResponse
- Model.PublicTrendResponseData
- Model.PublicTrendResponseDataTrend
- Model.SummaryRoute
- Model.SymbolsRoute
- Model.TrendRoute
- Model.TrendTabluarRoute
- Type: OAuth
- Flow: accessCode
- Authorization URL:
- Scopes: N/A