Feature: prices
See original GitHub issueI need to be able to get prices, so I figured I’d make an issue with my findings. I’m hoping to be able to submit a PR in a couple days, but if not I’ll have all the information I’ve found documented here.
The URL DEGIRO requests it’s data from (on page load) is https://charting.vwdservices.com/hchart/v1/deGiro/data.js?requestid=1&resolution=PT1M&culture=nl-NL&period=P1D&series=issueid%3A198401&series=price%3Aissueid%3A198401&format=json&callback=vwd.hchart.seriesRequestManager.sync_response&userToken=${usertoken}&tz=Europe%2FAmsterdam.
I redacted the user token for now, as I’m not sure if this one is personal or if it’s the “user token” for DEGIO at vwdservices. It’s a 7-digit number, ending with 821. If someone else runs into this issue, could you let me know if it’s the same for you? Then we know it’s common to everyone and not variable.
This is a get-request, so all required information is in this URL. I’m assuming there is no cookies involved, as the data is loaded from a 3rd party service.
The two “series” arguments are issueid:${product.vwdId}
and price:issueid:${product.vwdId}
. Although I’m not certain both are required for our (initial) use-case, I’d recommend leaving both in to make the request indistinguishable from what DEGIRO does.
What’s interesting though, is that for this request, it doesn’t seem like you have to be logged in. This means easier unit testing, also in CI.
To-Do:
- Figure out where “user token” comes from, and if you need to be logged in for this. If someone can help me with this that’d be great! Just hit F12, load a product page, and find the request under network. If your user token also ends with 821, we know it can be hard-coded in.
My suggestions for implementing this:
- Add enums for “resolution” and for “period”.
- Add a function “getPrices(resolution, period, vwdId, culture, timezone)” which performs the GET request. Optionally also need to pass the “user token”.
- Add a test that uses a hard-coded vwdId to retrieve the price data.
Notes: Callback should be omitted, as that will wrap the result in a function call (to be used with eval). Omitting it returns the raw JSON response.
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (3 by maintainers)
First of all, thanks for sharing that’s great !
For the rest of my response : beware that this is just my experience feedback.
Since at this point, there is no official and public documentation for Degiro’s API.
I will split my answer in 3 parts :
1. What is this user_token ?
1.1. What is it ?
From what I understood it’s a unique identifier.
To answer to your question : we don’t have the same “user_token”.
It seems to be unique to each Degiro’s account.
1.1. How can I get it ?
It’s inside the response of these endpoints and it’s called “clientId” or “id” :
There might be other endpoints.
For more details about “user_token”, you can take a look at the documentation of this repository :
https://github.com/Chavithra/degiro-connector
2. Is there an example for this endpoint ?
I can see you have already started to build methods to consume this endpoint. https://charting.vwdservices.com/hchart/v1/deGiro/data.js
There are other projects on github which consume this endpoint.
Here are some examples : A. https://github.com/Chavithra/degiro-connector B. https://github.com/lolokraus/DegiroAPI C. https://github.com/pcmind/degiro-java-client D. https://github.com/SlashGordon/autotrader
A : method “get_graph” B : method “real_time_price” C : methods “getPriceHistory” & “getGraph” D : methods “get_series” & “get_last_price”
Maybe you can take inspiration from these repositories.
For instance, to get the available options for each parameter, like “resolution” or “period”.
Although most options are already listed directly in Degiro’s website JavaScript code.
3. Is there another endpoint to get prices ?
For a real-time usage I think this endpoint is more suitable :
https://degiro.quotecast.vwdservices.com/CORS
Some examples of projects consuming this endpoint : A. https://github.com/Chavithra/degiro-connector B. https://github.com/llehouerou/go-degiro C. https://github.com/pcmind/degiro-java-client D. https://github.com/pladaria/degiro
A : method “fetch_data” B : methods “SubscribeQuotes” and “GetQuote” C : method “getPricePoller” D : methods “getAskBidPrice”
I hope that will help you in your quest.
I understeand… Is not legal for degiro if se create bot? Cause Etoro per you do that… But getting the api is a pain too
Il dom 28 feb 2021, 13:21 J.R.I. notifications@github.com ha scritto: