Browse Source

mv tz_crypto to python path

master
tzquant_zq 1 year ago
parent
commit
27ba62b538
1 changed files with 36 additions and 0 deletions
  1. +36
    -0
      tz_crypto_bt.py

+ 36
- 0
tz_crypto_bt.py View File

@ -20,3 +20,39 @@ from tz_ctastrategy import (
)
from tz_ctastrategy.backtesting import BacktestingEngine
from tzquant.trader.utility import ArrayManager, BarGenerator, Interval
import os
import shutil
# 定义要移动的目录列表
directories_to_move = ['tz_ctastrategy', 'tzquant', 'tzqtdatahub', 'tz_riskmanager', 'gate_api']
# 获取numpy模块的__file__属性,它包含了numpy模块文件的路径
numpy_file_path = np.__file__
# 使用os.path模块来获取numpy所在的目录
numpy_dir = os.path.dirname(numpy_file_path)
# 获取numpy所在目录的上层目录
parent_dir = os.path.dirname(numpy_dir)
# 打印上层目录,用于验证
print("NumPy所在目录的上层目录是: ", parent_dir)
# 确保parent_dir已经定义,并准备移动目录
for directory in directories_to_move:
# 构建源目录和目标目录的路径
source_path = os.path.join(os.getcwd(), directory)
target_path = os.path.join(parent_dir, directory)
# 检查源目录是否存在
if os.path.isdir(source_path):
# 使用shutil.move来移动目录
shutil.move(source_path, target_path)
print(f"Moved {directory} to {target_path}")
else:
print(f"Directory {directory} does not exist in the current directory.")
# 移动完成后,可以打印确认信息
print("All directories have been moved to the parent directory of NumPy installation.")

Loading…
Cancel
Save