finec
Financial data and financial computation utilities.
Demo application
https://share.streamlit.io/epogrebnyak/finec/main
Installation
pip install git+https://github.com/epogrebnyak/finec.git
Moscow Exchange (MOEX)
Download Moscow Exchange (MOEX) data for stocks, bonds, currencies and indices as pandas dataframes, CSV or Excel files.
Stocks
from finec.moex import Stock, Index
# What stocks are part of IMOEX index?
Index("IMOEX").composition()
# General information about Aeroflot stock
Stock("AFLT").whoami()
# Ozon stock price history, all dates and columns
Stock("OZON").get_history()
# Yandex stock price, restricted by columns and start date
Stock("YNDX").get_history(columns=["TRADEDATE", "CLOSE"], start="2022-01-01")
# Get dividend history from https://github.com/WLM1ke/poptimizer
Stock("GMKN").get_dividend()
Bonds
from finec.moex import Bond
# Sistema 2027 bond price and yields from TQCB trading bord
Bond(ticker="RU000A0JXN21", board="TQCB").get_history()
# What data columns are provided for trading history?
Bond(ticker="RU000A101NJ6", board="TQIR").provided_columns()
Currencies
from finec.moex import Currency, CURRENCIES
# Tickers for usd, euro and yuan exchange rates
USDRUR = Currency(ticker='USD000UTSTOM', board='CETS')
EURRUR = Currency(ticker='EUR_RUB__TOM', board='CETS')
CNYRUR = Currency(ticker='CNYRUB_TOM', board='CETS')
# USDRUR exchange rate starting 2020
USDRUR.get_history(start="2020-01-01")
Lookup functions
from finec.moex import whoami, find, traded_boards
# General information about ticker
whoami("YNDX")
# What boards does a security trade at?
traded_boards("MTSS")
# Are there traded securities with *query_str* in description?
find(query_str="Челябинский", is_traded=True)
Engines, markets and boards
from finec.moex import get_engines, Engine, Market, Board
engines = get_engines()
print(engines)
e = Engine("forts")
e.markets()
m = Market(engine="stock", market="shares")
m.traded_boards()
b = Board(engine="stock", market="shares", board="TQBR")
# trading volumes by board
b.volumes()
# list securitites by board
b.securities()
# last trading day quotes by board
b.history()
Yield curves
from finec.yield_curve import YieldCurve, get_yields_from_cbr
y = YieldCurve("2022-09-28")
r1 = y.rate(t=1)
# 830.2383903307176
rs = get_yields_from_cbr("2022-09-28")
# {'0.25': 8.2, '0.50': 8.19, '0.75': 8.23, '1.00': 8.3, '2.00': 8.74, '3.00': 9.22, '5.00': 9.91,
# '7.00': 10.27, '10.00': 10.5, '15.00': 10.69, '20.00': 10.8, '30.00': 10.9}
More about MOEX data
References:
- MOEX API reference https://iss.moex.com/iss/reference/?lang=en
- Developper manual (2016) https://fs.moex.com/files/6523
Notes:
- MOEX is very generious to provide a lot of data for free and without any registration or tokens.
- MOEX API provided on "as is" basis and some parts are undocumented.
- June 2022: MOEX statistics server not available for queries from Google Colab or Github Actions:
- must use local installation for development
- all remote tests on CI fail
- streamlit cloud does not start
Aknowledgements
- We rely on
apimoex.ISSClientand expertise developped within apimoex project by @WLMike1. - Dividend history relayed from https://github.com/WLM1ke/poptimizer
Metadata
Release files for finec 0.1.10
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 |
|---|---|---|---|---|
| finec-0.1.10.tar.gz | 22.4 kB | Without provenance | Details for finec-0.1.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| finec-0.1.10-py3-none-any.whl | Python 3 | none | any | Details for finec-0.1.10-py3-none-any.whl |
Total release size: 45.0 kB
Release files / finec-0.1.10.tar.gz
| Download URL | finec-0.1.10.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6935f0d454ac6ebcb04b45f1f7a8da872a380907131166bd9fb76fb8e7947247
|
|
BLAKE2b-256 checksum How to use checksums |
0db386e46977596997a4bfcaa0a073ccce8ccb9f0e4cd3631f67617f7db3d2c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.8.5 Windows/10
|
Release files / finec-0.1.10-py3-none-any.whl
| Download URL | finec-0.1.10-py3-none-any.whl |
|---|---|
| Size | 22.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8d300e26a87537b4c0171b525320c8be984262bdea3f1dc2808559204ad5ec3
|
|
BLAKE2b-256 checksum How to use checksums |
e3b47718729b1dba522de5be2fd671f1a0fba19158944386e9ceef2fe4dbfa54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.8.5 Windows/10
|
Security for finec 0.1.10
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.