Add synthetic OHLCV data generator for testing (closes #70) - #363
Open
Dhiyaahaq33 wants to merge 3 commits into
Open
Add synthetic OHLCV data generator for testing (closes #70)#363Dhiyaahaq33 wants to merge 3 commits into
Dhiyaahaq33 wants to merge 3 commits into
Conversation
) 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.
for more information, see https://pre-commit.ci
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).
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
meta/data_processors/synthetic.pywithgenerate_synthetic_data()(and the underlyingSyntheticDataGeneratorclass), producing OHLCV data in FinRL-Meta's standard schema (tic, time, open, high, low, close, adjusted_close, volume).sine(sine wave),trend(linear drift), andrandom_walk(Gaussian random walk), each with configurable noise (noise_std), amplitude/step size, and aseedfor reproducibility.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.Kept this as a standalone, self-contained module rather than wiring it into the
DataSourceenum /_Basedownload machinery, to keep the change small and non-invasive — happy to extend it to fullDataProcessorintegration in a follow-up if maintainers prefer that shape.Test plan
python -m pytest unit_tests/test_synthetic.py -v— 8/8 passingclosestays positive across all three patternsCloses #70