Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Real time price #6

Open
jaspspain opened this issue Jun 6, 2020 · 18 comments
Open

Real time price #6

jaspspain opened this issue Jun 6, 2020 · 18 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@jaspspain
Copy link

Hi folks, can you tell me how can i get the real time price of one product, for example APPLE?

I only can see the closing price.

Thank you

@bricomatica
Copy link

bricomatica commented Jun 6, 2020 via email

@jaspspain
Copy link
Author

Thanks for your fast answer :)
I really want to know the actual prices from products that aren't in my portfolio.
i want to know the actual price from APPLE for example but i dont have any open positions.

@bricomatica
Copy link

bricomatica commented Jun 6, 2020 via email

@lolokraus lolokraus added the good first issue Good for newcomers label Jun 6, 2020
@bricomatica
Copy link

bricomatica commented Jun 8, 2020

Yesterday I tried to get the real time price without success. Lolokraus, could it be possible to get this data? It's very important to program any automatic trading system using this API.
Thank you in advance. Regards from Spain :)

@jaspspain
Copy link
Author

Yesterday I tried to get the real time price without success. Lolokraus, could it be possible to get this data? It's very important to program any automatic trading system using this API.
Thank you in advance. Regards from Spain :)

Buenas bricomatica, veo que eres español también.
Yo estoy intentando lo mismo y de momento no se puede... Estoy sacando los valores en tiempo real de una web y enlazándoos con las ordenes que le mando a Degiro.

Si descubres como hacerlo, agradecería que me lo dijeras ;)

Un Saludo!

@bricomatica
Copy link

Yesterday I tried to get the real time price without success. Lolokraus, could it be possible to get this data? It's very important to program any automatic trading system using this API.
Thank you in advance. Regards from Spain :)

Buenas bricomatica, veo que eres español también.
Yo estoy intentando lo mismo y de momento no se puede... Estoy sacando los valores en tiempo real de una web y enlazándoos con las ordenes que le mando a Degiro.

Si descubres como hacerlo, agradecería que me lo dijeras ;)

Un Saludo!
Hola! Me alegra ver un compatriota por aquí :)
De momento solo se puede obtener el precio de cierre, pero ese no sirve para hacer trading en condiciones.
Si encuentro alguna forma, descuida que lo pondré aquí.
Si me pudieras decir cómo haces para sacar los valores de esa web, te lo agradecería mucho.
Y si te apetece charlar sobre sistemas de bolsa, encantado también. Yo le pego a las opciones sobre el SP500. Mi email es [email protected]
Saludos!

@pgoslatara
Copy link
Contributor

@lolokraus Want your opinion on this before I see if I can do this.

I don't see a degiro.nl endpoint that returns the real time price. The product_info function returns a "vwdIdSecondary" ID which can be used to fetch a https://charting.vwdservices.com/hchart/v1/deGiro/data.js? endpoint which contains a "lastPrice" key. Question is, do you want to have a reliance on a non-DeGiro URL?

@lolokraus
Copy link
Owner

Getting the real time data for products would be a huge improvement to this API and I tried to implement it already, but as @SilageTime already correctly pointed out, there seems to be no endpoint from degiro that returns the real time product data.

But I think if we get it to work through https://charting.vwdservices.com/hchart/v1/deGiro/data.js? it would be an equally good solution!

As a second solution, I have seen many repositories getting real time data though https://finance.yahoo.com/. Such as https://github.com/ranaroussi/yfinance or https://github.com/JECSand/yahoofinancials.

@lolokraus
Copy link
Owner

I have added a function to get real time data and historical data for a product. But I don't want to close this issue yet because I have run into some problems while testing, where the real time data of this API was lacking behind the data shown on the website, without any reason. So if you also experience such problems report them to me and any help in fixing them is appreciated!

@lolokraus lolokraus added documentation Improvements or additions to documentation and removed good first issue Good for newcomers labels Jun 20, 2020
@matt-uib
Copy link

@lolokraus do you know this implementation here - this seems rather complete (have not used it though):
https://www.programcreek.com/java-api-examples/?code=indiketa%2Fdegiro-java-client%2Fdegiro-java-client-master%2Fsrc%2Fmain%2Fjava%2Fcat%2Findiketa%2Fdegiro%2FDeGiroImpl.java

if you look in the file DeGiroImpl.java there is:
public void setPricePollingInterval()
public void setPriceListener()
So i guess you have to subscribe a price listener somehow to this vwdSession to get the real time prices - it also looks like that in the degiro webclient. There is the normal chart with historical data and then there is "real time" price display shown extra.

@todool
Copy link

