Algo stock quotes for trader and investor: where to find and how to download? Free

Many were upset, when Yahoo.Finance closed all loopholes for free stock quotes not so long ago, but to everyone's happiness, there are already alternatives to free data where you can find them. This time we will download a free daily history from the IEX exchange for ~ 8 thousand US assets in about ~ 2 minutes. Will help us with this Python 2.7. And Roman Shchegolikhin will tell.

Inquiring minds on the exchange website can find free tick history for previous ones 10 months in pcap format (tcpdump).

Approximately ~ 2.5% of stock turnover occurs on the IEX, what needs to be considered. Ticks will not allow you to build an ideal history of price changes due to lack of data on other exchanges.

Unlike many foreign data providers, IEX (https://iextrading.com/) provides historical data for free. Day history for 5 recent years available for more than 8 thousand assets, among which such markets as:

  • New York Stock Exchange
  • Nasdaq Global Select
  • NYSE Arca
  • NYSE American
  • NASDAQ Global Market
  • NASDAQ Capital Market
  • BATS Exchange

OTC Markets Group

list of companies, which includes names and phone numbers, brokers and quotes Shares companies. Information is printed on thin pink paper sheets -

By the way, daily history takes into account trades on all American exchanges, unlike ticks. RAA.

This broker has a simple API, and most importantly, free. You don't even need to register. Truth, there is a limit on 100 requests per second.

API documentation: https://iextrading.com/developer/docs/

List of available assets: https://api.iextrading.com/1.0/ref-data/symbols

The request for the desired asset looks like this: https://api.iextrading.com/1.0/stock/aapl/chart/1m

This is a request for Apple inc. daily history for the last month. Quotes adjusted for splits and dividends.

Well what, there is a list of quotes, API is. How to download the whole thing and quickly? Below is a Python script 2.7 using MultiCurl technology and pycurl library.

And to download more 8 thousand assets per month it takes me only ~ 110 seconds. Great!

Stock quote studio code

Котировки акций

We get the list of tickers "on the fly" from IEX and take only working instruments from them.. Speed ​​measurements are for beauty purposes.. The main work is performed by the function [code]performMyMulti[/code]. In this example, it is in packs of [code]block[/code] tickers in parallel pumps out the history of the diaries for the last 30 days. As a batch, the input of this function receives the list [code]tools_[/code], which contains string codes of instruments. The second parameter of this function, [code]time_frame[/code] - sets the depth. To download quotes for 5 years, ask [code]'5y'[/code]. The results are added to text files in a directory data. The data in them is json objects, which can then be parsed and used as intended.

[raaAdSenceArticle]

[in Python]

import pycurl
requests for import
import json
time import
import OS
def execute MyMulti ( tools_ , time_frame = ‘1m’ ) :
”’
Multi-threaded download function. Accepts a list
download tool codes. The number of instruments in this
list should not exceed 100pcs.
”’
m = pycurl.CurlMulti()
m . pens = [ ]
files = [] # list of files to save results
start_ = time.time() # timing to calculate speed, starting point
# creating and configuring curl objects
for tool_ in instruments_ :
c = pycurl . Curl ( )
# filename to save the results; files are saved to the data directory
fileName = “data% s% s_% s.txt” % ( you . sep , tool_ , time_frame )
fileName = name file . replace ( ‘*’ , ‘_’ )
f = open ( File name , «wb» )
files.append(f) # the file is added to the list, to close it later
c.setopt(c.WRITEDATA, f) # besides the file, here you can specify the function, but the file is most convenient for us
URL = “https://api.iextrading.com/1.0/stock/%s/chart/%s” % ( Tool : , time_frame )
c . setopt ( pycurl . URL , URL )
m . add_handle ( c )
m . pens . add ( with )
num_handles = len ( m . pens )
while num_handles :
and 1 :
# execute requests
right , num_handles = m . execute ( )
if a right ! = pycurl . E_CALL_MULTI_PERFORM :
break
m . select ( 1.0 )
# cleaning
for c in m . pens :
c . close ( )
m . remove_handle ( c )
for f in files :
f . close ( )
m . close ( )
del m . pens
end_ = time.time() # timing to calculate speed, end point
return len(tools_) / (end_start_) # speed per second
# download the list of instruments
r = requests . receive ( ‘https://api.iextrading.com/1.0/ref-data/symbols’ )
data = json . loads ( r . text )
tools = [] #tool code list
# select instrument codes into a separate array
for instrument in data :
try it :
if a tool [ ‘isEnabled’ ] has the meaning True :
tooling . add ( tool [ 'symbol’ ] )
except :
Continue
block = 80 #number of parallel requests (no more than 100pcs)
tools_count = len ( tooling )
print(u“Total tools to download: %d” % tools_count)
loops = tools_count / block # number of complete cycles (loops over block requests)
tail = tools_count % block # number of requests remaining
tools_ok = 0 # total number of completed requests
start = time.time() # measuring the total time, starting point
for i in range(loops): # in a loop over all complete loops
srez = tools[i*block:i*block+block:1] # we form a selection from the following block instruments
speed = performMyMulti(srez) # perform parallel download
tools_ok + = block
print(u“done% d from% d, speed% f per second” % (tools_ok, tools_count, speed))
if tail > 0: # “pumping” remaining tools
i += 1
srez = tools[block*i:block*i+tail]
speed = performMyMulti(srez)
tools_ok + = tail
print(u“done% d from% d, speed% f per second” % (tools_ok, tools_count, speed))
end = time.time() # measuring the total time, end point
print(u“All downloaded! Left% f sec” % (endstart))

Outcome

The code can be adapted to download the minute history in real time.

  About 40% minors think, that on shares you can quickly earn

Live ticks are also available via websockets (websockets). What makes this exchange an extremely valuable find.

The first step in trading automation is to develop your own trading system.. However, in order to, to test a mechanical trading system (MTS) gotta get it somewhere stock quotes.

Let me remind you, that the Wealth Lab program allows you to independently create trading systems and test them, using historical stock quotes. There was already a post on our blog, dedicated to, how to make trading systems in Wealth Lab using C# programming.

Today I want to tell – where to find historical stock quotes and how to download them for further analysis in the Wealth Lab program.

Stock quotes and prices - Investing.com

All information about the stock markets in real time: current stock quotes leading companies.

As always, there are several options.:

Option number 1: Finam quotes

The most familiar way – go to the Finam website using the following link: http://www.finam.ru/analysis/export/default.asp and set up the export of the quotes you need there. Most do just that..

But imagine, What will happen, if you trade trading systems using several dozen financial instruments. You will have to periodically go there and spend a lot of time on that., to upload this data.

Option number 2: Alor – history server.

Developers of mechanical trading systems can follow the link: http://www.alor-trade.ru/systems/history/ and use the Alorian history server. This option appeared relatively recently..

This server provides an opportunity to receive historical stock quotes from the main trading floors of Russia via the HTTP protocol. The server can be easily integrated with analytical systems and MTS.

The big plus here is, what now those, who makes trading robots for alor (using ATEAPI COM Objects 6.x.150.211) can set up automatic receipt of stock quotes history.

  LAYERING PRACTICE: IMPLEMENTATION MECHANISM AND LEGISLATIVE BARRIERS

To do this, you need to use the HISTORY and HISTORY_DAILY tables.

The HISTORY table contains information on historical minute data (with a period 1, 5, 10, 15, 20, 30, 60 And 1440 minutes) for all transactions of purchase / sale of financial instruments, perfect in the trading system.

Field A type Appointment

I WOULD

A LONG

String id

RecID

INT64

Record ID

Time

TIME

Time

Ticker

BSTR Ticker

Open

DOUBLE

Opening

high

DOUBLE

Maximum price in the period

Short

DOUBLE

Minimum price in the period

Close

DOUBLE

Last trade price in the period

Volume

DOUBLE

Volume

Period

A LONG

Period, in minutes (possible values: 1, 5, 10, 15, 20, 30, 60, 1440)

The HISTORY_DAILY table contains information on historical daily data on all transactions for the purchase / sale of financial instruments, perfect in the trading system.

Field A type Appointment

I WOULD

A LONG

String id

RecID

INT64

Record ID

Time

TIME

Time

Ticker

BSTR Ticker

Open

DOUBLE

Opening

high

DOUBLE

Maximum price in the period

Short

DOUBLE

Minimum price in the period

Close

DOUBLE

Last trade price in the period

Volume

DOUBLE

Volume

Based on this information, you can configure automatic data acquisition.. All in all, they, who is interested in this option – come here: http://www.alorbroker.ru/technologies/at/ download the Alor Trade terminal with com objects and go.

Option number 3: special program for obtaining stock quotes owp.FDownloader

This option seemed to me the most convenient, because. Fdownloader program:

  • Intuitive, easy to learn and does not require programming skills;
  • allows you to fully automate the receipt of stock quotes and spend a minimum of time on this routine work;
  • The data acquisition process can be customized even then, when you use a proxy server;
  • Data can be received both in * .csv format and in wealth lab format
  • Automatically adds new stock quotes to existing ones, maintaining a convenient database

Immediately I want to say thanks to the developers of this program.. You can read about them here.:

http://code.google.com/p/open-wealth-project/wiki/FDownloader

You can download this program from this link.. If it doesn't work – write [email protected] – we will help.

Now step by step – how to organize the process of obtaining historical stock quotes:

Let's admit, we want to receive hourly data on the most liquid Russian stocks from the MICEX: Gazprom, Lukoil, Sberbank

To do this, you need to do the following steps:

Step # 1:

Organizing disk space

On drive D: create a special directory, which we call MarketData

Inside this directory we do 3 subdirectory:

  • CSV – stock quotes will be stored here in CSV format
  • Downloader – the program itself, the stock quotes loader and its settings, will be stored here
  • WL – stock quotes will be stored here in Wealth Lab format (WL4 Files)

The directory should look like this:

Step # 2:

Copy the files received during the download to the Downloader directory.

As a result, you will get this picture.:

Step # 3:

We launch the program and set up all the data

FDownloader

Push the button “Further”

In the window that appears, press the button “Refresh” – to download the data structure.

After that, put a checkmark in front of those tools, which we want to receive.

And press the button again

As a result – we get into the 3rd window, which already simply informs us about, what the program does.

As a result – in the D folder:\MarketDataCSV1h

Data will appear in * .scv format

And in the folder: D:\MarketData WL 1h MICEX Shares

In * .wl

Now everything is ready for analysis stock quotes in programs for technical analysis.

About that, how to use these stock quotes in the wealth lab program – I'll tell you next time.

  1350 on the MICEX confidently took :)

Sources of:

https://quantrum.me/1571-kak-bystro-skachat-kotirovki-s-iex/

http://finlabportal.ru/2011/04/kotirovki-akcij-gde-najti-i-kak-skachat/

 

Online currency quotes - what is it, and what factors affect them

Everyone encounters the term "quotes" trader, but not everyone fully understands, what does he mean. Knowledge of terminology is necessary for a trader at least to, to understand the mechanism of making deals, namely, what currency will be bought and sold. Below we will deal with the definition of quotes and list the methods for predicting price behavior.

What is a quote?

This term means the expression of the value of one currency in units of another. In the foreign exchange market, it is customary to denote pairs with the indication of 2 currencies, the first is called the base currency, and the second quote currency. In the case of shares, this designation is not accepted., instead, the so-called. «ticker», the price of securities is expressed in units of the national currency.

Type of quotes

The classification is given depending on whether, which currency comes first. The dollar is used as a reserve currency, therefore, we will focus on, where is this currency in the designation of a currency pair.

Allocate:

  • direct quotes - dollar in first place. For example, record like USDJPY means, that the value of the dollar is expressed in yen. In the trading terminal we see, how much is a dollar in yen;
  • reverse - in this case, the dollar is shifted to second place. Example - GBPUSD, EURUSD, ie. the value of the national currency is expressed in dollars;
  • cross rates - quotes in this case do not contain the dollar at all. Examples of popular crosses - EURGBP, GBPJPY. You can get acquainted with the full list of instruments available for trading in the trading terminal., division into straight lines, reverse and cross rates no.

Forward and reverse rates are easy to recalculate.

For example, record like USDRUR means, what 1 dollar is valued at 60 rubles, to get the reverse course, just divide 1 on 60 and we get RURUSD = 0,0167, i.e 1 ruble is valued at 1,67 american cents. Quotes without the use of the dollar are recalculated a little more difficult., although the influence of the "American" is also in the case of them.

This is where mathematics comes in., consider an example of calculation. Suppose, calculates the GBPJPY rate. To do this, you need the GBPUSD rate (let it be equal 1,36345) и USDJPY (well 111,141) now we get the required cross:

For the calculation of cross rates are taken 2 couples. In our example, the dollar in the numerator and denominator is canceled, and we get the desired value of GBPJPY, the screenshot above shows, that its value is calculated correctly. The slight difference is due to the fact, that during the calculation of the value of the exchange rates it managed to change.

What affects quotes, how to predict their movement?

Graphs demonstrate, what issues with volatility in more famous currency pairs (this also applies to raw products, Shares) No. The behavior of prices is directly dependent on actions, that occur in the economy of states. For instance, if a report comes out, in which unexpectedly the EU GDP will be higher than expected, on the chart, we will most likely see a sharp strengthening of the European currency.

So macroeconomic statistics are the driver, with the help of which we see the movements of money pairs in the forex market. From the array of news messages, we advise you to select only those in the financial calendar on the broker's Internet resource, which are marked as particularly important. It is necessary to take into account:

  • publication of employment data, unemployment;
  • statistics on quarterly and annual increase in gross domestic product;
  • general price increase data;
  • retail sales statistics;
  • change in interest rate;
  • requests from regulators. Even the tone of the address affects the behavior of the courses.;
  • unforeseen reasons.

Despite the apparent chaos, you can predict the behavior of currency pairs. In a section on our website, which is dedicated to trading strategies, more than a dozen working trading systems have been assembled. In some, only graphical study is used for forecasting., in the rest - a set of indicators. Main, do not violate the rules of the vehicle, then you can keep up.

Conclusion

The price of a currency depends on a variety of reasons, here and macroeconomic statistics have an impact, and addresses of the first persons of regulators, even on gossip, money pairs show good movements. Specifically, the change in the rate allows exchange trading participants to earn, you just need to learn to take cheaper and sell more expensive (or vice versa). This simple at first glance scheme allows a participant in exchange trading to become financially independent., that's why trading has become so popular.

Scroll to Top