40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import argparse
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
import _bootstrap # noqa: F401
|
||
|
|
from trader_training.dynamic_exit_search import search_dynamic_exit_plans
|
||
|
|
from trader_training.io_utils import add_common_args, setup_logging
|
||
|
|
|
||
|
|
|
||
|
|
def _float_tuple(value: str) -> tuple[float, ...]:
|
||
|
|
return tuple(float(item.strip()) for item in value.split(",") if item.strip())
|
||
|
|
|
||
|
|
|
||
|
|
def _int_tuple(value: str) -> tuple[int, ...]:
|
||
|
|
return tuple(int(item.strip()) for item in value.split(",") if item.strip())
|
||
|
|
|
||
|
|
|
||
|
|
def main() -> None:
|
||
|
|
parser = argparse.ArgumentParser()
|
||
|
|
add_common_args(parser)
|
||
|
|
parser.add_argument("--feature-path", type=Path)
|
||
|
|
parser.add_argument("--replay-path", type=Path)
|
||
|
|
parser.add_argument("--label-config-path", type=Path)
|
||
|
|
parser.add_argument("--cost-config-path", type=Path)
|
||
|
|
parser.add_argument("--horizons", type=_int_tuple)
|
||
|
|
parser.add_argument("--targets", type=_float_tuple)
|
||
|
|
parser.add_argument("--stops", type=_float_tuple)
|
||
|
|
parser.add_argument("--trailing-stops", type=_float_tuple)
|
||
|
|
parser.add_argument("--second-target-multipliers", type=_float_tuple)
|
||
|
|
parser.add_argument("--take1-ratios", type=_float_tuple)
|
||
|
|
parser.add_argument("--take2-ratios", type=_float_tuple)
|
||
|
|
args = parser.parse_args()
|
||
|
|
setup_logging()
|
||
|
|
search_dynamic_exit_plans(args)
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
main()
|