天择加密量化开放框架下载
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.7 KiB

1 year ago
  1. # -*- coding: utf-8 -*-
  2. # tzquant
  3. import os
  4. import sys
  5. import time
  6. import numpy as np
  7. import pandas as pd
  8. from datetime import datetime
  9. sys.path.append(os.path.abspath('./tz_crypto'))
  10. from tz_ctastrategy import (
  11. BarData,
  12. CtaTemplate,
  13. OrderData,
  14. StopOrder,
  15. TickData,
  16. TradeData,
  17. )
  18. from tz_ctastrategy.backtesting import BacktestingEngine
  19. from tzquant.trader.utility import ArrayManager, BarGenerator, Interval
  20. import os
  21. import shutil
  22. # 定义要移动的目录列表
  23. directories_to_move = ['tz_ctastrategy', 'tzquant', 'tzqtdatahub', 'tz_riskmanager', 'gate_api']
  24. # 获取numpy模块的__file__属性,它包含了numpy模块文件的路径
  25. numpy_file_path = np.__file__
  26. # 使用os.path模块来获取numpy所在的目录
  27. numpy_dir = os.path.dirname(numpy_file_path)
  28. # 获取numpy所在目录的上层目录
  29. parent_dir = os.path.dirname(numpy_dir)
  30. # 打印上层目录,用于验证
  31. print("NumPy所在目录的上层目录是: ", parent_dir)
  32. # 确保parent_dir已经定义,并准备移动目录
  33. for directory in directories_to_move:
  34. # 构建源目录和目标目录的路径
  35. source_path = os.path.join(os.getcwd(), directory)
  36. target_path = os.path.join(parent_dir, directory)
  37. # 检查源目录是否存在
  38. if os.path.isdir(source_path):
  39. # 使用shutil.move来移动目录
  40. shutil.move(source_path, target_path)
  41. print(f"Moved {directory} to {target_path}")
  42. else:
  43. print(f"Directory {directory} does not exist in the current directory.")
  44. # 移动完成后,可以打印确认信息
  45. print("All directories have been moved to the parent directory of NumPy installation.")