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.

Requirements

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

Installation

pip install trading212

Import

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

Usage

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

trading.close_position(stock)

Getting a result of a position

trading.result(stock)

Getting another information of a position

trading.position_info(css_class)

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.

Classes

Project details


Download files

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

Source Distribution

Trading212-0.1.6.tar.gz (6.7 kB view details)

Uploaded Source

File details

Details for the file Trading212-0.1.6.tar.gz.

File metadata

  • Download URL: Trading212-0.1.6.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for Trading212-0.1.6.tar.gz
Algorithm Hash digest
SHA256 e32bd597a71636c5e93100bc76f8467574acc0b66557374b4029a2628ef7bde6
MD5 a50beb4c979c6d4abe14c41da7401943
BLAKE2b-256 3508caf934c718bff7972b22fef95faaaf785b98370c6ba7682d40e3ff727b47

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page