Git Product home page Git Product logo

trading212api-1's Introduction

Trading212 API

Right now the API is not always working properly. I don't have enough time to fix it, But everyone is more than welcome to contribute and I'll check all of the PRs.

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 to 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

trading212api-1's People

Contributors

bentimor avatar pauliusu avatar peterferguson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.