Skip to main content

MOEX ISS API

Реализация части запросов к MOEX Informational & Statistical Server.

Документация

https://wlm1ke.github.io/apimoex/

Основные возможности

Реализовано несколько функций-запросов информации о торгуемых акциях и их исторических котировках, результаты которых напрямую конвертируются в pandas.DataFrame.

Работа функций базируется на универсальном клиенте, позволяющем осуществлять произвольные запросы к MOEX ISS, поэтому перечень доступных функций-запросов может быть легко расширен. При необходимости добавления функций воспользуйтесь Issues на GitHub с указанием ссылки на описание запроса:

Начало работы

Установка

$ pip install apimoex

Пример использования реализованных запросов

История котировок SNGSP в режиме TQBR:

import requests

import apimoex
import pandas as pd

with requests.Session() as session:
    data = apimoex.get_board_history(session, 'SNGSP')
    df = pd.DataFrame(data)
    df.set_index('TRADEDATE', inplace=True)
    print(df.head(), '\n')
    print(df.tail(), '\n')
    df.info()
           BOARDID  CLOSE    VOLUME         VALUE
TRADEDATE
2014-06-09    TQBR  27.48  12674200  3.484352e+08
2014-06-10    TQBR  27.55  14035900  3.856417e+08
2014-06-11    TQBR  28.15  27208800  7.602146e+08
2014-06-16    TQBR  28.27  68059900  1.913160e+09
2014-06-17    TQBR  28.20  22101600  6.292844e+08

           BOARDID   CLOSE     VOLUME         VALUE
TRADEDATE
2019-09-04    TQBR  38.060  243010500  9.348435e+09
2019-09-05    TQBR  36.140  129366600  4.704949e+09
2019-09-06    TQBR  35.475   62389000  2.201887e+09
2019-09-09    TQBR  34.570   54331300  1.905837e+09
2019-09-10    TQBR  35.250   45966000  1.605849e+09

<class 'pandas.core.frame.DataFrame'>
Index: 1326 entries, 2014-06-09 to 2019-09-10
Data columns (total 4 columns):
BOARDID    1326 non-null object
CLOSE      1326 non-null float64
VOLUME     1326 non-null int64
VALUE      1326 non-null float64
dtypes: float64(2), int64(1), object(1)
memory usage: 51.8+ KB

Пример реализации запроса с помощью клиента

Перечень акций, торгующихся в режиме TQBR (описание запроса):

import requests

import apimoex
import pandas as pd


request_url = ('https://iss.moex.com/iss/engines/stock/'
               'markets/shares/boards/TQBR/securities.json')
arguments = {'securities.columns': ('SECID,'
                                    'REGNUMBER,'
                                    'LOTSIZE,'
                                    'SHORTNAME')}
with requests.Session() as session:
    iss = apimoex.ISSClient(session, request_url, arguments)
    data = iss.get()
    df = pd.DataFrame(data['securities'])
    df.set_index('SECID', inplace=True)
    print(df.head(), '\n')
    print(df.tail(), '\n')
    df.info()
          REGNUMBER  LOTSIZE   SHORTNAME
SECID
ABRD   1-02-12500-A       10  АбрауДюрсо
AFKS   1-05-01669-A      100  Система ао
AFLT   1-01-00010-A       10    Аэрофлот
AGRO           None        1    AGRO-гдр
AKRN   1-03-00207-A        1       Акрон

          REGNUMBER  LOTSIZE   SHORTNAME
SECID
YNDX           None        1  Yandex clA
YRSB   1-01-50099-A       10     ТНСэнЯр
YRSBP  2-01-50099-A       10   ТНСэнЯр-п
ZILL   1-02-00036-A        1      ЗИЛ ао
ZVEZ   1-01-00169-D     1000   ЗВЕЗДА ао

<class 'pandas.core.frame.DataFrame'>
Index: 264 entries, ABRD to ZVEZ
Data columns (total 3 columns):
REGNUMBER    255 non-null object
LOTSIZE      264 non-null int64
SHORTNAME    264 non-null object
dtypes: int64(1), object(2)
memory usage: 8.2+ KB

Metadata

Release files for apimoex 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apimoex 1.5.0
File Size Uploaded Provenance
apimoex-1.5.0.tar.gz 40.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for apimoex 1.5.0
File Interpreter ABI Platform
apimoex-1.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 52.1 kB

Release files / apimoex-1.5.0.tar.gz

Download URL apimoex-1.5.0.tar.gz
Size 40.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e39fb4c6b970a13a046d26c99f91cbae715e4a4f8d03c7ea588af6505defe443
BLAKE2b-256 checksum
How to use checksums
e792ecd71d4d1a74cc50850cf84ef9d1d4200adf1247df7ea8009a9d888cf173
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / apimoex-1.5.0-py3-none-any.whl

Download URL apimoex-1.5.0-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6cc01ea71999a9618a619a8ef5b2b11c73d861e4d8bb1036ca6a0787abcd54b3
BLAKE2b-256 checksum
How to use checksums
a33ac8e13225d018853269816f944730ea15927c77d10fe5b568f02f0fb854e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for apimoex 1.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page