90 lines
2.2 KiB
Python
90 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Backward-compatible facade for the precheck workflow.
|
|
|
|
The reusable implementation now lives under ``coinhunter.services``.
|
|
Keep this module importable and executable so older entrypoints continue to work.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from importlib import import_module
|
|
|
|
from .services.precheck_service import run as _run_service
|
|
|
|
_CORE_EXPORTS = {
|
|
"PATHS",
|
|
"BASE_DIR",
|
|
"STATE_DIR",
|
|
"STATE_FILE",
|
|
"POSITIONS_FILE",
|
|
"CONFIG_FILE",
|
|
"ENV_FILE",
|
|
"BASE_PRICE_MOVE_TRIGGER_PCT",
|
|
"BASE_PNL_TRIGGER_PCT",
|
|
"BASE_PORTFOLIO_MOVE_TRIGGER_PCT",
|
|
"BASE_CANDIDATE_SCORE_TRIGGER_RATIO",
|
|
"BASE_FORCE_ANALYSIS_AFTER_MINUTES",
|
|
"BASE_COOLDOWN_MINUTES",
|
|
"TOP_CANDIDATES",
|
|
"MIN_ACTIONABLE_USDT",
|
|
"MIN_REAL_POSITION_VALUE_USDT",
|
|
"BLACKLIST",
|
|
"HARD_STOP_PCT",
|
|
"HARD_MOON_PCT",
|
|
"MIN_CHANGE_PCT",
|
|
"MAX_PRICE_CAP",
|
|
"HARD_REASON_DEDUP_MINUTES",
|
|
"MAX_PENDING_TRIGGER_MINUTES",
|
|
"MAX_RUN_REQUEST_MINUTES",
|
|
"utc_now",
|
|
"utc_iso",
|
|
"parse_ts",
|
|
"load_json",
|
|
"load_env",
|
|
"load_positions",
|
|
"load_state",
|
|
"load_config",
|
|
"clear_run_request_fields",
|
|
"sanitize_state_for_stale_triggers",
|
|
"save_state",
|
|
"stable_hash",
|
|
"get_exchange",
|
|
"fetch_ohlcv_batch",
|
|
"compute_ohlcv_metrics",
|
|
"enrich_candidates_and_positions",
|
|
"regime_from_pct",
|
|
"to_float",
|
|
"norm_symbol",
|
|
"get_local_now",
|
|
"session_label",
|
|
"top_candidates_from_tickers",
|
|
"build_snapshot",
|
|
"build_adaptive_profile",
|
|
"analyze_trigger",
|
|
"update_state_after_observation",
|
|
}
|
|
_STATE_EXPORTS = {"mark_run_requested", "ack_analysis"}
|
|
|
|
__all__ = sorted(_CORE_EXPORTS | _STATE_EXPORTS | {"main"})
|
|
|
|
|
|
def __getattr__(name: str):
|
|
if name in _CORE_EXPORTS:
|
|
return getattr(import_module(".services.precheck_core", __package__), name)
|
|
if name in _STATE_EXPORTS:
|
|
return getattr(import_module(".services.precheck_state", __package__), name)
|
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
|
|
|
|
def __dir__():
|
|
return sorted(set(globals()) | set(__all__))
|
|
|
|
|
|
def main():
|
|
return _run_service(sys.argv[1:])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|