From 4b1cd4d602f4a02b604d7a521f85b1384ab33293 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Sun, 30 Jun 2019 23:39:02 +0800 Subject: [PATCH] [Mod] change working path when MainEngine created --- vnpy/trader/engine.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vnpy/trader/engine.py b/vnpy/trader/engine.py index 3aa882b0..79fa1634 100644 --- a/vnpy/trader/engine.py +++ b/vnpy/trader/engine.py @@ -3,6 +3,7 @@ import logging import smtplib +import os from abc import ABC from datetime import datetime from email.message import EmailMessage @@ -30,7 +31,7 @@ from .object import ( HistoryRequest ) from .setting import SETTINGS -from .utility import get_folder_path +from .utility import get_folder_path, TRADER_DIR class MainEngine: @@ -51,7 +52,8 @@ class MainEngine: self.apps = {} self.exchanges = [] - self.init_engines() + os.chdir(TRADER_DIR) # Change working directory + self.init_engines() # Initialize function engines def add_engine(self, engine_class: Any): """