New Equity Trading API in Beta - Try it Out in Practice Mode!

You say you have gone through all pages via the cursor. Is the value of ā€˜cursorā€™ different for each page? Or are pages 3, 4, ā€¦ identical to page 2?

I had the same issue, and it seems to be related to the cursor value not functioning properly. To fetch all transactions, simply replace the cursor with the timestamp of the last returned transaction. Iā€™ve started developing a Python library to address this problem (still a work in progress).

ā€œTo fetch all transactions, simply replace the cursor with the timestamp of the last returned transaction.ā€

Sadly itā€™s not quite that simple. The cursor should be the executed timestamp ā€“ but that field is not populated.
My solution is to match up the record in the CSV statement and get the executed datetime from there.
Alternatively, if the record you look at was a purchase, thereā€™s a good likelihood it had a tax charge ā€“ within there is a timestamp that is probably identical to the order executed timestamp.

API reports wrong ticker

The portfolio endpoint (/api/v0/equity/portfolio)
says ā€œBVSā€ when it means ā€˜VTYā€™,
and says ā€œPMOā€ when it means ā€˜HBRā€™.

The mind boggles how that is even possible.

The ā€˜history/ordersā€™ endpoint has the same bug, so it might be across all endpoints.

Has anyone been getting 400 ā€œBad Requestā€ error for Request to delete a pie?
Example url passed is https://demo.trading212.com/api/v0/equity/pies/544186
I use DELETE method.
Based on the doc (https://t212public-api-docs.redoc.ly/#operation/delete), integer type pie id seems be sufficient. Any idea how to resolve it or do you think it is the backend issue?

It did help! Not even sure how you found the solution cause I didnā€™t see it anywhere, but thank you a lot!

Iā€™m having real trouble trying to parse paginated responses in Power BI. either it only processes one page or will do an infinite loop. Has anyone had success implementing the Historical order data API and correctly parsed multiple pages?

Has anyone else had issues with cancel order by id endpoint?
Whenever i try to cancel one, i get error 404, so it cant find the order. However when using the fetch by id endpoint, i get back the order details so it does exist

Hi All!

I am using the APIs and implemented some JS code to read data into a Google Sheets.

Everything seems to work pretty well but the Transaction List (history/transactions) returns me a 400 error reminding me that: ā€œBoth or none of cursorId and time must be providedā€.

As parameters, as in the example in the documentation, I am providing ?limit=20&cursor=1 but does not work. Is it a bug or am I missing something?

Thanks in advance for your reply.

SOLVED!

I was not providing sufficient rights to the key.

@minasm Hi, will there be an option to get the account cash endpoint (/api/v0/equity/account/cash) but with date parameter to get the account information on a given date? That would be very helpful as the monthly statement sent via emails is changing every couple months and is painful to handle. Thanks for response.

Hey, any plans to increase the limits on equity/history/orders? Preferably closer to 100 items per query and 10 queries per minute.

I would very much love to have that myself :wink: But you see, unfortunately I am not part of the Trading212 development team.

Just a side note on the emails, @dyrkon, Iā€™ve implemented a parser for the incoming emails :wink: Iā€™ve tested those emails with 8 different users and worked fine but I opted out not to do it as it is unnecessary cost on the server side for me.

Instead, I get daily data and keep it on the database so that the users can see their changes. Hope this helps.

I found an outdated API client which was missing a lot of recent endpoints so I built on top of that and added all missing Endpoints:

It supports all endpoints as of today and I plan on keeping it updated. I hope itā€™s helpful to some of you.

2 Likes

Is there any updates on having the api for real rather than just hte practice mode?

1 Like

Hello!

I am trying to update my Pie using the API but am getting the following error:{ "code": "Error updating pie with id 2617732. Check the id and rename the pie if you want to apply changes." }

If I simplify my request body I can see the pie is updating, which is good. However, I am not sure why my desired request body isnā€™t working.

I shall put it below. For what itā€™s worth, I first selected all the equities manually in the app and then retrieved the pie via the API to get the stock tickers. I have also verified that the weightings add up to 1 and, from the UI at least, 1 decimal place is accepted.

Here is my desired request body:

{
  "instrumentShares": {
    "PLTR_US_EQ": 0.097,
    "TINV_US_EQ": 0.011,
    "ALCC1_US_EQ": 0.011,
    "ONON_US_EQ": 0.011,
    "SQ_US_EQ": 0.011,
    "TPR_EQ_US": 0.011,
    "U_US_EQ": 0.011,
    "UBNT_US_EQ": 0.011,
    "AGC_US_EQ": 0.011,
    "RBRK_US_EQ": 0.011,
    "DOCU_US_EQ": 0.011,
    "NFLX_US_EQ": 0.011,
    "IPOE_US_EQ": 0.011,
    "SPOT_US_EQ": 0.011,
    "TTD_US_EQ": 0.011,
    "ULTA_US_EQ": 0.011,
    "VSCO_US_EQ": 0.011,
    "AFRM_US_EQ": 0.011,
    "WMT_US_EQ": 0.011,
    "HOOD_US_EQ": 0.291,
    "SMCI_US_EQ": 0.047,
    "SNl_EQ": 0.047,
    "APP_US_EQ": 0.047,
    "DMYI_US_EQ": 0.016,
    "ANF_US_EQ": 0.016,
    "DDOG_US_EQ": 0.016,
    "FOURl_EQ": 0.016,
    "OAC_US_EQ": 0.016,
    "LMND_US_EQ": 0.016,
    "RL_US_EQ": 0.016,
    "AMSC_US_EQ": 0.003,
    "ASML_US_EQ": 0.003,
    "ASPN_US_EQ": 0.003,
    "BABA_US_EQ": 0.003,
    "CROX_US_EQ": 0.003,
    "DECK_US_EQ": 0.003,
    "ENPH_US_EQ": 0.003,
    "NET_US_EQ": 0.003,
    "NU_US_EQ": 0.003,
    "SNOW_US_EQ": 0.003,
    "TEM_US_EQ": 0.003,
    "TMDX_US_EQ": 0.003,
    "CRM_US_EQ": 0.003,
    "NVO_US_EQ": 0.003,
    "QUBT_US_EQ": 0.003,
    "VACQ_US_EQ": 0.002,
    "SOUN_US_EQ": 0.002,
    "HUBS_US_EQ": 0.002,
    "BIRK_US_EQ": 0.022,
    "ATZ_CA_EQ": 0.022,
    "ELF_EQ_US": 0.022,
    "RDDT_US_EQ": 0.022,
    "SHOP_US_EQ": 0.022
  },
  "dividendCashAction": "REINVEST",
  "endDate": "2019-08-24T23:59:59.999+02:00",
  "goal": 0,
  "icon": "Coins",
  "name": "Braden Longs Algo Weights v2"
}

When is this likely to be available for LIVE trading across ISA, Invest and CFD accounts?

1 Like

There arenā€™t any updates at the moment. Iā€™ll update you once thereā€™s any news.

1 Like

Hello,

I am trying to use the API with a python script but am currently struggling.

I want to be able to read the current position of an instrument (e.g TSLA), send stop/limit orders and cancel orders. Also want to know what is currently in my portfolio.

I am struggling even getting the current position, I have managed to extract the ID and ticker, but how do I get the current price?

Same here! Really need access to the API for ISA accounts please