Thank you @GeorgiL and dev team nice changes.
I believe in some endpoints, like equity/history
ones, if we had a date range, we would have a lot less requests.
On your native api, you have newerThan
and olderThan
. These would be super filters to have
At the moment the “average price” value provided by the API for each share isn’t accurate enough to use when calculating how much was paid for an asset.
Quick example with Aviva:
Looking through the order history I can see that I paid 67.86 in total.
The API tells me the average price is 376.66897036 but taking this number (dividing by 100) and multiplying it by the number of shares I hold: 3.7666897036 × 17.9261647 = 67.52 (2 d.p.)
In this example it’s off by a few pence. With shares where I’ve paid a lot more the difference is in pounds, and of course errors accumulate. Doesn’t help with the old spreadsheets.
Can the API make stop loss and limit orders correctly?
Ideally I always want a stop and to set a sell limit on most trades im aiming at.
It would also be nice it the api could accept sell orders as a % size of the stack. So 50% sell would immediately work out what 50% of your owned stack was in a certain stock.
I’m mostly looking forward to when the API hits production and can then be linked with Trading view. If and when that happens I will be using it exclusively to make trades with.
@GeorgiL Hey, any estimates on the first non-beta release?
Hello! Thanks a lot for this new cool feature!
I want to fetch the tickers available on the platform using the instruments endpoint (/api/v0/equity/metadata/instruments).
I seem to only be able to use an API key on my practice account, when creating an API key with me real money account, I get a 401 error.
Do you have an ETA for moving out of beta?
Thanks!
hey there!
Seems /api/v0/equity/history/orders
endpoint is down for a while I want to believe you are going to include one necessary piece the HistoricalOrder
which is numberOfShared
because currently HistoricalOrder
is just data but this data does not tell a story.
Example below, is a HistoricalOrder
as you can see there are some values. So, an auto invest made a purchase, looks like order was £4 and I purchased MAIN
perfect. But what did I get? Yes, there is a fillPrice
of 41.5 which is great, thank you but its in $'s therefore I need an exchange rate to get some more information.
{
"id": 1275328672,
"dateCreated": "2021-04-12T15:26:21.000Z",
"dateExecuted": null,
"dateModified": "2021-04-12T15:27:17.000Z",
"executor": "AUTOINVEST",
"fillCost": 3.99,
"fillId": 1275328674,
"fillPrice": 41.5,
"fillResult": null,
"fillType": "OTC",
"filledQuantity": null,
"filledValue": 4.0,
"limitPrice": null,
"orderedQuantity": null,
"orderedValue": 4.0,
"parentOrder": 1275327993,
"status": "FILLED",
"stopPrice": null,
"taxes": "[{\"fillId\":\"1275328674\",\"name\":\"CURRENCY_CONVERSION_FEE\",\"quantity\":-0.01,\"timeCharged\":\"2021-04-12T16:27:17.000Z\"}]",
"ticker": "MAIN_US_EQ",
"timeValidity": null,
"type": "MARKET",
"total_taxes": -0.01,
"result": 3.98
}
Also, when there is a filledQuantity
then its a quantity order and on that we at least have fillPrice
but not everyone uses orders with set amount of shares
Hi,
I tried many endpoints with my ApiKey but no result, always 401. I’m quite experienced with APIs and I know how to use the Postman app and such.
Did I miss something? Like, should I crypt the API key with SH265 or anything like that?
Hi @trevordb ,
Make sure you have given your API key permissions for the functionality you want to use. And if you are using Postman, add you API key to the Authorization section → API Key → Value.
Thank you all for the feedback. We are aware of the problem with placing an order in practice mode. For now we are focusing more on the prod problems and polishing some of the features there. Placing orders on real money accounts needs some legal clarifications and updates. Our legal team is currently working on it, and when they are ready we will start fixing the issues with the orders. As for the other feedback for the currently available features we are looking on every single suggestion and will try to implement as many as we can in the future. For now we will remain in the beta version, because we have a lot more work to do on the API. Thank you all for you feedback and patience. We will inform you on new feature and updates.
Thank you so much @GeorgiL wondering if the history orders api will be back anytime soon it returns an Internal error atm
Hi @minasm,
What response do you receive when hitting the endpoint?
This is an example from Postman
Get the same issue when try the web
Thanks!
We will look into it, thanks for the heads up!
Hi, thank you for your reply.
I did everything you mention above.
Here is my basic request on the Trading 212 Platform.
I copied the API key from the mobile app, freshly created.
Here is the result and the authorisations that I gave to the API key on the pic.
I also tried different endpoints such as Account Data, Portfolio etc. All gives 401
I’m wondering if is this because I’m a new user.
I tried on Postman secondarily.
Essentially it should work on the official debug panel here.
Any advice?
(I merged all in one photo due to the forum restrictions.)
Found the solution!
I hope this helps others like me
I was in “demo” mode, I didn’t know this was an option menu.
Now I have 200 OK
Thanks
Hi can i implement this within excel using VBA for example.
Can we have FX endpoints?
Hi @GeorgiL, just want to second @minasm here as I’m experiencing the same issue - seemed to happen as soon as I went over 50 records in the data.
Please advise? Many thanks
Maybe they fix the issue @MikeB31107 and as a surprise we get a exchange rate or some other clue to calculate actually how many shares we got from the order.
yes. as you would integrate any other json api. in vba you have a few options but the one I always opt for is the CreateObject(“MSXML2.XMLHTTP”) then just call the endpoint with your key and parse the return