fix(loaders): align fetch() signature with DataLoaderProtocol in 3 loaders#437
Closed
shadowinlife wants to merge 1 commit into
Closed
fix(loaders): align fetch() signature with DataLoaderProtocol in 3 loaders#437shadowinlife wants to merge 1 commit into
shadowinlife wants to merge 1 commit into
Conversation
…aders tushare, okx, and yfinance loaders defined fetch() with fields and interval as positional parameters in the wrong order, violating the DataLoaderProtocol contract which declares them keyword-only (after *). Add the * keyword-only separator and reorder to interval before fields, matching the Protocol and all 16 other compliant loaders. No behavioral change — all existing call sites use keyword arguments. Closes HKUDS#436 Signed-off-by: shadowinlife <shadowinlife@gmail.com>
warren618
added a commit
that referenced
this pull request
Jul 9, 2026
Fix Docker/server startup when mounted router-like routes do not expose path. Preserve the first CLI turn entered at the resume prompt, align loader fetch signatures, refresh Codex OAuth defaults, add Kimi for Coding and opencode-compatible provider mappings, and clean up Tushare reference fence typos. Fixes #450. Integrates #437, #448, #446, #435, #449, #444. Reported-by: Penn-Live Co-authored-by: shadowinlife <shadowinlife@gmail.com> Co-authored-by: morluto <williamlin1327@gmail.com> Co-authored-by: Carls <yxhuang@uibe.edu.cn> Co-authored-by: Sankalp Singh <iamsankz@gmail.com> Co-authored-by: flash1234pku <53250768+flash1234pku@users.noreply.github.com>
Collaborator
|
Thanks @shadowinlife. I integrated this loader signature fix into main in 04ccb21, with focused loader/backtest coverage passing. You are credited in the commit via Co-authored-by. Closing this PR because the equivalent change is now on main. |
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
Three data loaders (
tushare,okx,yfinance) definefetch()withfieldsandintervalas positional parameters in the wrong order, violating theDataLoaderProtocolcontract which declares them keyword-only (after*).Closes #436.
Changes
agent/backtest/loaders/tushare.py:67fetch(self, codes, start, end, fields=None, interval="1D")fetch(self, codes, start, end, *, interval="1D", fields=None)agent/backtest/loaders/okx.py:50agent/backtest/loaders/yfinance_loader.py:227Two fixes per signature:
*keyword-only separator — prevents positional misuseintervalbeforefields— matches Protocol definition and all 16 other compliant loadersImpact
interval/fieldsas positional args, so behavior is unchangedloader.fetch(codes, start, end, "1D")would silently pass"1D"asfieldson these 3 loaders but work correctly on the other 16@runtime_checkableProtocol check cannot catch parameter-ordering differences; this fix eliminates the divergence at the sourceTesting
test_tushare_loader.py: 55 passed, 4 skippedtest_registry.py: 23 passedtest_loader_retry_helpers.py+test_ohlc_validation.py+test_engine_robustness.py: 58 passedtest_local_loader.py+test_mootdx_loader.py+test_eastmoney_loader.py+test_stooq_loader.py+test_futu_loader.py: 76 passedrunner.py,benchmark.py,correlation.py,grounding.py,market_data.py,base.py,options_portfolio.py,ui_services.pyuse keyword arguments only