Historical data for the product Netflow2 are available beginnig from 2007 for the following stocks:
SBER, GAZP, LKOH, GMKN, MGNT, ROSN, VTBR, ALRS, SBERP, AFLT
Data is updated on daily basis at 18:30-18:35 MSK. The data of a trial version of product comes with a two weeks delay.
There are two download methods:
Get data for a given date on all 10 stocks: http://iss.moex.com/iss/analyticalproducts/netflow2/securities.csv?date=2014-06-06
Get data for a given period of time on a given stock: http://iss.moex.com/iss/analyticalproducts/netflow2/securities/SBER.csv?from=2018-01-01&till=2019-09-01
Dataset is available in csv, json and xml formats. By one request 1000 rows could be retrieved maximum, it is a 3 year of history (~ 760 rows) for a single equity. To get a full history beginning from 2007 at least 4 queries are needed.
Get data for a given date
import pandas as pd
url = 'http://iss.moex.com/iss/analyticalproducts/netflow2/securities.csv?date=2019-08-20'
pd.read_csv(url, ';', skiprows = 2)
Get full history for a given stock
# 1000 rows - one request limit
ticker = 'SBER'
A = pd.DataFrame()
for year in range(2007,2020, 3):
url = 'http://iss.moex.com/iss/analyticalproducts/netflow2/securities/' + ticker + '.csv' \
'?from=' + str(year) + '-01-01&till=' + str(year + 3) + '-01-01'
print(url)
A = A.append(pd.read_csv(url, ';', skiprows = 2), ignore_index = True)
A.head()
A.tail()
Get OHLCV candles for a given stock
# 500 rows - one request limit
#interval=24 - 1 day, interval=60 - 1 hour, interval=10 - 10 min candles
ticker = 'SBER'
Y = pd.DataFrame()
for i in range(2007,2020):
url = 'https://iss.moex.com/iss/engines/stock/markets/shares/securities/' + ticker + '/candles.csv' \
'?interval=24&from='+str(i)+'-01-01&till='+str(i)+'-12-31'
print(url)
Y = Y.append(pd.read_csv(url, ';', skiprows = 2), ignore_index = True)
#value - turnover in RUB, volume - turnover in number of shares,
#begin - beginning date time of a candle, end - end date time of a candle
Y.tail()