Skip to main content

OM Quant Fin

The Outspoken Market is training the next quantitative generation. OM Quant Fin is a modern Python package for quantitative trading analysis. Our mission is to make your quant life easier and more accurate.

Project Structure

om_quant_fin/               # Root directory of the project
├── om_quant_fin/           # Python package containing the library's code
│   ├── __init__.py         # Marks the directory as a package and can contain package-level code or imports
│   └── om_quant_fin.py     # Contains library's functions
├── setup.py                # Provides package metadata and dependencies for packaging and distribution
├── .gitignore              # Lists files and folders that should not be tracked by Git
└── README.md               # Markdown file with a description of the project, usage instructions, and other information

What's new in version 1.1.0

  • OM Quant Fin now introduces the iFat! The iFat is a fantastic indicator for the measurement of the presence of fat tails. The closest to 0, fatter are the tails. Thin tails otherwise.
  • You also have a new function that create 27 attributes optimizide for the volatility estimation of any give asset. Apply the model methodology of choice into this attributes, evaluate it with the "regression_metrics" method and forecast the volatility with the "prediction_report" method.

OM Quant Fin Features

  • Download stock data from Yahoo Finance
  • Calculates rolling Z-scores
  • Calculates the rolling ratio of adjusted close and its mean (RSL indicator)
  • Evaluates a model with AUC and Gini for classification models and respective plots
  • QCut fit method for the proper binning of unseen data
  • Robustness test with bootstrapping
  • Calculates the Pain Index which is a measure of portfolio risk that takes into account both the depth and duration of drawdowns
  • Calculates the first ACF component for a given time series
  • Z-score function only (no rolling)
  • Z-score based on the median
  • Function to find the next business day given an input date
  • Mean Standard Deviation (MAD) Python implementation
  • iFat: fat tail index calculation
  • Function to create a data frame with 27 attributes for volatility estimation
  • Generates a report with main regression metrics: RMSE and MAE
  • Generates a report with predicted value and actions to take for a given volatility model

Installation

Install the library using pip:

pip install om_quant_fin

Some sample usage

import om_quant_fin as mql

#Download stock data:
  data = mql.download_data("AAPL", "2020-01-01", "2022-12-31")

#Calculates rolling Z-score:
  z_score = mql.rolling_z_score(data["Adj Close"], window = 20)

#Calculates rolling ratio:
  ratio = mql.rolling_ratio(data["Adj Close"], window = 20)

#Calculates returns:
  returns = mql.calculate_returns(data["Adj Close"], period = 1)

#Pain index
  window_size = 52 #rolling window for the pain index
  data["Pain_index"] = data["Adj Close"].rolling(window_size).apply(mql.pain_index, raw = True)
  mql.plot_pain_index(ticker1, data.index, data["Adj Close"], data["Pain_index"])

#Bootstrapping
  bs = mql.model_bs(model, x_train, y_train, x_test, y_test, n_iterations = 1000, range_bs = 0.1)
  mql.plot_bs(bs["accuracy_train"])
  mql.plot_bs(bs["accuracy_test"])

#qcut fit and transformer
labels = ["bin1", "bin2", "bin3", "bin4", "bin5", "bin6", "bin7", "bin8", "bin9", "bin10"
          ,"bin11", "bin12", "bin13", "bin14", "bin15", "bin16", "bin17", "bin18", "bin19", "bin20"]
qcut_transformer = mql.QCutTransformer(q = 20, labels = labels)
qcut_transformer.fit(data["column"])
qcut_transformer.transform(data["column"])

#Creates a data frame with 27 attributes for volatility estimation
start_date = = "2015-01-01" 
end_date = "2023-12-31"
data = create_vars("^VIX", start_date, end_date, p = 10):
data.head(5)

#Creates a data frame with 27 attributes for volatility estimation
start_date = = "2015-01-01" 
end_date = "2023-12-31"
data = create_vars("^VIX", start_date, end_date, p = 10):
data.head(5)

#Calculates the iFat
ifat, mstd = ifat(data["Returns"], p = 67)

License

This project is licensed under the MIT License.

Metadata

Release files for om-quant-fin 1.1.0

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

Source distribution (sdist)

Source distribution for om-quant-fin 1.1.0
File Size Uploaded Provenance Actions
om_quant_fin-1.1.0.tar.gz 10.1 kB Without provenance Details for om_quant_fin-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for om-quant-fin 1.1.0
File Interpreter ABI Platform Actions
om_quant_fin-1.1.0-py3-none-any.whl Python 3 none any Details for om_quant_fin-1.1.0-py3-none-any.whl

Total release size: 19.2 kB

Release files / om_quant_fin-1.1.0.tar.gz

Download URL om_quant_fin-1.1.0.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b99df46a1087d265e350c4f367301905d20f84757dad6d99000441b0b15833da
BLAKE2b-256 checksum
How to use checksums
9ed2f9d9303f5b5dcea0be49a83713564fb7b5666039998a06dc5ef0f4ff8ed7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / om_quant_fin-1.1.0-py3-none-any.whl

Download URL om_quant_fin-1.1.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0fd765cd9da204ffd627fba988ab32fae25812bb9517c7f707115ada947d1b32
BLAKE2b-256 checksum
How to use checksums
bb8d522113c20bf689abf26911675a9db3bd19f15fd0eeac6be47609c54dc72d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Security for om-quant-fin 1.1.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.

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