Commit 57ec0ef
Fix: don't downgrade map/factor-file provider based only on USA equity data (#653)
* fix: don't downgrade map/factor-file provider based only on USA equity data
`_handle_data_providers` downgraded the global `map-file-provider` (and
`factor-file-provider`) from the Zip provider to the Disk provider based
solely on the state of `equity/usa/map_files`. The provider is a single
global engine setting and the Disk provider silently ignores
`map_files_*.zip` archives, so a futures-only data folder (whose map
files ship only inside the zip) had its provider swapped out and
continuous futures never mapped (`Mapped: None`) with no error raised.
Gate the downgrade on every market's auxiliary folder instead of just
`equity/usa`: only fall back to the Disk provider when there is no recent
zip to lose for any market. Adds regression tests covering futures-only
data, loose-csv-only data, and stale-zip data.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* refactor: use datetime.min sentinel to drop None checks
Initialize newest_zip_date to datetime.min so the "no zip found" case
naturally falls through the >7-days-old downgrade check, removing both
explicit None checks.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* refactor: simplify provider gate, short-circuit on first recent zip, add debug logging
- Glob the auxiliary zips directly (*/*/<dir>/*.zip) instead of walking dirs/files.
- Return as soon as any market has a zip within the freshness window instead of
scanning all markets for the newest date (equivalent decision, fewer iterations).
- Hoist datetime.now() out of the loop.
- Add debug logs for both outcomes (which provider is used and why).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 5d12659 commit 57ec0ef
2 files changed
Lines changed: 100 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
466 | | - | |
| 466 | + | |
| 467 | + | |
467 | 468 | | |
468 | 469 | | |
469 | 470 | | |
470 | 471 | | |
471 | | - | |
| 472 | + | |
| 473 | + | |
472 | 474 | | |
473 | 475 | | |
474 | 476 | | |
| |||
838 | 840 | | |
839 | 841 | | |
840 | 842 | | |
841 | | - | |
| 843 | + | |
| 844 | + | |
842 | 845 | | |
843 | 846 | | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
844 | 855 | | |
845 | 856 | | |
846 | 857 | | |
847 | 858 | | |
848 | | - | |
| 859 | + | |
| 860 | + | |
849 | 861 | | |
850 | 862 | | |
851 | 863 | | |
852 | 864 | | |
853 | 865 | | |
854 | 866 | | |
855 | 867 | | |
856 | | - | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | | - | |
861 | | - | |
862 | | - | |
863 | | - | |
864 | | - | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
865 | 887 | | |
866 | 888 | | |
867 | 889 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
94 | 159 | | |
95 | 160 | | |
96 | 161 | | |
| |||
0 commit comments