fix bug
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -14,7 +14,7 @@ import config
|
||||
from libs.calc import trading_time
|
||||
from libs.market import market_allow_open
|
||||
from libs.signal import init_signals, SignalItem
|
||||
from libs.dataset import dataset_push
|
||||
from libs.collector import collector_push
|
||||
from sdk import Client
|
||||
from libs.grid_take_profit import GridTrailingTracker
|
||||
from .state import State
|
||||
@@ -37,7 +37,6 @@ def Overview(assets, positions, account_cfg=None) -> None:
|
||||
else:
|
||||
log.warning("[启动] 获取资金概览失败")
|
||||
|
||||
log.info("[启动] 持仓数量=%d", len(positions))
|
||||
for position in positions:
|
||||
if position.volume <= 0:
|
||||
continue
|
||||
@@ -131,7 +130,8 @@ def RunOnce(run: Runtime, signals:list[SignalItem]) -> None:
|
||||
(
|
||||
"数据提交",
|
||||
run.executor.submit(
|
||||
dataset_push,
|
||||
collector_push,
|
||||
run.account_cfg.account_id,
|
||||
assets,
|
||||
positions,
|
||||
),
|
||||
|
||||
@@ -14,7 +14,6 @@ import logging as log
|
||||
|
||||
def open_signal(run:Runtime, ticks, open_signals) -> None:
|
||||
"""逐个验证开仓信号并提交买入委托。"""
|
||||
log.info("[Open] 信号总数:%d", len(open_signals))
|
||||
for item in open_signals:
|
||||
# 1. 验证信号配置允许开仓的时间区间。
|
||||
signal_config = run.global_cfg.signals.get(item.signal_key)
|
||||
|
||||
@@ -47,7 +47,7 @@ def manage_positions(
|
||||
code = position.stock_code
|
||||
tick = ticks.get(code)
|
||||
if code in runtime.account_cfg.excluded_codes:
|
||||
log.info("[Position] 代码=%s,名称=%s,止盈=跳过,补仓=跳过,原因=已配置为排除股票", code, position.stock_name)
|
||||
log.info("[Position - ] 代码=%s,名称=%s,止盈=跳过,补仓=跳过,原因=已配置为排除股票", code, position.stock_name)
|
||||
continue
|
||||
if (
|
||||
not code
|
||||
@@ -56,7 +56,7 @@ def manage_positions(
|
||||
or tick is None
|
||||
or tick.last_price <= 0
|
||||
):
|
||||
log.warning("[Position] 代码=%s,名称=%s,止盈=跳过,补仓=跳过,原因=持仓或行情数据无效", code or "未知", position.stock_name)
|
||||
log.warning("[Position - ] 代码=%s,名称=%s,止盈=跳过,补仓=跳过,原因=持仓或行情数据无效", code or "未知", position.stock_name)
|
||||
continue
|
||||
|
||||
pnl_rate = round(
|
||||
@@ -86,10 +86,16 @@ def manage_positions(
|
||||
elif runtime.account_cfg.enable_loss_add_position:
|
||||
loss_add_action = "大盘信号不允许"
|
||||
|
||||
log.info(
|
||||
"[Position] 代码=%s,名称=%s,盈亏=%.2f%%,止盈=%s,补仓=%s",
|
||||
code, position.stock_name, pnl_rate, profit_action, loss_add_action,
|
||||
)
|
||||
if pnl_rate>=0:
|
||||
log.info(
|
||||
"[Position ↑ ] 代码=%s,名称=%s,盈亏=%.2f%%,止盈=%s,补仓=%s",
|
||||
code, position.stock_name, pnl_rate, profit_action, loss_add_action,
|
||||
)
|
||||
else:
|
||||
log.info(
|
||||
"[Position ↓ ] 代码=%s,名称=%s,盈亏=%.2f%%,止盈=%s,补仓=%s",
|
||||
code, position.stock_name, pnl_rate, profit_action, loss_add_action,
|
||||
)
|
||||
|
||||
|
||||
def handle_profit(
|
||||
|
||||
@@ -68,7 +68,7 @@ class DipWatch:
|
||||
|
||||
rebound = (price - watch.last_close) / watch.last_close * 100
|
||||
if rebound < self.rebound_threshold:
|
||||
log.debug(
|
||||
log.info(
|
||||
"[%s Watch] %s 等待反弹,收盘价=%.2f,现价=%.2f,反弹=%.2f%%,阈值=%.2f%%",
|
||||
tag,
|
||||
code,
|
||||
|
||||
Reference in New Issue
Block a user