@exodus/market-history 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.1.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/market-history@3.0.1...@exodus/market-history@3.1.0) (2023-04-11)
7
+
8
+ ### Features
9
+
10
+ - don't call setCache when no changes ([#1166](https://github.com/ExodusMovement/exodus-hydra/issues/1166)) ([522ce5d](https://github.com/ExodusMovement/exodus-hydra/commit/522ce5d18b2b79c170f50a43d5020f55149b3c93))
11
+
12
+ ## [3.0.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/market-history@3.0.0...@exodus/market-history@3.0.1) (2023-03-23)
13
+
14
+ ### Bug Fixes
15
+
16
+ - market-history fetchPricesInterval usage ([#1008](https://github.com/ExodusMovement/exodus-hydra/issues/1008)) ([43a4b80](https://github.com/ExodusMovement/exodus-hydra/commit/43a4b803ed205edc41d65cfd6b3dd71e3c875221))
17
+
6
18
  ## [3.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/market-history@2.0.1...@exodus/market-history@3.0.0) (2023-02-20)
7
19
 
8
20
  ### ⚠ BREAKING CHANGES
package/module/index.js CHANGED
@@ -93,16 +93,19 @@ class MarketHistoryMonitor extends ExodusModule {
93
93
  #started = false
94
94
 
95
95
  #setCache = async ({ currency, granularity, pricesByAssetName }) => {
96
+ let hasChanges = false
96
97
  const changes = Object.keys(pricesByAssetName).reduce((acc, assetName) => {
97
98
  const key = this.#getCacheKey({ currency, assetName, granularity })
98
99
  const values = pricesByAssetName[assetName]
99
100
  if (values.length > 0) {
101
+ hasChanges = true
100
102
  acc[key] = values
101
103
  this.#runtimeCache.set(key, values)
102
104
  }
103
105
  return acc
104
106
  }, {})
105
107
 
108
+ if (!hasChanges) return
106
109
  await this.storage.batchSet(changes)
107
110
  }
108
111
 
@@ -292,14 +295,14 @@ class MarketHistoryMonitor extends ExodusModule {
292
295
  fetchPricesInterval({
293
296
  func: updateDayPrices,
294
297
  granularity: 'day',
295
- jitter,
298
+ getJitter: () => jitter,
296
299
  getCurrentTime,
297
300
  })
298
301
 
299
302
  fetchPricesInterval({
300
303
  func: updateHourPrices,
301
304
  granularity: 'hour',
302
- jitter,
305
+ getJitter: () => jitter,
303
306
  getCurrentTime,
304
307
  })
305
308
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/market-history",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "module to fetch historical prices for assets",
5
5
  "author": "Exodus Movement Inc",
6
6
  "license": "UNLICENSED",
@@ -33,5 +33,5 @@
33
33
  "peerDependencies": {
34
34
  "debug": ">= 3.0.0"
35
35
  },
36
- "gitHead": "ab579992241d791c18bd66f822e6e108e1c90107"
36
+ "gitHead": "6504aa18e7865e9de64f138ed2c07ed8a55186b8"
37
37
  }
package/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- let assetFromTickerCache = {}
1
+ const assetFromTickerCache = {}
2
2
  export const getAssetFromTicker = (assets, ticker) => {
3
3
  if (assetFromTickerCache[ticker]) return assetFromTickerCache[ticker]
4
4
  return Object.values(assets).find((asset) => {