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

bring the recent commits to master down into unstable #1048

Merged
merged 4 commits into from
Jan 5, 2018
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
2 changes: 1 addition & 1 deletion commands/sim.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ module.exports = function container (get, set, clear) {
var engine = get('lib.engine')(s)
if (!so.min_periods) so.min_periods = 1
var cursor, reversing, reverse_point
var query_start = so.start ? tb(so.start).resize(so.periodLength).subtract(so.min_periods + 2).toMilliseconds() : null
var query_start = so.start ? tb(so.start).resize(so.period_length).subtract(so.min_periods + 2).toMilliseconds() : null

function exitSim () {
console.log()
Expand Down
4 changes: 2 additions & 2 deletions commands/trade.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ module.exports = function container (get, set, clear) {
].join('') + '\n')
process.stdout.write([
z(15, (so.mode === 'paper' ? ' ' : (so.mode === 'live' && (so.manual === false || typeof so.manual === 'undefined')) ? ' ' + 'AUTO'.black.bgRed + ' ' : ' ' + 'MANUAL'.black.bgGreen + ' '), ' '),
z(13, so.periodLength, ' '),
z(13, so.period_length, ' '),
z(29, (so.order_type === 'maker' ? so.order_type.toUpperCase().green : so.order_type.toUpperCase().red), ' '),
z(31, (so.mode === 'paper' ? 'avg. '.grey + so.avg_slippage_pct + '%' : 'max '.grey + so.max_slippage_pct + '%'), ' '),
z(20, (so.order_type === 'maker' ? so.order_type + ' ' + s.exchange.makerFee : so.order_type + ' ' + s.exchange.takerFee), ' ')
Expand Down Expand Up @@ -338,7 +338,7 @@ module.exports = function container (get, set, clear) {
}

var db_cursor, trade_cursor
var query_start = tb().resize(so.periodLength).subtract(so.min_periods * 2).toMilliseconds()
var query_start = tb().resize(so.period_length).subtract(so.min_periods * 2).toMilliseconds()
var days = Math.ceil((new Date().getTime() - query_start) / 86400000)
var session = null
var sessions = get('db.sessions')
Expand Down
12 changes: 6 additions & 6 deletions commands/train.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ module.exports = function container (get, set, clear) {

if (!so.min_periods) so.min_periods = 1
var cursor, reversing, reverse_point
var query_start = so.start_training ? tb(so.start_training).resize(so.periodLength).subtract(so.min_periods + 2).toMilliseconds() : null
var query_start = so.start_training ? tb(so.start_training).resize(so.period_length).subtract(so.min_periods + 2).toMilliseconds() : null

function writeTempModel (strategy) {
var tempModelString = JSON.stringify(
{
"selector": so.selector.normalized,
"period": so.periodLength,
"period": so.period_length,
"start_training": moment(so.start_training),
"end_training": moment(so.end_training),
"options": fa_getTrainOptions(so),
Expand All @@ -159,7 +159,7 @@ module.exports = function container (get, set, clear) {
var finalModelString = JSON.stringify(
{
"selector": so.selector.normalized,
"period": so.periodLength,
"period": so.period_length,
"start_training": moment(so.start_training).utc(),
"end_training": moment(end_training).utc(),
"result_training": trainingResult,
Expand All @@ -172,7 +172,7 @@ module.exports = function container (get, set, clear) {
var testVsBuyHold = typeof(testResult) !== "undefined" ? testResult.vsBuyHold : 'noTest'

var finalModelFile = 'models/forex.model_' + so.selector.normalized
+ '_period=' + so.periodLength
+ '_period=' + so.period_length
+ '_from=' + moment(so.start_training).utc().format('YYYYMMDD_HHmmssZZ')
+ '_to=' + moment(end_training).utc().format('YYYYMMDD_HHmmssZZ')
+ '_trainingVsBuyHold=' + trainingResult.vsBuyHold
Expand Down Expand Up @@ -234,7 +234,7 @@ module.exports = function container (get, set, clear) {
'--modelfile', path.resolve(__dirname, '..', tempModelFile),
'--start', so.start_training,
'--end', so.end_training,
'--period', so.periodLength,
'--period', so.period_length,
'--filename', path.resolve(__dirname, '..', tempModelFile) + '-simTrainingResult.html'
]
var trainingSimulation = spawn(path.resolve(__dirname, '..', zenbot_cmd), trainingArgs, { stdio: 'inherit' })
Expand All @@ -260,7 +260,7 @@ module.exports = function container (get, set, clear) {
'--disable_options',
'--modelfile', path.resolve(__dirname, '..', tempModelFile),
'--start', so.end_training,
'--period', so.periodLength,
'--period', so.period_length,
'--filename', path.resolve(__dirname, '..', tempModelFile) + '-simTestResult.html',
]
var testSimulation = spawn(path.resolve(__dirname, '..', zenbot_cmd), testArgs, { stdio: 'inherit' })
Expand Down
4 changes: 2 additions & 2 deletions extensions/exchanges/binance/exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ module.exports = function container (get, set, clear) {
}
if (args.startTime && !args.endTime) {
// add 12 hours
args.endTime = args.startTime + 43200000
args.endTime = args.startTime + 3600000
}
else if (args.endTime && !args.startTime) {
// subtract 12 hours
args.startTime = args.endTime - 43200000
args.startTime = args.endTime - 3600000
}

var client = publicClient()
Expand Down
Loading