MOEXAPI
Библиотека для парсинга данных MOEX
Install
Установить можно одним из способов:
pip install moexapigit clone https://github.com/kventinel/moexapi.git
Examples
Ticker
In [2]: moexapi.get_ticker('GAZP')
Out[2]: Ticker(secid='GAZP', alias='GAZP', is_traded=True, market=shares, shortname='ГАЗПРОМ ао', isin='RU0007661625', subtype=None, listlevel=1, boards=['TQBR', 'SMAL', 'SPEQ'], raw_price=166.15, price=166.15, accumulated_coupon=0, value=1198036323)
Candles
In [4]: moexapi.get_candles(moexapi.get_ticker('GAZP'), start_date=datetime.date(2023, 10, 2), end_date=datetime.date(2023, 10, 2))
Out[4]: [Candle(date=datetime.date(2023, 10, 2), low=165.51, high=168.86, open=167.83, close=166.08, mid_price=167.16, numtrades=117852, volume=24391830, value=4077382279.5)]
Bonds
get_history() returns History.accrued_interest from the historical ISS ACCINT column.
It is accrued coupon cash per security in History.currency (settlement
currency), not a percentage or a ruble conversion. Missing values remain None;
zero is a valid observation. Same-day board merges retain one matching value
and reject conflicting known values; if any merged observation is missing the
result is None. Split adjustments scale accrued cash with per-security prices.
In [5]: moexapi.Bond(moexapi.get_ticker('SU26238RMFS4'))
Out[5]: Bond(secid='SU26238RMFS4', shortname='ОФЗ 26238', amortization=[Amortization(date=datetime.date(2041, 5, 15), value=1000, initialfacevalue=1000)], coupons=[Coupon(date=2021-12-08, value=34.04), Coupon(date=2022-06-08, value=35.4), Coupon(date=2022-12-07, value=35.4), Coupon(date=2023-06-07, value=35.4), Coupon(date=2023-12-06, value=35.4), Coupon(date=2024-06-05, value=35.4), Coupon(date=2024-12-04, value=35.4), Coupon(date=2025-06-04, value=35.4), Coupon(date=2025-12-03, value=35.4), Coupon(date=2026-06-03, value=35.4), Coupon(date=2026-12-02, value=35.4), Coupon(date=2027-06-02, value=35.4), Coupon(date=2027-12-01, value=35.4), Coupon(date=2028-05-31, value=35.4), Coupon(date=2028-11-29, value=35.4), Coupon(date=2029-05-30, value=35.4), Coupon(date=2029-11-28, value=35.4), Coupon(date=2030-05-29, value=35.4), Coupon(date=2030-11-27, value=35.4), Coupon(date=2031-05-28, value=35.4), Coupon(date=2031-11-26, value=35.4), Coupon(date=2032-05-26, value=35.4), Coupon(date=2032-11-24, value=35.4), Coupon(date=2033-05-25, value=35.4), Coupon(date=2033-11-23, value=35.4), Coupon(date=2034-05-24, value=35.4), Coupon(date=2034-11-22, value=35.4), Coupon(date=2035-05-23, value=35.4), Coupon(date=2035-11-21, value=35.4), Coupon(date=2036-05-21, value=35.4), Coupon(date=2036-11-19, value=35.4), Coupon(date=2037-05-20, value=35.4), Coupon(date=2037-11-18, value=35.4), Coupon(date=2038-05-19, value=35.4), Coupon(date=2038-11-17, value=35.4), Coupon(date=2039-05-18, value=35.4), Coupon(date=2039-11-16, value=35.4), Coupon(date=2040-05-16, value=35.4), Coupon(date=2040-11-14, value=35.4), Coupon(date=2041-05-15, value=35.4)], offers=[])
Missing historical volume
For equity and currency history, absent/null VOLUME is estimated as
value / mid_price from the same historical board/day. Explicit values,
including zero, are preserved. Currency turnover uses VOLRUR in RUB.
The estimate requires finite nonnegative turnover and a finite positive price;
if turnover is also unavailable, volume remains None. Bond volume is not
estimated this way because bond prices are percentage-of-face-value quotes.
Recovery precedes board merging and split adjustments.
Unreported historical splits
Equity get_history() and get_candles() compare historical prices with daily
ISS candles to detect unreported splits and avoid double adjustments. Prices
and volumes are adjusted separately; turnover and trade counts are preserved.
This requires additional ISS requests. Missing or inconsistent reference data
does not trigger inferred adjustments. Manual overrides cover corporate actions
that cannot be inferred from prices, including split metadata and dividends.
Dividends from Smart-Lab
get_dividends(ticker) reads the public Smart-Lab calendar
for equity instruments; no API token or subscription is required. Each reporting-period
page is cached once per process/day and reused across tickers. Calendar periods
from 2003 through the current year are read because the period year is not the
record-date year, and retained earnings can be distributed later. Coverage is
sparse in early years; absence from this source is not independent proof that
an issuer paid no dividends.
Columns are matched by their headers, including the extra СД (board
recommendation) column. Status comes from the row: approved/recommended rows
are included, forecasts and cancelled rows are excluded even when returned
by is_approved=1. Only record dates through today are returned; Купить До
and Выплата До are not used as record dates. Decimal commas and spacing are
normalized, old/current ticker aliases are merged, and amounts supplied by
Smart-Lab are preserved without applying MOEX split factors a second time.
For example, the 2023-period page contains SBER's 33.3 RUB record on 2024-07-11.
Requests and malformed pages raise errors rather than becoming empty histories.
The obsolete ISS securities dividend endpoint is not used.
Metadata
Release files for moexapi 1.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| moexapi-1.8.0.tar.gz | 38.5 kB | Without provenance | Details for moexapi-1.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| moexapi-1.8.0-py3-none-any.whl | Python 3 | none | any | Details for moexapi-1.8.0-py3-none-any.whl |
Total release size: 63.8 kB
Release files / moexapi-1.8.0.tar.gz
| Download URL | moexapi-1.8.0.tar.gz |
|---|---|
| Size | 38.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c61eea7d3202f6a91637708ac88ca2e34e17127e0c5014fb9bce538350c8045c
|
|
BLAKE2b-256 checksum How to use checksums |
92d136359335008cdc7bf4aec1d13d3793b0e3f67b11f2dd9896f044e6aadb54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.5
|
Release files / moexapi-1.8.0-py3-none-any.whl
| Download URL | moexapi-1.8.0-py3-none-any.whl |
|---|---|
| Size | 25.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2c197bfce9ebe7d1f6da0cdb21bdf06493f7586f0cfab8bbf2b5eea376c55e0
|
|
BLAKE2b-256 checksum How to use checksums |
85b34fc9d4b6af85dd06df7bde3706a423e7bb2aba089e49a22c13544e263681
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.5
|
Security for moexapi 1.8.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.