Skip to content
This repository was archived by the owner on Feb 15, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ trade_result*
*_test
backtesting_*
generation_data_*
models/*.json
models/*.html
models/**/*.json
models/**/*.html
*.pyc
*.swp
temp.html
Expand Down
23 changes: 11 additions & 12 deletions commands/train.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ module.exports = function container (get, set, clear) {
}
if (!so.start_training && so.days_training) {
var d = tb('1d')
so.start_training = d.subtract(so.days_test).subtract(so.days_training).toMilliseconds()
}
if (so.days_test > 0) {
var d = tb('1d')
so.end_training = d.subtract(so.days_test).toMilliseconds()
so.start_training = d.subtract(so.days_training).toMilliseconds()
}
so.selector = get('lib.objectify-selector')(selector || c.selector)
so.mode = 'train'
Expand Down Expand Up @@ -232,8 +228,8 @@ module.exports = function container (get, set, clear) {
'--strategy', 'forex_analytics',
'--disable_options',
'--modelfile', path.resolve(__dirname, '..', tempModelFile),
'--start', so.start_training,
'--end', so.end_training,
'--start', moment(so.start_training).format('YYYYMMDDHHmm'),
'--end', moment(so.end_training).format('YYYYMMDDHHmm'),
'--period', so.period_length,
'--filename', path.resolve(__dirname, '..', tempModelFile) + '-simTrainingResult.html'
]
Expand All @@ -248,18 +244,21 @@ module.exports = function container (get, set, clear) {
var trainingResult = parseSimulation(path.resolve(__dirname, '..', tempModelFile) + '-simTrainingResult.html')

if (so.days_test > 0) {
console.log(
"\nRunning simulation on test data from "
+ moment(so.end_training).format('YYYY-MM-DD HH:mm:ss ZZ') + " onwards.\n"
var endTest = moment(so.end_training).add(so.days_test, 'days')

console.log("\nRunning simulation on test data from "
+ moment(so.end_training).format('YYYY-MM-DD HH:mm:ss ZZ') + " to "
+ moment(endTest).format('YYYY-MM-DD HH:mm:ss ZZ') + " (" + so.days_test + " days).\n"
)

var testArgs = [
'sim',
so.selector.normalized,
'--strategy', 'forex_analytics',
'--disable_options',
'--modelfile', path.resolve(__dirname, '..', tempModelFile),
'--start', so.end_training,
'--start', moment(so.end_training).format('YYYYMMDDHHmm'),
'--end', moment(endTest).format('YYYYMMDDHHmm'),
'--period', so.period_length,
'--filename', path.resolve(__dirname, '..', tempModelFile) + '-simTestResult.html',
]
Expand Down