Skip to main content

Table of Contents

  1. HFFE: High-Frequency Financial Econometrics
    1. Introduction
    2. Stocks
    3. Options
    4. Under development
    5. Redo introduction
    6. Add examples on how to use stock.py
    7. Add examples on how to use options.py
    8. Change file stock.py to stocks.py
    9. Add citations
    10. Sample data
    11. [stock.py] Change internals to pandas dataframe
    12. [stock.py]
    13. [stock.py] Truncated variance estimator
    14. [stock.py] Local volatility estimator
    15. [stock.py] Confidence intervals

HFFE: High-Frequency Financial Econometrics

Introduction

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 or HHMMSS for hour, minute and second). 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}')

Stocks

Options

Under development

TODO Redo introduction

TODO Add examples on how to use stock.py

TODO Add examples on how to use options.py

TODO Change file stock.py to stocks.py

TODO Add citations

  1. TODO To volatility estimators

  2. TODO To jump threshold and separtion

  3. TODO To time-of-day factor

TODO Sample data

  1. TODO Sample stock data

  2. TODO Sample SPX options data

TODO [stock.py] Change internals to pandas dataframe

TODO [stock.py]

TODO [stock.py] Truncated variance estimator

TODO [stock.py] Local volatility estimator

TODO [stock.py] Confidence intervals

Metadata

Release files for hffe 0.0.13

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

Source distribution (sdist)

Source distribution for hffe 0.0.13
File Size Uploaded Provenance Actions
hffe-0.0.13.tar.gz 14.7 kB Without provenance Details for hffe-0.0.13.tar.gz

Built distribution (wheel)

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

Total release size: 43.4 kB

Release files / hffe-0.0.13.tar.gz

Download URL hffe-0.0.13.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
794191124fae440282255b18ba8dda2fae7e8a1655c903d4a47c0fc702d43b48
BLAKE2b-256 checksum
How to use checksums
b857f66c3d407934568c96617e08acbae6e930c73c1e7a474c49a2adbc77ccd4
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / hffe-0.0.13-py3-none-any.whl

Download URL hffe-0.0.13-py3-none-any.whl
Size 28.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57e81f922088ed52d08b391947aa47fa468377e6027a7bcb5ffff74e68461129
BLAKE2b-256 checksum
How to use checksums
87430f4a81d11da5ceda9707f15165ce79d17d19b516d31eef7cacd286ca50e1
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for hffe 0.0.13

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