This is a python wrapper for the trading 212 beta API. https://t212public-api-docs.redoc.ly/
The api is a straight mapping to the trading 212 endpoints.
- No liability is assumed by me for you using this library.
- Any trading activity you undertake using this library is solely your own responsibility.
- No liability will be assumed if you lose your KEY.
$ pip install trading212-connector
You will need to create a API key from your trading 212 account. Follow trading212's instructions around usage and safeguarding this KEY.
>>> from trading212 import Client
>>> client = Client("YOUR_API_KEY")
id
int, id of pie
dividend_cash_action
string, Enum: "REINVEST" "TO_ACCOUNT_CASH"
end_date
string, isoformat
goal
int
icon
string, Enum: "Home" "PiggyBank" "Iceberg" "Airplane" "RV" "Unicorn" "Whale" "Convertable" "Family" "Coins" "Education" "BillsAndCoins" "Bills" "Water" "Wind" "Car" "Briefcase" "Medical" "Landscape" "Child" "Vault" "Travel" "Cabin" "Apartments" "Burger" "Bus" "Energy" "Factory" "Global" "Leaf" "Materials" "Pill" "Ring" "Shipping" "Storefront" "Tech" "Umbrella"
instrument_shares
dict, {ticker_name: float, quantity}
name
string, name for pie
>>> client.create_pie("REINVEST", "2019-08-24T14:15:22Z", 0, "Home", {"AAPL_US_EQ": 0.5, "MSFT_US_EQ": 0.5}, "my pie")
id
int, id of pie
dividend_cash_action
string, Enum: "REINVEST" "TO_ACCOUNT_CASH"
end_date
string, isoformat
goal
int
icon
string, Enum: "Home" "PiggyBank" "Iceberg" "Airplane" "RV" "Unicorn" "Whale" "Convertable" "Family" "Coins" "Education" "BillsAndCoins" "Bills" "Water" "Wind" "Car" "Briefcase" "Medical" "Landscape" "Child" "Vault" "Travel" "Cabin" "Apartments" "Burger" "Bus" "Energy" "Factory" "Global" "Leaf" "Materials" "Pill" "Ring" "Shipping" "Storefront" "Tech" "Umbrella"
instrument_shares
dict, {ticker_name: float, quantity}
name
string, name for pie
>>> client.update_pie(1701, "REINVEST", "2019-08-24T14:15:22Z", 0, "Home", {"AAPL_US_EQ": 0.5, "MSFT_US_EQ": 0.5}, "my pie")
id
int, id of pie
id
int, id of order
id
int, id of order
limit_price
float
quantity
float
ticker
string
timeValidity
string, Enum: "DAY" "GTC"
>>> client.place_limit_order(122.31, .5, 'AAPL_US_EQ', 'GTC')
quantity
float
ticker
string
>>> client.place_market_order(.5, 'AAPL')
stop_price
float
quantity
float
ticker
string
timeValidity
string, Enum: "DAY" "GTC"
>>> client.place_stop_order(122.31, .5, 'AAPL_US_EQ', 'GTC')
limit_price
float
stop_price
float
quantity
float
ticker
string
timeValidity
string, Enum: "DAY" "GTC"
>>> client.place_stop_order(122.31, 122.31, .5, 'AAPL_US_EQ', 'GTC')
id
int, id of position
cursor
int Pagination cursor
ticker
string
limit
int Default: 20
>>> client.get_order_history(1, 'AAPL_EQ_US', 25)
cursor
int Pagination cursor
ticker
string
limit
int Default: 20
>>> client.get_dividends(1, 'AAPL_EQ_US', 25)
cursor
int Pagination cursor
limit
int Default: 20
>>> client.get_transactions(1, 25)
data_included
dict, {"includeDividends": True, "includeInterest": True, "includeOrders": True, "includeTransactions": True}
time_from
string, isoformat
time_to
string, isoformat