DegiroAPI icon indicating copy to clipboard operation
DegiroAPI copied to clipboard

Real time price

Open jaspspain opened this issue 5 years ago • 18 comments

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

jaspspain avatar Jun 06 '20 10:06 jaspspain

Im not sure but when you ask for your positions, you can get the prices.

El sáb., 6 jun. 2020 12:38, jaspspain [email protected] escribió:

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

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lolokraus/DegiroAPI/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACS4CSSZ7KDNYN4FHM4MQ6DRVIMBXANCNFSM4NV3IWUA .

bricomatica avatar Jun 06 '20 11:06 bricomatica

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.

jaspspain avatar Jun 06 '20 11:06 jaspspain

Yes, I have the same problem. This is just a workaround. Lets hope lolokraus can make it. Regards :)

El sáb., 6 jun. 2020 13:46, jaspspain [email protected] escribió:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lolokraus/DegiroAPI/issues/6#issuecomment-640046337, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACS4CSUMEX2JZGG3R6MX5ZTRVIUBHANCNFSM4NV3IWUA .

bricomatica avatar Jun 06 '20 11:06 bricomatica

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 :)

bricomatica avatar Jun 08 '20 10:06 bricomatica

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!

jaspspain avatar Jun 08 '20 10:06 jaspspain

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!

bricomatica avatar Jun 08 '20 10:06 bricomatica

@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?

pgoslatara avatar Jun 08 '20 17:06 pgoslatara

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 avatar Jun 09 '20 08:06 lolokraus

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 avatar Jun 19 '20 18:06 lolokraus

@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.

matt-uib avatar Jun 20 '20 12:06 matt-uib

@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)')))

todool avatar Jun 22 '20 18:06 todool

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 :)

jernejg avatar Jul 03 '20 09:07 jernejg

@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

Joapie avatar Jul 08 '20 13:07 Joapie

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

riccardoclementi avatar Sep 17 '20 14:09 riccardoclementi

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 ....

Systemac avatar Dec 01 '20 07:12 Systemac

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?....

Swopper050 avatar Dec 29 '20 17:12 Swopper050

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.

paveldomsa avatar Jan 12 '21 07:01 paveldomsa

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'

BautizarCodigo avatar Mar 17 '21 19:03 BautizarCodigo