1
This commit is contained in:
parent
37b1dc682d
commit
bcaba42394
@ -71,12 +71,12 @@ class PositionManager:
|
||||
|
||||
# 使用自定义比例或默认比例
|
||||
ratios = custom_ratios or {
|
||||
'heavy': 0.30,
|
||||
'medium': 0.15,
|
||||
'light': 0.05
|
||||
'heavy': 0.18,
|
||||
'medium': 0.12,
|
||||
'light': 0.08
|
||||
}
|
||||
|
||||
size_ratio = ratios.get(position_size, 0.05)
|
||||
size_ratio = ratios.get(position_size, 0.08)
|
||||
|
||||
# 计算目标持仓价值
|
||||
target_position_value = available_position_value * size_ratio
|
||||
|
||||
@ -13,9 +13,9 @@ from app.utils.logger import logger
|
||||
|
||||
DEFAULT_POSITION_SIZE_MARGIN_PCTS: Dict[str, float] = {
|
||||
"micro": 0.01,
|
||||
"light": 0.03,
|
||||
"medium": 0.05,
|
||||
"heavy": 0.08,
|
||||
"light": 0.08,
|
||||
"medium": 0.12,
|
||||
"heavy": 0.18,
|
||||
}
|
||||
|
||||
DEFAULT_SIGNAL_POSITION_SIZE_BY_TIMEFRAME: Dict[str, str] = {
|
||||
|
||||
@ -103,7 +103,7 @@ def test_medium_term_defaults_to_light_margin_budget():
|
||||
|
||||
assert position_size == "light"
|
||||
assert grade == "B"
|
||||
assert target_pct == pytest.approx(0.03)
|
||||
assert target_pct == pytest.approx(0.08)
|
||||
|
||||
|
||||
def test_total_leverage_cap_is_converted_to_margin_cap():
|
||||
@ -115,7 +115,7 @@ def test_total_leverage_cap_is_converted_to_margin_cap():
|
||||
current_total_leverage=9.5,
|
||||
max_total_leverage=10,
|
||||
order_leverage=10,
|
||||
target_margin_pct=0.08,
|
||||
target_margin_pct=0.18,
|
||||
max_margin_pct=0.25,
|
||||
)
|
||||
|
||||
@ -146,5 +146,5 @@ def test_paper_dynamic_position_uses_equity_pct_instead_of_margin_multiple():
|
||||
grade="B",
|
||||
)
|
||||
|
||||
assert margin == pytest.approx(1000.0)
|
||||
assert position_value == pytest.approx(10000.0)
|
||||
assert margin == pytest.approx(2400.0)
|
||||
assert position_value == pytest.approx(24000.0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user