Skip to content

Commit 4be45d2

Browse files
committed
Merge branch 'beta'
2 parents a13a0a2 + df02e99 commit 4be45d2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/botPage/bot/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default class Bot {
3333
constructor(api = null) {
3434
this.ticks = []
3535
this.candles = []
36-
this.candleInterval = 60
36+
this.currentCandleInterval = 0
3737
this.running = false
3838
this.currentToken = ''
3939
this.balanceStr = ''
@@ -83,9 +83,8 @@ export default class Bot {
8383
observer.unregisterAll('api.tick')
8484
promises.push(this.subscribeToTickHistory())
8585
promises.push(this.subscribeToCandles())
86-
} else if (this.tradeOption.candleInterval !== this.candleInterval) {
86+
} else if (this.tradeOption.candleInterval !== this.currentCandleInterval) {
8787
observer.unregisterAll('api.ohlc')
88-
this.candleInterval = this.tradeOption.candleInterval
8988
promises.push(this.subscribeToCandles())
9089
}
9190
}
@@ -124,7 +123,7 @@ export default class Bot {
124123
if (!_.isEmpty(this.tradeOption)) {
125124
this.pip = this.symbol.activeSymbols.getSymbols()[this.tradeOption.symbol.toLowerCase()].pip
126125
const opposites = config.opposites[this.tradeOption.condition]
127-
this.candleInterval = this.tradeOption.candleInterval
126+
this.currentCandleInterval = this.tradeOption.candleInterval
128127
this.tradeOptions = []
129128
for (const key of Object.keys(opposites)) {
130129
this.tradeOptions.push(decorateTradeOptions(this.tradeOption, {
@@ -153,6 +152,7 @@ export default class Bot {
153152
return new Promise((resolve) => {
154153
const apiCandles = (candles) => {
155154
this.observeOhlc()
155+
this.currentCandleInterval = this.tradeOption.candleInterval
156156
this.candles = candles
157157
resolve()
158158
}
@@ -164,7 +164,7 @@ export default class Bot {
164164
this.api.history(this.tradeOption.symbol, {
165165
end: 'latest',
166166
count: 600,
167-
granularity: this.candleInterval,
167+
granularity: this.tradeOption.candleInterval,
168168
style: 'candles',
169169
subscribe: 1,
170170
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy