Grumson.Utilities.Taapi 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package Grumson.Utilities.Taapi --version 1.0.3                
NuGet\Install-Package Grumson.Utilities.Taapi -Version 1.0.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Grumson.Utilities.Taapi" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Grumson.Utilities.Taapi --version 1.0.3                
#r "nuget: Grumson.Utilities.Taapi, 1.0.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Grumson.Utilities.Taapi as a Cake Addin
#addin nuget:?package=Grumson.Utilities.Taapi&version=1.0.3

// Install Grumson.Utilities.Taapi as a Cake Tool
#tool nuget:?package=Grumson.Utilities.Taapi&version=1.0.3                

The TaapiLibrary is a C# library designed for personal use.

It currently supports only the exchanges listed in the TaapiExchange.cs file and the indicators listed in the TaapiIndicatorType.cs file. These files define the available exchanges and indicators that can be used with the library. If you want to use a different exchange or indicator, you would need to modify the library accordingly.

TaapiLibrary Documentation

The TaapiLibrary is a C# library that provides a client for interacting with the Taapi API. It allows you to retrieve indicator values and perform bulk indicator requests.

TaapiClient Class

The TaapiClient class is the main class in the TaapiLibrary. It provides methods for interacting with the Taapi API.

Constructors

TaapiClient(int retryAfterSeconds = 60)
  • Initializes a new instance of the TaapiClient class with optional parameters for the base URL and retry delay.
  • Parameters:
    • baseUrl (optional): The base URL for the Taapi API. Default value is "https://api.taapi.io".
    • retryAfterSeconds (optional): The number of seconds to wait before retrying a request if the rate limit is exceeded. Default value is 60 seconds.

Public

Public Methods

Task<TaapiIndicatorValuesResponse> GetIndicatorAsync(string apiKey, string symbol, TaapiExchange exchange, TaapiCandlesInterval candlesInterval, TaapiIndicatorPropertiesRequest directParametersRequest)
  • Retrieves indicator values for a specific symbol.
  • Parameters:
    • apiKey: The API key for accessing the Taapi API.
    • symbol: The symbol for which to retrieve indicator values.
    • exchange: The exchange on which the symbol is traded.
    • candlesInterval: The interval of the candles for the indicator calculation.
    • directParametersRequest: The request object containing the indicator properties.
  • Returns:
    • A Task that represents the asynchronous operation. The task result contains the indicator values as a TaapiIndicatorValuesResponse object.
Task<List<TaapiBulkResponse>> PostBulkIndicatorsAsync(TaapiBulkRequest requests)
  • Performs bulk indicator requests.
  • Parameters:
    • requests: The bulk request object containing multiple indicator requests.
  • Returns:
    • A Task that represents the asynchronous operation. The task result contains a list of TaapiBulkResponse objects, each representing the result of an individual indicator request.

Exception Handling

The TaapiClient class throws various exceptions to handle different error scenarios. These exceptions include:

  • ArgumentException: Thrown when invalid arguments are passed to the methods.
  • UnauthorizedAccessException: Thrown when the API key is invalid or unauthorized.
  • RateLimitExceededException: Thrown when the rate limit is exceeded.
  • HttpRequestException: Thrown when an HTTP request error occurs.
  • JsonException: Thrown when a JSON serialization or deserialization error occurs.
  • InvalidOperationException: Thrown when an invalid operation error occurs.
  • TaskCanceledException: Thrown when a task is canceled.
  • UriFormatException: Thrown when a URI format error occurs.
  • Exception: Thrown for any other unexpected error.

Example Usage

Here is an example of how to use the TaapiClient class to retrieve indicator values in console application: Make sure to replace "YOUR_API_KEY" with your actual Taapi API key.

using TaapiLibrary;
using TaapiLibrary.Contracts.Requests;
using TaapiLibrary.Enums;


string _secret = "YOUR_API_KEY";

// Create a new Taapi Client
TaapiClient taapiClient = new TaapiClient();

// Get the indicator by calling the GetIndicatorAsync method
 var dataBnb = await taapiClient.GetIndicatorAsync(_secret, "BNB/USDT", TaapiExchange.Binance, TaapiCandlesInterval.OneMinute, 
                                                    new TaapiIndicatorPropertiesRequest(TaapiIndicatorType.SuperTrend, TaapiChart.Candles, period: 10, multiplier: 1));


 // Set Taapi bulk request

