Skip to main content

Implements high-frequency financial econometrics tools.

Project description

Table of Contents

  1. HFFE: High-Frequency Financial Econometrics
  2. Under development

HFFE: High-Frequency Financial Econometrics

This package implements some tools of the high-frequency financial econometrics literature. The HFFE package provides a class Stock. This class can be used in two ways:

  1. Instantiate the class and provide stock data. The instance __init__ method will automatically compute geometric returns, realized and bipower variances, and separate diffusive from jump returns using the stock data supplied.
  2. Use the class methods by themselves as needed. All of the methods in Stock are static methods and can be used without instantiating the class.

The class can be instantiated via the default constructor by supplying an iterable containing prices (floats) and an iterable containing date stamps (in the format YYYYMMDD for year, month and day). The default constructor also takes an optional iterable containing time stamps (in the format HHMM for hour and minute). The data is assumed to be rectangular, meaning that each day contains the same number of price observations.

Prices are assumed to be observed (N) times per day, at the same discrete intervals. For example, if prices are sampled every 5 minutes starting from 9:30 AM and finishing at 4:00 PM, then we will have (N=79) price observations per day. Prices are assumed to be observed for (T) total days. In each of these (T) days we have (N) price observations. Geometric returns (log-returns) are computed for each of the days and for each of the discrete sampling intervals. However, overnight returns are not considered, and the packaged only focuses on the analysis of intraday returns. If there are (N=79) price observations each day, then we will have (n=78) returns each day.

Example:

from hffe import Stock
from random import normalvariate as randn
# generate some fake data
prices = np.array([10.0 + randn(0, 1) for _ in range(10)])
dates = ['20181112']*len(prices)
times = [f'093{i}' for i in range(10)]
# instantiate class
stock = Stock(prices, dates, times)
# at this point we can access the returns, variance measures and
# obtain the diffusive returns separated from the jump returns
print(f'Number of prices per day: {stock.total["prices"]}\n'
  f'Number of days: {stock.total["days"]}')
print(stock.returns)
# print measures of variance
print(f'Realized Variance: {stock.RV}\n'
  f'Annualized Realized Variance: {(252*stock.RV)**0.5}\n'
  f'Bipower Variance: {stock.BV}\n'
  f'Annualized Bipower Variance: {(252*stock.BV)**0.5}')

Under development

  • Add citation to getRV function
  • Add citation to getBV function
  • Add citation to getTOD function
  • Add citation to separateReturns function

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

hffe-0.0.5.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hffe-0.0.5-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file hffe-0.0.5.tar.gz.

File metadata

  • Download URL: hffe-0.0.5.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for hffe-0.0.5.tar.gz
Algorithm Hash digest
SHA256 22245eb44d130419ab040ad407be9735981fac0839276cae5059c8e1f024ede4
MD5 86c47db36225dd63b02197ec8a098805
BLAKE2b-256 7cdda03e90fcec022c39dc123bd87820989946c034640dc79aa41db4038bef41

See more details on using hashes here.

File details

Details for the file hffe-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: hffe-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for hffe-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d3ff5be2930ba2588d0324ab0d0337c7191a9de648ceb05535813fe4c1f3bda3
MD5 851a2f5ebc0a5c00b38534ff2bf9f032
BLAKE2b-256 5949e50cd978e5bdaf9676c579d0f24c5974bdcbe6ceb56d2da01c93d5dd1c56

See more details on using hashes here.

Supported by

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