Skip to content

Add synthetic OHLCV data generator for testing (closes #70) - #363

Open
Dhiyaahaq33 wants to merge 3 commits into
AI4Finance-Foundation:masterfrom
Dhiyaahaq33:feat/synthetic-data-generator
Open

Add synthetic OHLCV data generator for testing (closes #70)#363
Dhiyaahaq33 wants to merge 3 commits into
AI4Finance-Foundation:masterfrom
Dhiyaahaq33:feat/synthetic-data-generator

Conversation

@Dhiyaahaq33

Copy link
Copy Markdown

Summary

Implements the suggestion in #70: a synthetic price series generator to use as a helper/environment data source for quickly testing agents/environments, or for pre-training on idealized patterns before real market data.

  • Adds meta/data_processors/synthetic.py with generate_synthetic_data() (and the underlying SyntheticDataGenerator class), producing OHLCV data in FinRL-Meta's standard schema (tic, time, open, high, low, close, adjusted_close, volume).
  • Supports three patterns as requested in the issue: sine (sine wave), trend (linear drift), and random_walk (Gaussian random walk), each with configurable noise (noise_std), amplitude/step size, and a seed for reproducibility.
  • No network access or API keys required — fully offline/deterministic given a seed.
  • Adds unit_tests/test_synthetic.py (8 tests, all passing locally): schema validation, multi-ticker independence, seed reproducibility, trend direction, and error handling for unknown patterns / unsupported time intervals.
  • Adds a short "Synthetic data for testing" section to the README with a usage example, right after the Supported Data Sources table.

Kept this as a standalone, self-contained module rather than wiring it into the DataSource enum / _Base download machinery, to keep the change small and non-invasive — happy to extend it to full DataProcessor integration in a follow-up if maintainers prefer that shape.

Test plan

Closes #70

Dhiyaahaq33 and others added 3 commits July 19, 2026 10:30
)

Adds meta/data_processors/synthetic.py providing generate_synthetic_data(),
which produces idealized price series (sine wave, trend, random walk) in
the standard OHLCV schema, with no network access or API keys required.
Useful for quickly testing/debugging environments and agents, or for
pre-training on simple patterns before real market data, as suggested in AI4Finance-Foundation#70.

Includes unit tests (unit_tests/test_synthetic.py, 8 passing) and a short
README section with usage example.
The module-level triple-quoted docstring immediately followed by imports
caused reorder-python-imports and black to disagree indefinitely on
whether a blank line belongs there. Switched to a comment header, which
is stable under both hooks (verified idempotent across repeated runs).
@Dhiyaahaq33

Copy link
Copy Markdown
Author

Note on the failing `pre-commit.ci` check: it isn't related to the files in this PR. Looking at the run log, the failures are all in pre-existing files unrelated to this change — ~29 files with a latent reorder-python-imports/black disagreement over blank lines after module docstrings, plus a real syntax error in meta/env_stock_trading/env_mintrades_stocktrading.py (Cannot parse: 44:8) that breaks black repo-wide. Neither meta/data_processors/synthetic.py nor unit_tests/test_synthetic.py appear in the reformatted/failed file list — this PR's own files pass all hooks cleanly when run in isolation. Happy to help clean up that pre-existing debt in a separate PR if useful, but wanted to flag it's out of scope here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Suggestion] Synthetic series for first "games" and / or testing

1 participant