Skip to content

Commit 268171a

Browse files
authored
Merge pull request #25 from QuantStrategyLab/codex/fractional-step-precision
Allow platform fractional quantity steps
2 parents 08ed04a + 077de35 commit 268171a

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/quant_platform_kit/common/runtime_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def resolve_quantity_step_env(
6565
step_env: str,
6666
fractional_env: str,
6767
fractional_default: bool,
68+
fractional_step: float = 0.0001,
6869
) -> float:
6970
explicit_step = resolve_optional_float_env(env, step_env)
7071
if explicit_step is not None:
@@ -75,7 +76,7 @@ def resolve_quantity_step_env(
7576
if raw_enabled is None
7677
else resolve_bool_value(raw_enabled)
7778
)
78-
return 0.000001 if fractional_enabled else 1.0
79+
return float(fractional_step) if fractional_enabled else 1.0
7980

8081

8182
def resolve_strategy_config_path(

tests/test_runtime_config.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,17 @@ def test_common_runtime_config_helpers_normalize_basic_values(self) -> None:
4747
fractional_env="FRACTIONAL_ENABLED",
4848
fractional_default=False,
4949
),
50-
0.000001,
50+
0.0001,
51+
)
52+
self.assertEqual(
53+
resolve_quantity_step_env(
54+
env,
55+
step_env="MISSING_STEP",
56+
fractional_env="FRACTIONAL_ENABLED",
57+
fractional_default=False,
58+
fractional_step=0.001,
59+
),
60+
0.001,
5161
)
5262
self.assertEqual(
5363
resolve_quantity_step_env(

0 commit comments

Comments
 (0)