#region BNB/USDT
// Create a 3 new Taapi indicator requests
TaapiIndicatorPropertiesRequest indicatorRequest_BNB_1 = new TaapiIndicatorPropertiesRequest(
    TaapiIndicatorType.SuperTrend, 
    TaapiChart.Candles,
    id: "BNB_superTrend_1",
    period: 10, 
    multiplier: 1
    );
TaapiIndicatorPropertiesRequest indicatorRequest_BNB_2 = new TaapiIndicatorPropertiesRequest(
    TaapiIndicatorType.SuperTrend,
    TaapiChart.Candles,
    id: "BNB_superTrend_2",
    period: 11,
    multiplier: 2
    );
TaapiIndicatorPropertiesRequest indicatorRequest_BNB_3 = new TaapiIndicatorPropertiesRequest(
    TaapiIndicatorType.SuperTrend,
    TaapiChart.Candles,
    id: "BNB_superTrend_3",
    period: 12,
    multiplier: 3
    );

List<TaapiIndicatorPropertiesRequest> indicators_BNB = new List<TaapiIndicatorPropertiesRequest> {
    indicatorRequest_BNB_1,
    indicatorRequest_BNB_2,
    indicatorRequest_BNB_3
};

#endregion

#region SOL/USDT

// Create a 3 new Taapi indicator requests
TaapiIndicatorPropertiesRequest indicatorRequest_SOL_1 = new TaapiIndicatorPropertiesRequest(
    TaapiIndicatorType.SuperTrend,
    TaapiChart.Candles,
    id: "SOL_superTrend_1",
    period: 10,
    multiplier: 1
    );
TaapiIndicatorPropertiesRequest indicatorRequest_SOL_2 = new TaapiIndicatorPropertiesRequest(
    TaapiIndicatorType.SuperTrend,
    TaapiChart.Candles,
    id: "SOL_superTrend_2",
    period: 11,
    multiplier: 2
    );
TaapiIndicatorPropertiesRequest indicatorRequest_SOL_3 = new TaapiIndicatorPropertiesRequest(
    TaapiIndicatorType.SuperTrend,
    TaapiChart.Candles,
    id: "SOL_superTrend_3",
    period: 12,
    multiplier: 3
    );

List<TaapiIndicatorPropertiesRequest> indicators_SOL = new List<TaapiIndicatorPropertiesRequest> {  
    indicatorRequest_SOL_1,
    indicatorRequest_SOL_2,
    indicatorRequest_SOL_3
};

#endregion

#region BTC/USDT

// Create a 3 new Taapi indicator requests
TaapiIndicatorPropertiesRequest indicatorRequest_BTC_1 = new TaapiIndicatorPropertiesRequest(
    TaapiIndicatorType.SuperTrend,
    TaapiChart.Candles,
    id: "BTC_superTrend_1",
    period: 10,
    multiplier: 1
    );
TaapiIndicatorPropertiesRequest indicatorRequest_BTC_2 = new TaapiIndicatorPropertiesRequest(
    TaapiIndicatorType.SuperTrend,
    TaapiChart.Candles,
    id: "BTC_superTrend_2",
    period: 11,
    multiplier: 2
    );
TaapiIndicatorPropertiesRequest indicatorRequest_BTC_3 = new TaapiIndicatorPropertiesRequest(
    TaapiIndicatorType.SuperTrend,
    TaapiChart.Candles,
    id: "BTC_superTrend_3",
    period: 12,
    multiplier: 3
    );

List<TaapiIndicatorPropertiesRequest> indicators_BTC = new List<TaapiIndicatorPropertiesRequest> {
    indicatorRequest_BTC_1,
    indicatorRequest_BTC_2,
    indicatorRequest_BTC_3
};

#endregion

#region ETH/USDT

// Create a 3 new Taapi indicator requests
TaapiIndicatorPropertiesRequest indicatorRequest_ETH_1 = new TaapiIndicatorPropertiesRequest(
    TaapiIndicatorType.SuperTrend,
    TaapiChart.Candles,
    id: "ETH_superTrend_1",
    period: 10,
    multiplier: 1
    );
TaapiIndicatorPropertiesRequest indicatorRequest_ETH_2 = new TaapiIndicatorPropertiesRequest(
    TaapiIndicatorType.SuperTrend,
    TaapiChart.Candles,
    id: "ETH_superTrend_2",
    period: 11,
    multiplier: 2
    );
TaapiIndicatorPropertiesRequest indicatorRequest_ETH_3 = new TaapiIndicatorPropertiesRequest(
    TaapiIndicatorType.SuperTrend,
    TaapiChart.Candles,
    id: "ETH_superTrend_3",
    period: 12,
    multiplier: 3
    );

List<TaapiIndicatorPropertiesRequest> indicators_ETH = new List<TaapiIndicatorPropertiesRequest> {
    indicatorRequest_ETH_1,
    indicatorRequest_ETH_2,
    indicatorRequest_ETH_3
};

#endregion


// Create a max 3 new Taapi bulk construct
TaapiBulkConstruct bulkConstruct_1 = new TaapiBulkConstruct(TaapiExchange.Binance, "BNB/USDT", TaapiCandlesInterval.OneMinute, indicators_BNB);
TaapiBulkConstruct bulkConstruct_2 = new TaapiBulkConstruct(TaapiExchange.Binance, "SOL/USDT", TaapiCandlesInterval.OneMinute, indicators_SOL);
TaapiBulkConstruct bulkConstruct_3 = new TaapiBulkConstruct(TaapiExchange.Binance, "BTC/USDT", TaapiCandlesInterval.OneMinute, indicators_BTC);

List<TaapiBulkConstruct> bulkConstructs = new List<TaapiBulkConstruct> {
    bulkConstruct_1,
    bulkConstruct_2,
    bulkConstruct_3
};


// Create a new Taapi bulk request
TaapiBulkRequest bulkRequest = new TaapiBulkRequest( _secret, bulkConstructs);



// Get the bulk indicators by calling the PostBulkIndicatorsAsync method
var bulkIndicators = taapiClient.PostBulkIndicatorsAsync(bulkRequest).Result;

Changelog

This section outlines the changes and improvements made in each version of the TaapiLibrary.

Version 1.0.3-alpha - 2023-07-18

Added

  • Posibility to set the TaapiClient base URL in the constructor.
  • Support for additional exchanges in TaapiExchange.cs.

Improved

  • Performance optimizations in the TaapiClient class for faster API responses.

Fixed

  • Fixed an issue where RateLimitExceededException was not correctly handled in some scenarios.

Version 1.0.2 - 2023-07-16

Added

Improved

  • Some minor improvements.

Fixed

  • Some minor bug fixes and improvements.

Version 1.0.1 - 2023-07-15

Added

Improved

  • Some minor improvements.

Fixed

  • Some minor bug fixes and improvements.

Version 1.0.0 - 2023-07-15

  • Initial release of the TaapiLibrary.
  • Support for basic indicator retrieval and bulk indicator requests.

This is just a basic example. You can customize the symbol, exchange, candles interval, and indicator properties according to your needs.

That's it! You now have an overview of the TaapiLibrary and how to use the TaapiClient class to interact with the Taapi API.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Grumson.Utilities.Taapi:

Package Downloads
Grumson.Utilities.Taapi.Signals

Powerful and easy-to-use library designed for building and managing trading signals using Finite State Machines (FSM). This library integrates seamlessly with the Taapi.io API, allowing users to leverage a wide range of trading indicators for creating custom trading strategies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.3 111 1/20/2025
2.0.2 64 1/19/2025
2.0.1 75 1/11/2025
2.0.0 59 1/9/2025
1.1.1 92 1/5/2025
1.1.0 113 1/3/2025
1.0.9 92 1/2/2025
1.0.8 83 12/31/2024
1.0.7 120 10/10/2024
1.0.6 102 10/10/2024
1.0.5 109 9/26/2024
1.0.4 99 9/24/2024
1.0.3 108 7/18/2024
1.0.2 101 7/16/2024
1.0.1 94 7/15/2024
1.0.0 92 7/15/2024