feat: add optional market sentiment feature enrichment#1413
Open
alexander-schneider wants to merge 4 commits intoAI4Finance-Foundation:masterAI4Finance-Foundation/FinRL:masterfrom
alexander-schneider:codex/adanos-sentiment-featuresalexander-schneider/FinRL:codex/adanos-sentiment-featuresCopy head branch name to clipboard
Open
feat: add optional market sentiment feature enrichment#1413alexander-schneider wants to merge 4 commits intoAI4Finance-Foundation:masterAI4Finance-Foundation/FinRL:masterfrom alexander-schneider:codex/adanos-sentiment-featuresalexander-schneider/FinRL:codex/adanos-sentiment-featuresCopy head branch name to clipboard
alexander-schneider wants to merge 4 commits intoAI4Finance-Foundation:masterAI4Finance-Foundation/FinRL:masterfrom
alexander-schneider:codex/adanos-sentiment-featuresalexander-schneider/FinRL:codex/adanos-sentiment-featuresCopy head branch name to clipboard
Conversation
atharvajoshi01
left a comment
There was a problem hiding this comment.
The sentiment enrichment idea is useful but a couple of concerns:
-
The adanos_sentiment module adds a hard dependency on an external paid API. If ADANOS_API_KEY isn't set, does the pipeline still work cleanly? The example checks for it but the preprocessor module should handle the missing key gracefully at import time.
-
The lagged features approach is good for avoiding look-ahead bias. Worth documenting what lag values are used and why (e.g. t-1, t-2 to avoid data leakage).
Author
|
Thanks for the review. I pushed a small follow-up in
Validation run:
|
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
This PR adds an optional market sentiment feature enricher for existing OHLCV datasets.
It does not add a new price data source. Instead, it provides a small helper that merges structured, lagged sentiment features onto an existing FinRL dataframe so those features can be appended to
tech_indicator_listand used as part of the RL state.What is included
finrl.meta.preprocessor.adanos_sentiment.add_adanos_market_sentiment(...)Design choices
ADANOS_API_KEY, the helper is a no-op and returns the original dataframeExample features
The helper adds lagged aggregate and source-level features such as:
adanos_buzz_mean_lag1adanos_sentiment_mean_lag1adanos_source_coverage_lag1adanos_reddit_buzz_lag1adanos_x_buzz_lag1adanos_news_buzz_lag1adanos_polymarket_buzz_lag1Validation
Ran locally:
python3 -m pytest unit_tests/preprocessors/test_adanos_sentiment.py -qpython3 -m py_compile finrl/meta/preprocessor/adanos_sentiment.py examples/FinRL_StockTrading_2026_1_data_with_adanos.py unit_tests/preprocessors/test_adanos_sentiment.pygit diff --checkI also tried
python3 -m pytest unit_tests/preprocessors -q, but that currently fails in this environment because upstream tests importfinrltop-level and require optional dependencies such asgymnasiumduring collection.