todool commented Jun 22, 2020

@lolokraus I am trying to get the real time data via your example program but I got the following error:
Traceback (most recent call last):
File "./degiro", line 70, in
realprice = degiro.real_time_price(Product(products[0]).id, degiroapi.Interval.Type.One_Day)
File "/home/tobie/.local/lib/python3.8/site-packages/degiroapi/init.py", line 235, in real_time_price
return self.__request(DeGiro.__PRICE_DATA_URL, None, price_payload,
File "/home/tobie/.local/lib/python3.8/site-packages/degiroapi/init.py", line 79, in __request
response = requests.get(url, params=payload)
File "/usr/lib/python3/dist-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='charting.vwdservices.com', port=443): Max retries exceeded with url: /hchart/v1/deGiro/data.js?requestid=1&period=P1D&series=issueid%3A330001938&series=price%3Aissueid%3A330001938&userToken=843544 (Caused by SSLError(SSLError(1, '[SSL: WRONG_SIGNATURE_TYPE] wrong signature type (_ssl.c:1108)')))

@jernejg
Copy link

jernejg commented Jul 3, 2020

What sourcery is Degiro using for real time data?? I can only see the traffic using low level network capturing tools, but nothing in Chrome or Mozzila dev tools. I thought I knew how web works :)

@Joapie
Copy link

Joapie commented Jul 8, 2020

@lolokraus ; I tried to us the realtime price feature (which would be a great improvement on this very nice API), but it does not seem to work. I am getting the following error:
""
File "/Users/user/Desktop/Python/DegiroAPI-master-2/GiRoTeSt.py", line 52, in
realprice = degiro.real_time_price(Product(products[0]).id, degiroapi.Interval.Type.One_Day)

AttributeError: 'DeGiro' object has no attribute 'real_time_price'
""
Your advice please.
KR
JJ

@riccardoclementi
Copy link

riccardoclementi commented Sep 17, 2020

Dear @lolokraus , i'm having some issue with realtime prices of products that have the parameter 'vwdId' as a string and not like a int, an example is CME MES future:
name of the product: "MES 18DEC20"
'vwdId' is 'MES.CM.012,F'

For this type of product no ['vwdIdSecondary'] is available. therefore at line 224 of init.py and then at line 226 an error is issued. Ty for your efforts

@Systemac
Copy link

Systemac commented Dec 1, 2020

After looking for a while, to get the real-time price of a stock, I don't look at what the js returns (which is not part of degiro in effect) but I look at what the index returns to him. even, it is formed strangely but we see that it returns the graph. I grant you there is a slight delay, but for my stratum which consists in gradually increasing the stop loss it passes ...

http://pastebin.fr/75788

I hope help you ....

@Swopper050
Copy link

Swopper050 commented Dec 29, 2020

I have added a function to get real time data and historical data for a product. But I don't want to close this issue yet because I have run into some problems while testing, where the real time data of this API was lacking behind the data shown on the website, without any reason. So if you also experience such problems report them to me and any help in fixing them is appreciated!

@lolokraus I think this is due to the following: An initial data request is retrieved which contains indeed the 'lastPrice' field, but they also start a service worker which updates prices. It can be seen if (if you use Chrome) using chrome://inspect/#workers under Shared workers (if you have a product page open).
When inspecting this worker (open the network tab and refresh your product page) you can see it starts a session, posts control data after which every second or so new prices are requested and I think afterwards updated on the page.
This way you can also retrieve bid and ask prices (or basically anything updating on the page), so also for #26 this is relevant.

However, I am not sure if it will be very stable to build upon, as it depends on this url:
https://degiro.quotecast.vwdservices.com/CORS/request_session?....

@paveldomsa
Copy link

I've read all Degiro terms and conditions and it's explicitely told that Vwd guaranties realtime data for degiro application and client is aware of it. Theirs Infront structure is quite robust and it can definitely be relied on.
So anything from vwdservices.com with vwdsessionid is fine.
As mentined before inideta degiro-java-client, i'm currently looking at it and hopefully i can add same realtime price, bid, ask, volume support to this api.

@BautizarCodigo
Copy link

This issue seems to have appeared in the last day also.

This is the stacktrace

realprice = self.degiro.real_time_price(Product(products[0]).id, degiroapi.Interval.Type.One_Day)
  
File "/usr/local/lib/python3.7/dist-packages/degiroapi/__init__.py", line 221, in real_time_price
    vw_id = self.product_info(product_id)['vwdId']

KeyError: 'vwdId'

adamchabin pushed a commit to adamchabin/DegiroAPI that referenced this issue Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests