Package: trading212-connector
Trading 212 API ( Beta )This is a python wrapper for the trading 212 beta API.https://t212public-api-docs.redoc.ly/DISCLAIMERThe 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.Installation$ pip install trading212-connectorCreating a clientYou 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")APIMetadataget_exchanges()get_instruments()Piesget_pies()get_pie(id)idint, id of piecreate_pie(dividend_cash_action, end_date, goal, icon, instrument_shares, name)dividend_cash_actionstring, Enum: "REINVEST" "TO_ACCOUNT_CASH"end_datestring,  isoformatgoalinticonstring, 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_sharesdict, {ticker_name: float, quantity}namestring,  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")update_pie(id, dividend_cash_action, end_date, goal, icon, instrument_shares, name)idint, id of piedividend_cash_actionstring, Enum: "REINVEST" "TO_ACCOUNT_CASH"end_datestring,  isoformatgoalinticonstring, 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_sharesdict, {ticker_name: float, quantity}namestring,  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")delete_pie(id)idint, id of pieOrdersget_orders()get_order(id)idint, id of orderdelete_order(id)idint, id of orderplace_limit_order(limit_price, quantity, ticker, time_validity)limit_pricefloatquantityfloattickerstringtimeValiditystring,  Enum: "DAY" "GTC">>> client.place_limit_order(122.31, .5, 'AAPL_US_EQ', 'GTC')place_market_order(quantity, ticker)quantityfloattickerstring>>> client.place_market_order(.5, 'AAPL')place_stop_order(stop_price, quantity, ticker, time_validity)stop_pricefloatquantityfloattickerstringtimeValiditystring,  Enum: "DAY" "GTC">>> client.place_stop_order(122.31, .5, 'AAPL_US_EQ', 'GTC')place_stop_limit_order(limit_price, stop_price, quantity, ticker, time_validity)limit_pricefloatstop_pricefloatquantityfloattickerstringtimeValiditystring,  Enum: "DAY" "GTC">>> client.place_stop_order(122.31, 122.31, .5, 'AAPL_US_EQ', 'GTC')Accountget_account_cash()get_account()Positionsget_positions()get_position(id)idint, id of positionHistorical itemsget_order_history(cursor, ticker, limit)cursorint  Pagination cursortickerstringlimitint  Default: 20>>> client.get_order_history(1, 'AAPL_EQ_US', 25)get_dividends(cursor, ticker, limit)cursorint  Pagination cursortickerstringlimitint  Default: 20>>> client.get_dividends(1, 'AAPL_EQ_US', 25)get_exports()get_transactions(cursor, limit)cursorint  Pagination cursorlimitint  Default: 20>>> client.get_transactions(1, 25)get_export(data_included, time_from, time_to)data_includeddict, {"includeDividends": True, "includeInterest": True, "includeOrders": True, "includeTransactions": True}time_fromstring, isoformattime_tostring, isoformat