Skip to main content

Standard financial data generation

Project description

finance datagen

Standard financial data generation

Build Status codecov License PyPI

Overview

finance-datagen produces synthetic financial time series for testing, demos, and benchmarking the rest of the finance-* stack without relying on real market data. The numerical core is implemented in Rust and emits Apache Arrow RecordBatch values; the Python layer wraps each generator so the public API returns polars.DataFrame objects.

Generators

Price models (Rust core)

Symbol Model Output columns
GBMGenerator Geometric Brownian Motion (log-Euler) timestamp, symbol, price
HestonGenerator Heston (1993) stochastic volatility (full-truncation Euler) timestamp, symbol, price, variance
GARCHGenerator GARCH(1,1) returns timestamp, symbol, price, return, sigma
ohlc_from_close OHLCV synthesis from any close series timestamp, symbol, open, high, low, close, volume

Cross-sectional panels (Python)

Symbol Output
generate_signal Long-form [date, symbol, signal, fwd_returns] with target Pearson IC
generate_factor_loadings Wide [symbol, market, value, momentum, size, quality] Barra-style loadings
generate_benchmark [date, benchmark] Gaussian benchmark return series

All Rust generators accept an optional seed: int for bit-reproducible output across platforms (ChaCha8 RNG); the cross-sectional generators accept a seed for numpy.random.default_rng.

Quick start

from finance_datagen import GBMGenerator, ohlc_from_close

closes = GBMGenerator(s0=100.0, mu=0.07, sigma=0.25, seed=0).generate()
bars   = ohlc_from_close(closes["price"], seed=0)

See the Data page for model math, parameter ranges, and output schemas, and the API page for a complete function-level reference.

Architecture

The Rust core (rust/src/) is polars-free: every generator builds an arrow_array::RecordBatch and returns it through the Arrow C Data Interface PyCapsule via pyo3-arrow. The Python wrappers call polars.from_arrow(batch) on the receiving end. This keeps the polars-rs and polars-py codebases on opposite sides of a stable ABI boundary, avoiding the binary-incompatibility issues that come with linking polars from both Rust and CPython.

[!NOTE] This library was generated using copier from the Base Python Project Template repository.

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

finance_datagen-0.1.0.tar.gz (33.5 kB view details)

Uploaded Source

Built Distributions

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

finance_datagen-0.1.0-cp310-abi3-win_amd64.whl (2.3 MB view details)

Uploaded CPython 3.10+Windows x86-64

finance_datagen-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

finance_datagen-0.1.0-cp310-abi3-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file finance_datagen-0.1.0.tar.gz.

File metadata

  • Download URL: finance_datagen-0.1.0.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for finance_datagen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ac5dc80e890e548ef7cfb213c5673299113c8c09fc221ba3bd14228949528683
MD5 e75a456e3b9115df8a0b245c14b2cb18
BLAKE2b-256 7df5211fb03b98f6d7e8e312786aef8478c3ef321ba4dedd122abeedc3705a25

See more details on using hashes here.

File details

Details for the file finance_datagen-0.1.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for finance_datagen-0.1.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3d7c4944523d40165426eb0306058ae548d5ebc7f6f51b5c40773a5d8cdf7477
MD5 469728ad9e36ce51945504599fc588b8
BLAKE2b-256 5a34fa80f81ac89b9cc5b995ec3cf4262ef0613982e7a97d8d8d5b5555aa9a6f

See more details on using hashes here.

File details

Details for the file finance_datagen-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for finance_datagen-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ed6bd67656ef9d5c5383ddaee0638bd297282095b42826ae582d4db42ed8f35d
MD5 4e7dee65efa7a7382f98f121b59c83d4
BLAKE2b-256 4ca4ad016f0ea930faed2bafe44a8bed7766ccfd5cd581ce5ca769e5dcdfc39a

See more details on using hashes here.

File details

Details for the file finance_datagen-0.1.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for finance_datagen-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 011fffe3643bce927b4c1e1983656996aab95b67bcd4fae4118651f2dade336c
MD5 e8d132230308b5471e9f60787dd1360d
BLAKE2b-256 31d8be6d55d443fd6413b26dc0a4f3620d74007b53c352417d6ca90167602413

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