Spaces:
Running
Running
|
Download utils/normalizer_integration.md from SKaush/forex-scanner: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/spaces/SKaush/forex-scanner/resolve/main/utils/normalizer_integration.md
- Command line
-
hf download hf://spaces/SKaush/forex-scanner/utils/normalizer_integration.md
-
curl -L -o normalizer_integration.md https://huggingface.co/spaces/SKaush/forex-scanner/resolve/main/utils/normalizer_integration.md
1.28 kB
| # How to integrate `normalizer.py` | |
| Save file to: | |
| ```python | |
| utils/normalizer.py | |
| ``` | |
| ## 1) In `ui/tabs/scanner_tab.py` | |
| Add: | |
| ```python | |
| from utils.normalizer import normalize_signal_payload, normalize_signal_list | |
| ``` | |
| ### Normalize right after scan results are built | |
| Example: | |
| ```python | |
| results = normalize_signal_list(results) | |
| compare_results = normalize_signal_list(compare_results) | |
| ``` | |
| ### Or normalize just before rendering: | |
| ```python | |
| for i, r in enumerate(results_to_render, start=1): | |
| r = normalize_signal_payload(r) | |
| render_signal_card(r, i) | |
| ``` | |
| --- | |
| ## 2) In `ui/tabs/pa_tab.py` | |
| Add: | |
| ```python | |
| from utils.normalizer import normalize_signal_payload, normalize_signal_list | |
| ``` | |
| ### Normalize PA results before sorting / rendering: | |
| ```python | |
| pa_results = normalize_signal_list(pa_results) | |
| ``` | |
| ### Or per-card: | |
| ```python | |
| for i, r in enumerate(filtered[:12], start=1): | |
| r = normalize_signal_payload(r) | |
| _render_pa_card(r, i) | |
| ``` | |
| --- | |
| ## 3) In audit integration | |
| You can also normalize before audit: | |
| ```python | |
| r = normalize_signal_payload(r) | |
| audit = audit_live_signal(r) # or audit_pa_signal(r) | |
| ``` | |
| --- | |
| ## 4) Best practice | |
| Normalize at the tab layer before: | |
| - sorting | |
| - summary tables | |
| - rendering cards | |
| - auditing | |
| This avoids mixed payload crashes everywhere. | |