Generating a CSV of complete trading history. (ISA)


I am trying to incorporate my trading212 portfolio into a wider system and would like to have access to my trading history such that I can keep a record of the market price, prices that I paid, the exchange rate at the time that I made the purchase. The exchange rate being my main stumbling block.

I have written a basic script to read through my contract note emails (I only have the last month or so of these, If I had them all, this wouldn’t be a problem) and the Monthly Statement. The Monthly Statement has the Price and Market Price, but these are mostly in USD instead of GBP. Applying an exchange rate at this point would be inaccurate regardless. What I need really is a deposit/investment total in GBP for each instrument.

I have seen others post things like this link but the data there is just what is shown on the Monthly Statement. I am wondering if there is something like that but for purchase history or anything that would help at all?

I could potentially build a webscraper to pull out the history for each investment, but I would like to avoid this if possible.

Sorry if this is a bit waffly, It’s super late over here right now.

I should say, I’ve seen someone post on here a chrome extention that generates a csv of your holdings, but it cannot handle pie’s or and big enough order history.

ok, this looks promising ->

1 Like

Scrape it. Look at the network calls through your browser when logged in. Look at the ‘orders?’ API call and date parameters… throw them at your browser and pull out the json … works well enough for me…

1 Like

perfection :partying_face:

oh nice, you got it to work?

Im not sure, trying to figure out if i can get a sessionID using requests? There is always selenium of course, I’m just trying to not use that so I learn something new.
I did think I had just blocked my IP or something, but i think my internet is just being tempermental.

EDIT: my internet is not being tempermental

Here’s a bit of code I used before, you might be able to re-jig it somehow.

def get_session_id():

    session = requests.Session()
    url = 'your-website'

    r = session.get(url)
    session_id = r.cookies.get_dict()
    session_id = session_id.get('ASP.NET_SessionId_eReg') # might be different for T212

    return session,session_id

I think the trouble is you need to be logged in.

I am trying to post to
or “

But something is stopping me. I think there is a value that is generated when the page loads that is required in the login post. But I am not sure yet how to get it.

It’s why I force an Internet Explorer object…that loads the sessionId… then make the API call through the same browser with the same sessionId… primitive, messy, not clever but works!


much better than “brilliant, amazing, art of engineering, but doesn’t work” :grin:


as long as its all on one line i’m happy.

1 Like

Wonder if you can load that csv in

do you know how the csv needs to be formatted (column names)?

They’ve done it! Currently, you can export from iOS and Android