-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
122 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import shlex | ||
import subprocess | ||
import sys | ||
|
||
from QUANTAXIS.QAUtil.QALogs import QA_util_log_info | ||
|
||
|
||
def run_backtest(shell_cmd): | ||
shell_cmd = 'python "{}"'.format(shell_cmd) | ||
cmd = shlex.split(shell_cmd) | ||
p = subprocess.Popen( | ||
cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | ||
while p.poll() is None: | ||
line = p.stdout.readline() | ||
line = line.strip() | ||
if line: | ||
|
||
QA_util_log_info(line) | ||
#print('QUANTAXIS: [{}]'.format(line)) | ||
if p.returncode == 0: | ||
QA_util_log_info('backtest run success') | ||
|
||
else: | ||
QA_util_log_info('Subprogram failed') | ||
return p.returncode | ||
|
||
|
||
def run(): | ||
shell_cmd = sys.argv[1] | ||
print(shell_cmd) | ||
return run_backtest(shell_cmd) | ||
|
||
|
||
if __name__ == "__main__": | ||
print(run()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
import shlex | ||
import subprocess | ||
|
||
if __name__ == '__main__': | ||
shell_cmd = 'python "E:\\quantaxis\\EXAMPLE\\test_backtest\\simplebacktest.py"' | ||
cmd = shlex.split(shell_cmd) | ||
p = subprocess.Popen( | ||
cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | ||
while p.poll() is None: | ||
line = p.stdout.readline() | ||
line = line.strip() | ||
if line: | ||
print('Subprogram output: [{}]'.format(line)) | ||
if p.returncode == 0: | ||
print('Subprogram success') | ||
else: | ||
print('Subprogram failed') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters