Standard financial data generation
Project description
finance datagen
Standard financial data generation
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.
All public generator classes inherit from DataGenerator, a pydantic
base model that validates typed parameters on construction. Use
.generate() for the table output, or next(generator) for one-shot
iterator-style use. Convenience functions such as generate_prices(...),
generate_gbm(...), and generate_signal(...) instantiate the matching model
and return .generate().
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 |
Price-path convenience wrappers are also exported as generate_prices,
generate_gbm, generate_heston, and generate_garch. generate_prices is a
plain alias for generate_gbm for examples and tests that want a model-neutral
name.
Python generators
| Symbol | Output |
|---|---|
SignalGenerator |
Long-form [date, symbol, signal, fwd_returns] with target Pearson IC |
FactorLoadingsGenerator |
Wide [symbol, market, value, momentum, size, quality] Barra-style loadings |
BenchmarkGenerator |
[date, benchmark] Gaussian benchmark return series |
PositionsGenerator |
Long-form position panel [date, symbol, price, quantity, market_value, weight] |
TransactionsGenerator |
Transaction log with enum-backed side/position-effect labels and explicit costs |
OrdersGenerator |
Enum-backed order fixtures with side, order type, status, and time-in-force |
ExecutionsGenerator |
Enum-backed execution fixtures for simulated fills |
MultiAssetGBMGenerator |
Correlated multi-asset GBM panel [timestamp, symbol, price, return] |
RegimeSwitchingGenerator |
Markov regime-switching price path [timestamp, symbol, price, return, regime] |
MarketImpactCurveGenerator |
Participation-rate impact curves with temporary, permanent, and total impact in bps |
StatisticalRiskModelGenerator |
PCA-style factor loadings, factor returns, and specific variance |
FundamentalRiskModelGenerator |
Barra-style enum-backed sector/style loadings plus specific variance |
FactorCovarianceGenerator |
Symmetric positive semidefinite factor covariance matrix |
SpecificVarianceGenerator |
Positive idiosyncratic variance vector |
Every Python generator has a matching generate_* convenience wrapper,
including the legacy generate_signal, generate_factor_loadings, and
generate_benchmark functions.
All Rust generators accept an optional seed: int for bit-reproducible
output across platforms (ChaCha8 RNG); the Python generators accept a
seed for numpy.random.default_rng.
Portfolio, transaction, order, execution, and market-model generators
also support enum-backed metadata columns where applicable, including
currency, exchange, region, instrument_type, market_type, and
venue_type. Portfolio and transaction generators can use
finance-dates.Calendar exchange calendars so generated dates and
timestamps align with actual business days and session hours.
Quick start
from finance_datagen import OrdersGenerator, generate_prices, generate_signal, ohlc_from_close
closes = generate_prices(symbol="ACME", seed=0)
bars = ohlc_from_close(closes["price"], symbol="ACME", seed=0)
signal = generate_signal(n_dates=20, n_assets=50, seed=0)
orders = OrdersGenerator(n_dates=3, n_assets=5, orders_per_day=10, exchange="XNYS", currency="USD", seed=0).generate()
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.
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file finance_datagen-0.3.0.tar.gz.
File metadata
- Download URL: finance_datagen-0.3.0.tar.gz
- Upload date:
- Size: 45.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed7b1e4d80ae7400540896dc14c0a1950b51bdf9dfc6b8ae8627ddda053131f8
|
|
| MD5 |
ddd82a27ebe1b772d4f693b34345b5b9
|
|
| BLAKE2b-256 |
1d0e7dc61e46b7e83e7de2787020c67cb8a2f2f153027b9e048b8af74020d910
|
File details
Details for the file finance_datagen-0.3.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: finance_datagen-0.3.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf6a0177fe458567ba75ed38a5b92840a97424edd0ac962e70e0b2f76d91fcec
|
|
| MD5 |
3398bb92198159fa0f58071d04a65636
|
|
| BLAKE2b-256 |
47f8b32343e0ed04050c50c8d25d1a852ae16c6e9edf95b0bc8d0cfd2140b4c0
|
File details
Details for the file finance_datagen-0.3.0-cp310-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: finance_datagen-0.3.0-cp310-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ef3f41f5a4da9c4b1e2c16aad3c66306e3633d0f4d45d667c088568f8bfb837
|
|
| MD5 |
29837c63354b851f8651fefce27bcc69
|
|
| BLAKE2b-256 |
34d3c7dcd6a093a1d0a745312879307145d9d177a36bcc2b8cba942894afee53
|
File details
Details for the file finance_datagen-0.3.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: finance_datagen-0.3.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c81cf78c74bb054dc3c0a21a316c14872fee5e905467197e24c22a92e8a55ba4
|
|
| MD5 |
5611712e184dc9089e42fa875cb806d3
|
|
| BLAKE2b-256 |
76267d2f99012b5aef64f1c3a8b2563488b93811082344ea198c7bc1dabfcf54
|