You always comes through with amazing stuff for free, itās seriously mind-blowing! Thank you so much for that.
I was going through the documentation and noticed that we can only place orders using your internal tickers, right? All the examples I saw had something like ātickerā: āAAPL_US_EQā. It would be awesome if we had the option to use something more universal like the ISIN or a more widely recognized identifier.
Fetching the account cash (/api/v0/equity/account/cash
) I can see that the returned total
is not the same as the amount in āAccount Valueā, in the appās header. Is there a delay to the API value (or vice-versa)?
Also, what does ppl
mean? Comparing with the data in the app, I can see itās the current return, but it would be nice to have the definition in the API docs.
Hello @noop ,
Enjoying the API so much
I have a suggestions for starters.
https://t212public-api-docs.redoc.ly/#operation/orders_1 It would be super helpful if we had a way to handle the returned data. Your web uses filters like olderThan
this way we would only be able to request smaller chunks of data.
Also, what is the default ordering for the orders history api? Seems like date desc but would be great to have a bit more visibility.
Edit: It would be super useful to have an action field just like the CSV download. Any you might consider making this a filter as well. This way, a user can achieve what they wanted with less requests
Few notes here;
filledQuantity
seem to be NULL and when mapped with UI I can see the data for this field. Yes, the docs mention āApplicable to quantity ordersā but then there is no way to understand how much I purchased.
Quick example to illustrate;
I purchased Apple, paid Ā£3 and 0.0218819 is my Filled Qty.
The order filled for $171.15. If I knew the exchange rate at the time, I could find my filled quantity. But the api is missing exchange rate so I cannot get filled quantity.
I mean if there is away to calculate this, maybe Im missing it
Not sure dateExecuted
is intentionally null
dateModified
and dateCreated
not users local time The web UI return 18 May 2023, 15:01
and API return 2023-05-18T14:01:37.000Z
Thanks!
@danguilherme basically ppl
is the return value you see on your portfolio;
See screenshots and the data from the API;
{
"free": 49433.65,
"total": 50184.50,
"ppl": 184.78,
"result": 0.00,
"invested": 566.07,
"blocked": null
}
Hope this helps
With the release of the new API, I am assuming there will be functionality to programmatically send orders.
I think a good idea would be to implement a way to create sub accounts to separate funds/ trades.
This would be similar to how pies work. It would be within your current account.
backend: Just label certain trades/ orders with a specific tag and keep track of funds.
frontend: Just filter the displayed funds/ trades for the tag.
This would be beneficial for anyone trying multiple strategies via a system/ algo strategy while also using a discretionary approach.
Will this be available for use within the ISA account?
I am unsure about the regulations for ISAs in this area.
Also; Iād like to post this idea here as it related to the API concept.
(https://community.trading212.com/t/sub-account-feature-for-upcoming-api/62212)
@JamesJohn I have integrated the API with my ISA account and running analysis on it
So if I understood you correctly, yes it works with ISA account.
Please note; I have not tested any POST end points.
First try:
The API says āfree: 3.93ā, but my account says Ā£3.91.
Somethingās a bit wrong.
Sounds dead simple. Canāt believe nobodyās doing it.
/s
I mean you can be /s all you want.
From an engineering standpoint you can do it pretty much all via conditional UI rendering with some slight tweaks on the backend for a āsub accountā uuid.
It doesnāt change the main functionality of the product or create a new user, just what is displayed for each sub account uuid.
But heyā¦ /s
One more suggestion / request would be to add a field on /metadata/instruments
endpoint which is shortName
. On the UI when we search for BCPT
we get .
{
"ticker": "FCPTl_EQ",
"type": "STOCK",
"isin": "GG00B4ZPCJ00",
"currency": "GBX",
"shortName": "BCPT",
"fullName": "Balanced Commercial Property Trust",
"description": "Balanced Commercial Property Trust Ltd",
"countryOfOrigin": "GG",
}
But on the API we get,
{
"ticker": "FCPTl_EQ",
"type": "STOCK",
"workingScheduleId": 59,
"isin": "GG00B4ZPCJ00",
"currencyCode": "GBX",
"name": "Balanced Commercial Property Trust",
"minTradeQuantity": 1.00000000,
"maxOpenQuantity": 99884.00000000,
"addedOn": "2018-07-12T07:10:22.000EEST"
}
Adding the shortName
would help developers to better handle the data.
I have written a logic to map all Trading212 tickers with various sources already But still many would enjoy this change.
I was in the right mood, forgot that this isnāt Reddit and people get offended.
Sorry son. Thought that your solution may involve changes in their database structure, but Iām not much of an engineer myself.
Cheers
Would love to be able to take advantage of using this to automate some of my portfolio tracking, just dont have the time to play with it. if anyone finds a portfolio tracker tool or has some tips on how I can pull simple info like Holdings / Portfolio value etc to Excel/CSV automated or has any websites utilising this API then please let me know
Looks like the Javascript option is now removed from the API
Will there be no XHR support @noop ?
hi is it possible to use this API on trading view or any other execution platform ? thank you
First of all, big kudos for developing this. What would be great, is ability to make a āFill or Killā limit order. Also, fetching the last price for the given ticker (if this functionality doesnāt already exist)
Hello there , i want to export a list of all available stocks on trading 212 using an API
I have the next error appearing ,where do i find this key to unblock the API?
or does someone know how to do that export?
Thanks.
How are you trying to get the data @Hellstaff ? I can see their instruments So the issue is not on Trading212 api. Maybe its the way you try to get it?
Hi All,
Great news to have API available for testing.
One question for Equity orders (Place Limit order, Place Market order, Place Stop order, Place StopLimit order): I tried Market order and after many tries worked for Buy. How place a Sell order for same position?
My feedback so far:
- Place market order is not working most of time (Internal Error)
- Cancel by ID - does not output anything (except response.status_code) and most time is not working
tested with python and curl also on practice. When these will work more reliable?
Regards