Skip to content

An unofficial C# library that allows you to interact with the Trading212 API

License

Notifications You must be signed in to change notification settings

19bibo85/Trading212.API

Repository files navigation

Trading212.API

An unofficial C# library that allows you to interact with the Trading212 API.

How to send a request to an endpoint?

You can make a request to any of the Trading212 endpoints by creating an instance of the Trading212Config class and injecting it into the service class.

Account service example:

var config = Trading212ConfigBuilder
    .Create("your-API-key")
    .WithEnvironment(Environments.Demo)
    .Build();  	
	
var service = new AccountService(config);

var result = await service.GetCashAsync();

Order service example:

var service = new OrderService(config);

var request = new MarketOrderRequest()
{
    Quantity = 1.0m,
    Ticker = "AAPL_US_EQ"
};

var result = await service.CreateMarketOrderAsync(request);

How do I know if the request succeeded?

Every response includes its http status code and a message.

When a request succeeded the https status code returned is HttpStatusCode.OK and the message is set to OK.

In the event of an error occurring during the request processing, the appropriate HTTP error status code is returned along with an error message.

Notes

For a full reference of the Trading212 Public API endpoints please visit Trading212 Public API documentation

Disclaimer

Nor me or Trading212 are responsible for the use of this API, first make sure that everything works well through the use of a DEMO account, then switch to REAL mode.

In addition, I don't take responsibility for the accuracy of the information reported here and the proper functioning of the API

All trademarks, logos and brand names are the property of their respective owners. All company, product and service names used in this website are for identification purposes only.

About

An unofficial C# library that allows you to interact with the Trading212 API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages