@ex-master/core
Advanced tools
Comparing version 0.3.17 to 0.3.18
@@ -168,3 +168,3 @@ "use strict"; | ||
let cacheKey = `get-market-price-from-kline-${stockKey}-${moneyKey}-${startOfMinuteTimestamp}`; | ||
let klineEntries = yield v.retry(() => this.spotClient.getKLine({ stock: stockKey, money: moneyKey }, timestamp, Date.now(), ONE_MINUTE_MILLISECONDS), { limit: 3, interval: 2000 }); | ||
let klineEntries = yield v.retry(() => this.spotClient.getKLine({ stock: stockKey, money: moneyKey }, timestamp, Date.now(), 5 * ONE_MINUTE_MILLISECONDS), { limit: 3, interval: 2000 }); | ||
if (!klineEntries || !klineEntries.length) { | ||
@@ -174,4 +174,4 @@ return undefined; | ||
let candleEntry = klineEntries[klineEntries.length - 1]; | ||
let close = candleEntry.close; | ||
let price = Number(close); | ||
let { open, close } = candleEntry; | ||
let price = (open + close) / 2; | ||
this.cache.set(cacheKey, price, 10 * 1000); | ||
@@ -178,0 +178,0 @@ return price; |
{ | ||
"name": "@ex-master/core", | ||
"version": "0.3.17", | ||
"version": "0.3.18", | ||
"main": "bld/library/index.js", | ||
@@ -27,3 +27,3 @@ "types": "bld/library/index.d.ts", | ||
}, | ||
"gitHead": "173b1bc1a3bbf1640ce3cc51624cc1182dd8e23f" | ||
"gitHead": "394850621a5aba487b292c7537d9281c22321a2c" | ||
} |
@@ -265,3 +265,3 @@ import {Cache} from '@ex-master/utilities/cache'; | ||
Date.now(), | ||
ONE_MINUTE_MILLISECONDS, | ||
5 * ONE_MINUTE_MILLISECONDS, | ||
), | ||
@@ -276,5 +276,5 @@ {limit: 3, interval: 2000}, | ||
let candleEntry = klineEntries[klineEntries.length - 1]; | ||
let close = candleEntry.close; | ||
let {open, close} = candleEntry; | ||
let price = Number(close); | ||
let price = (open + close) / 2; | ||
@@ -281,0 +281,0 @@ this.cache.set(cacheKey, price, 10 * 1000); |
Sorry, the diff of this file is not supported yet
62998