Get stock prices for a project
LoloWilou69
Posted messages
15
Status
Membre
-
Malti Z F -
Malti Z F -
Hello,
I am looking for a web service, API, etc. to retrieve stock market quotes (from Paris) almost instantly (I know that to get quotes for free, there is a 20-minute delay).
I will use them for a JAVA or C# application. I need the stock market quote and individual stock quotes.
I saw that it might be possible to do this via a Yahoo Finance API, but I did not fully understand how it works. If you at least know of a tutorial, I would appreciate it.
One solution could be to load an HTML page from Boursorama or Euronext... and retrieve the information I am interested in from it, but I find this solution a bit "dirty" because if one of those sites changes its page format, I would no longer be able to retrieve the data. Also, I am not sure if I am allowed to extract this information without the site’s permission.
If you have any ideas, I am all ears.
Thank you in advance
I am looking for a web service, API, etc. to retrieve stock market quotes (from Paris) almost instantly (I know that to get quotes for free, there is a 20-minute delay).
I will use them for a JAVA or C# application. I need the stock market quote and individual stock quotes.
I saw that it might be possible to do this via a Yahoo Finance API, but I did not fully understand how it works. If you at least know of a tutorial, I would appreciate it.
One solution could be to load an HTML page from Boursorama or Euronext... and retrieve the information I am interested in from it, but I find this solution a bit "dirty" because if one of those sites changes its page format, I would no longer be able to retrieve the data. Also, I am not sure if I am allowed to extract this information without the site’s permission.
If you have any ideas, I am all ears.
Thank you in advance
Configuration: Windows XP Firefox 3.0.5
9 réponses
It is enough to read the streams (ajax generally now)
I created a real-time software (in C), covering all of Euronext and the US (> 10,000 stocks analyzed)
which allows me to detect a stock that starts to rise ... and to position myself on it to exit in ID (Swing trading)
This is the software of my life (~ 1 year of development), I live off this now :-)
(and my income is significantly > than my previous job, which was as an IT consultant in banking...)
I created a real-time software (in C), covering all of Euronext and the US (> 10,000 stocks analyzed)
which allows me to detect a stock that starts to rise ... and to position myself on it to exit in ID (Swing trading)
This is the software of my life (~ 1 year of development), I live off this now :-)
(and my income is significantly > than my previous job, which was as an IT consultant in banking...)
Hi,
I don't know which OS you're using, but you can find a bash script (for Linux and Mac) that fetches stock prices in real-time from Boursorama.
http://www.ensta.fr/~garnier/bourse.html
Even if you’re not on Linux, you can look through the code to see.
Let me know if you have any questions or if there's anything you don't understand,
talk to you later.
I don't know which OS you're using, but you can find a bash script (for Linux and Mac) that fetches stock prices in real-time from Boursorama.
http://www.ensta.fr/~garnier/bourse.html
Even if you’re not on Linux, you can look through the code to see.
Let me know if you have any questions or if there's anything you don't understand,
talk to you later.
I don't know PHP, but a quick search on Google shows that there are parsing functions or JSON, like
http://php.net/manual/en/function.json-decode.php
and many sites provide examples,
http://webhole.net/2009/08/31/how-to-read-json-data-with-php/
etc...
http://php.net/manual/en/function.json-decode.php
and many sites provide examples,
http://webhole.net/2009/08/31/how-to-read-json-data-with-php/
etc...
Indeed, I didn't know about 'json' at all, which will allow me to easily retrieve the data once I've managed to get the line.
Because curl is currently only returning an empty variable for a reason I don't know.
But if you don't know PHP, I won't take advantage of your patience.
Thank you for your responses and good luck.
Because curl is currently only returning an empty variable for a reason I don't know.
But if you don't know PHP, I won't take advantage of your patience.
Thank you for your responses and good luck.
Okay, thanks
I didn't understand because I thought it was the CAC!
Does anyone have a table of stock and index codes??
Thanks in advance
I didn't understand because I thought it was the CAC!
Does anyone have a table of stock and index codes??
Thanks in advance
Salut castorix, could you send me your info privately about programming automatic stock orders on Binck Bank? I can't find the documentation and I’m with another broker, thanks.
Hello Castorix,
Thank you for your code. Do you know if we can retrieve only the basic information, in one line? I used to get this code from Yahoo Finance but it no longer works.
The most important thing is that I want to retrieve the quotes for commodities: Gold, Silver, etc.
My site kestellikian.fr, now all the values are at zero, I had to set the values to 1 to avoid a division by zero.
Thank you for your help, my email: c.kestellikian@live.fr
Thank you for your code. Do you know if we can retrieve only the basic information, in one line? I used to get this code from Yahoo Finance but it no longer works.
The most important thing is that I want to retrieve the quotes for commodities: Gold, Silver, etc.
My site kestellikian.fr, now all the values are at zero, I had to set the values to 1 to avoid a division by zero.
Thank you for your help, my email: c.kestellikian@live.fr
Hello castorix,
I just read the post and I'm very interested in your URL.
http://1.ajax.lecho.be/rtq/?reqtype=simple"es=360015511&lightquotes=&group=g30_q_p
I tested it in my browser and the values I'm looking for are there.
The problem is that I completely don't know how to handle this information.
Ajax is not my strong suit.
I'm working on an HTML PHP page that needs to display the information. Can you give me a code compatible with both languages that would allow me to handle this request?
Thanks in advance
I just read the post and I'm very interested in your URL.
http://1.ajax.lecho.be/rtq/?reqtype=simple"es=360015511&lightquotes=&group=g30_q_p
I tested it in my browser and the values I'm looking for are there.
The problem is that I completely don't know how to handle this information.
Ajax is not my strong suit.
I'm working on an HTML PHP page that needs to display the information. Can you give me a code compatible with both languages that would allow me to handle this request?
Thanks in advance
Well, I'm still struggling.
I tried to retrieve the line of text returned to me using
but this line causes my browser to spin endlessly.
So I tried with curl.
I tested with different sites like Google and it works, but when testing with the URL http://1.ajax.lecho.... nothing happens.
If you have any ideas
I tried to retrieve the line of text returned to me using
<?php file_get_contents('URL'); ?> but this line causes my browser to spin endlessly.
So I tried with curl.
I tested with different sites like Google and it works, but when testing with the URL http://1.ajax.lecho.... nothing happens.
If you have any ideas
<?php function get_contenu($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); curl_setopt($ch, CURLOPT_TIMEOUT, 3); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $contenu = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode < 400 && $httpCode >= 300) { return FALSE; } else { return $contenu; } } $site = get_contenu('http://1.ajax.lecho.be/rtq/?reqtype=simple&%20quotes=360015511&lightquotes=&group=g30_q_p'); echo $site; ?>
Hello everyone
interesting post ....
has anyone managed to analyze the ajax flow on lecho.be?
it seems to be the CAC 40 but the data does not match.
interesting post ....
has anyone managed to analyze the ajax flow on lecho.be?
it seems to be the CAC 40 but the data does not match.
Well, if that corresponds:
If we take the first one for example,
"360097430":{"open":"31.4450","time":"23/11","pct":"0.1434","last":"31.4250","volume":503068,"high":"31.4600","ask":"0.0000","low":"31.0200","bid":"0.0000","prev":"31.3800"
These are indeed the data for CAP:
http://www.lecho.be/bourses/Cap_Gemini.360097430
If we take the first one for example,
"360097430":{"open":"31.4450","time":"23/11","pct":"0.1434","last":"31.4250","volume":503068,"high":"31.4600","ask":"0.0000","low":"31.0200","bid":"0.0000","prev":"31.3800"
These are indeed the data for CAP:
http://www.lecho.be/bourses/Cap_Gemini.360097430
Ok, it's all the actions of the CAC
but how to recover a stock (e.g. Google) or an index (e.g. CAC or NYSE)
thank you for your help
but how to recover a stock (e.g. Google) or an index (e.g. CAC or NYSE)
thank you for your help
The CAC itself is inside, code 360015511
Otherwise, just the CAC, http://1.ajax.lecho.be/rtq/?reqtype=simple"es=360015511
(remove the space before quotes)
But we don't have the volume, which we easily get with the first request by adding up all the volumes.
Google, it's http://1.ajax.lecho.be/rtq/?reqtype=simple"es=350186927
But for NYSE/NASDAQ, I prefer to use Google feeds, more real-time
http://www.google.com/finance/info?infotype=infoquoteall&q=NASDAQ:GOOG
Otherwise, just the CAC, http://1.ajax.lecho.be/rtq/?reqtype=simple"es=360015511
(remove the space before quotes)
But we don't have the volume, which we easily get with the first request by adding up all the volumes.
Google, it's http://1.ajax.lecho.be/rtq/?reqtype=simple"es=350186927
But for NYSE/NASDAQ, I prefer to use Google feeds, more real-time
http://www.google.com/finance/info?infotype=infoquoteall&q=NASDAQ:GOOG
Can you explain how you did it?
I would like to do the same thing.
Thank you
For example, for the feed of stocks in Compartment A on Paris:
http://1.ajax.lecho.be/rtq/?reqtype=simple"es=360015511&lightquotes=&group=g2101_q_p
All that's left is to parse and match ID :<=>Title (e.g., 360115890 = Faurecia)
which I will do only once during installation by parsing the HTML of
https://www.lecho.be/les-marches/bourses/euronext-paris/frencha.html
for Comp. A, for example.
Are the courses on Google Finance and L'echo.be instant courses? Because if this condition is not met, I don't see how a computer program could produce usable results, knowing that now a very large part of stock trading is carried out automatically by robots, computer programs like yours but much more sophisticated that react at very high speeds.
Are the feeds you are talking about RSS feeds?
and on Echo.be for Euronext, except for Alternext (Same as Zonebourse.com)
or through my broker Binck Bank)
I’m obviously aware of HFT (High Frequency Trading), which doesn't concern me since I don't need to place x orders per second!
The purpose of my software is to detect any sudden increase on over 10,000 titles, impossible for a human, to position myself on it before others and to exit after +n%
So far, it works almost perfectly (the key is not to be too greedy with the gain percentage and to exit on time, as the price can drop during the day, of course)
(+1% on 30-40 K€ is enough for me, for example, but I need +7 to 8% in ID if I only put in 5, which is rare on Euronext but common on Nasdaq)
I manage to make several passes per second on each title using multi-threading, which is more than sufficient.
How often do you parse the streams?
Do you also have access to derivatives like warrants, trackers, etc. live?
Thank you