Skip to content

Commit 6587aa2

Browse files
committed
Fix possible problem with Sampler
1 parent 0f41a25 commit 6587aa2

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/helpers/sampler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import se from './script_engine.js'
44

55
const DEF_LIMIT = 5 // default buff length
66

7-
export default function(T) {
7+
export default function(T, auto = false) {
88

99
// Define a TS type (part of the candle)
1010
let Ti = ['high', 'low', 'close', 'vol'].indexOf(T)
@@ -14,7 +14,7 @@ export default function(T) {
1414
let tf = this.__tf__
1515
let id = this.__id__
1616
t = t || se.t
17-
let val = x !== undefined ? x : se[T][0]
17+
let val = auto ? se[T][0] : x
1818
// TODO: closing at a specific time
1919
// (timezone, end of the month...)
2020
if (!this.__t0__ || t >= this.__t0__ + tf) {

src/helpers/symbol.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export default class Sym {
199199
}
200200

201201
if (sub.length || this.fillgaps === false) {
202-
var val = this.close.__fn__(sub)
202+
var val = this.close.__fn__(sub) // TODO: prob a bug
203203
} else if (this.fillgaps !== false) {
204204
val = this.close[0]
205205
}

src/helpers/symstd.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default {
2828
if (m[0] in se.tss) continue
2929
let ts = se.tss[m[0]] = TS(m[0], [])
3030
ts.__tf__ = u.tf_from_pair(m[2], m[3])
31-
ts.__fn__ = Sampler(m[1]).bind(ts)
31+
ts.__fn__ = Sampler(m[1], true).bind(ts)
3232
}
3333
} while (m)
3434

@@ -140,7 +140,7 @@ export default {
140140
if (sym in se.tss) continue
141141
let ts = se.tss[sym] = TS(sym, [])
142142
ts.__tf__ = u.tf_from_str(tf)
143-
ts.__fn__ = Sampler(type).bind(ts)
143+
ts.__fn__ = Sampler(type, true).bind(ts)
144144
}
145145
}
146146
}

0 commit comments

Comments
 (0)