Skip to main content

This package is an unofficial API for Trading212.

Project description

Trading212 API

This is an unofficial selenium based API for 'Trading212' broker. Neither me and neither Trading212 are responsible for the API, You are responsible for your actions and for using the API.

Additionally, Note the Trading212 'Robo Trading' agreement.

The API is still WIP, I don't know if and how it's going to work on your computer. But you're more than welcome ot open and issue and I'll try to help as much as I can.


  • Python 3.x
  • Selenium package
  • GeckoDriver
  • FireFox browser


pip install trading212


CFD mode:

from Trading212 import CFD

trading = CFD(email, password) # For practice
trading = CFD(email, password, panel=Panel.Real) # For real money

Invest mode:

from Trading212 import Invest

trading = Invest(email, password) # For practice
trading = Invest(email, password, panel=Panel.Real) # For real money


First of all, You have to know that the API currently uses the display name of the stocks.

Buying a stock ('Long')

trading.buy_stock(stock, amount)

Selling a stock ('Short')

trading.sell_stock(stock, amount) # Available for CFD only

Closing a position


Getting a result of a position


Getting another information of a position


You can get anything that's written in the bar. I've added a picture with source code so you'll be able to select the class.


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Trading212, version 0.1.6
Filename, size File type Python version Upload date Hashes
Filename, size Trading212-0.1.6.tar.gz (6.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page