Skip to content

akaAntox/Trading212.API

Repository files navigation

Trading212 Public API (v0) Wrapper for .NET

This project is a .NET wrapper for the Trading212 Public API (v0), designed to simplify integration and interaction with Trading212's endpoints. It provides a clean, organized structure to manage live and demo environments, as well as facilitate API calls in a straightforward manner.


Features

  • Seamless integration with Trading212 Public API (v0).
  • Switch easily between demo and live environments.
  • Simplified access to API endpoints.

Getting Started

Prerequisites

  • .NET 6.0 or later
  • Access to Trading212 API (via API key)

Installation

To use this wrapper in your .NET project, add it as a dependency using your preferred method:

Manual Reference:

  1. Clone or download this repository.
  2. Add the project to your solution and reference it in your application.

Setup secrets:

  • Add your "ApiKey" secret

Usage

Initialization

  1. Create the API Client: Use the ApiClientFactory to initialize the client.

    var apiClient = ApiClientFactory.Create(isDemo: true);
  2. Call API Methods: Interact with the API using the methods provided by TradingApiClient.

    var exchanges = await apiClient.GetExchangesAsync();
    foreach (var exchange in exchanges)
    {
        Console.WriteLine(exchange);
    }

Examples

Fetching Exchanges

var apiClient = ApiClientFactory.Create(isDemo: true);
var exchanges = await apiClient.GetExchangesAsync();

foreach (var exchange in exchanges)
{
    Console.WriteLine(exchange);
}

Fetching Instruments

var instruments = await apiClient.GetInstrumentsAsync();

foreach (var instrument in instruments)
{
    Console.WriteLine(instrument);
}

References


Contact

For questions or feedback, feel free to contact me:

About

A .NET wrapper for the Trading212 Public API (v0), designed for seamless integration and simplified interaction with Trading212's endpoints.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages