Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
Fix output location for the HTML dump (#1132)
Browse files Browse the repository at this point in the history
Trade results were saved in the simulations/ folder. To avoid confusion,
paper results are prefixed with "paper" (& still saved in simulations/).
  • Loading branch information
firepol authored and DeviaVir committed Jan 15, 2018
1 parent 6fa48f2 commit bcf8d4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ conf_*
!conf-sample.js
sim_result*
trade_result*
paper_result*
*_test
backtesting_*
generation_data_*
Expand Down
6 changes: 3 additions & 3 deletions commands/trade.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,16 @@ module.exports = function container (get, set, clear) {
.replace(/\{\{symbol\}\}/g, so.selector.normalized + ' - zenbot ' + require('../package.json').version)
if (so.filename !== 'none') {
var out_target

var out_target_prefix = so.paper ? 'simulations/paper_result_' : 'stats/trade_result_'
if(dump){
var dt = new Date().toISOString();

//ymd
var today = dt.slice(2, 4) + dt.slice(5, 7) + dt.slice(8, 10);
out_target = so.filename || 'simulations/trade_result_' + so.selector.normalized +'_' + today + '_UTC.html'
out_target = so.filename || out_target_prefix + so.selector.normalized +'_' + today + '_UTC.html'
fs.writeFileSync(out_target, out)
}else
out_target = so.filename || 'simulations/trade_result_' + so.selector.normalized +'_' + new Date().toISOString().replace(/T/, '_').replace(/\..+/, '').replace(/-/g, '').replace(/:/g, '').replace(/20/, '') + '_UTC.html'
out_target = so.filename || out_target_prefix + so.selector.normalized +'_' + new Date().toISOString().replace(/T/, '_').replace(/\..+/, '').replace(/-/g, '').replace(/:/g, '').replace(/20/, '') + '_UTC.html'

fs.writeFileSync(out_target, out)
console.log('\nwrote'.grey, out_target)
Expand Down

0 comments on commit bcf8d4a

Please sign in to comment.