Using Python to issue code to buy/sell shares!


I am starting out with trading 212 and would like to control my account via Python. I have found two Python modules on Github to call the Trading212 API. However, they both seem to have problems as they didn’t work for me and I tried to fix errors but without a positive result. I have posted questions on Github for both modules on the errors. However, both modules are poorly documented.

My question is: If you are using Python to call Trading 212’s API, how do you do it?

Best regards,

1 Like

T212 don’t currently offer API support as of yet. I don’t think it’s on the cards to implement any time soon either from what I have read.

Not sure if it’s allowed, but your best bet might just be to hack to together something with Selenium or something similar maybe. (From what I can remember of Python). :slight_smile:

Only CFD account has an API. As far as I know it was only used by ProQuant, but they are closing down in January 2021.

You can with Chrome inspect and see copy the internal API they use.

I’ve used PHP and Guzzle to simplify the curl calls to build myself a screener and keep tabs on what’s being added like we have about 10,000 stocks available but only 2,883 that have been categorised.

I haven’t done trades via it but I’ve been very tempted to build a robo trader or at least to help finding daily over sold on decent stocks and ask to start a position.


It would be amazing if we could actually have some kind of API now that proquant is shutting down it’s operations.

Python will be a great tool to build some interesting strategies


got a github? i’m interested on how you read the data

Also another idea, what if we could fetch live quotes from Trading 212?

Or even historical close prices?

I know that we could use other libraries/packages, but they are limited or are paid.

We could do portfolio management, with Drawdowns, Standard Deviation, other risk measures, several ways of measuring the returns, comparing historical performances with several instruments, even with other instruments not present on T212 (using together with other libraries/packages).

Doing research for future investment and other data analysis.

Apologies for the hijack, I have no idea about api’s but could these (if they become available) be used to program hot keys and preset order types like interactive brokers can do? Ie, a hot key that auto calculates position size from current price and stop loss formula?

API is just basically a request for information and to send information to the broker. An example could be a algo to trade for you or a way to check your balance through the API. You could make a piece of software that uses a hotkey to display your balance.

1 Like