Skip to main content

Computational finance from Finec MGIMO

Project description

Tests Finec version

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:

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

finec-0.1.10.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

finec-0.1.10-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file finec-0.1.10.tar.gz.

File metadata

  • Download URL: finec-0.1.10.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.8.5 Windows/10

File hashes

Hashes for finec-0.1.10.tar.gz
Algorithm Hash digest
SHA256 6935f0d454ac6ebcb04b45f1f7a8da872a380907131166bd9fb76fb8e7947247
MD5 1a3e13b40e9293ef8b8f0739c17cf53d
BLAKE2b-256 0db386e46977596997a4bfcaa0a073ccce8ccb9f0e4cd3631f67617f7db3d2c0

See more details on using hashes here.

File details

Details for the file finec-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: finec-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.8.5 Windows/10

File hashes

Hashes for finec-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 c8d300e26a87537b4c0171b525320c8be984262bdea3f1dc2808559204ad5ec3
MD5 fc17c38f7eaf321dd03a358d1ee96c9e
BLAKE2b-256 e3b47718729b1dba522de5be2fd671f1a0fba19158944386e9ceef2fe4dbfa54

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page