update data folder

This commit is contained in:
zhiyong 2025-05-10 22:55:57 +08:00
parent cd0a747646
commit f8821fe1ad
2 changed files with 5 additions and 1 deletions

View File

@ -22,6 +22,9 @@ class Config:
LOG_MAX_BYTES = 10 * 1024 * 1024 # 10MB
LOG_BACKUP_COUNT = 5
# strategy data
DATA_DIR = "../data"
# API Rate limiting
RATE_LIMIT_REQUESTS = 100
RATE_LIMIT_PERIOD = 60 # seconds

View File

@ -1,6 +1,7 @@
import os
import json
from logger_config import get_logger
from config import Config
from trade_constants import (
ORDER_DIRECTION_BUY,
ORDER_TYPE_LIMIT,
@ -29,7 +30,7 @@ class PositionManager:
self.positions: Dict[str, LocalPosition] = {} # {股票代码 -> LocalPosition}
# 待处理订单信息
self.pending_orders = {} # {order_id -> LocalOrder}
self.data_path = self.strategy_name + "_positions.json"
self.data_path = os.path.join(Config.DATA_DIR, self.strategy_name + "_positions.json")
self.load_data()
def update_position(self, code, direction, amount):