@exodus/market-history 10.6.2 → 10.6.3

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,12 @@
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
+ ## [10.6.3](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/market-history@10.6.2...@exodus/market-history@10.6.3) (2026-04-08)
7
+
8
+ ### Bug Fixes
9
+
10
+ - fix(market-history): crop minute history to prevent unbounded growth (#15898)
11
+
6
12
  ## [10.6.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/market-history@10.6.1...@exodus/market-history@10.6.2) (2026-04-07)
7
13
 
8
14
  ### Bug Fixes
@@ -1,6 +1,8 @@
1
1
  import type { PriceData } from '../types.js';
2
- declare const cropHistory: ({ history, hourlyLimit, }: {
2
+ type CropStep = 'hour' | 'minute';
3
+ declare const cropHistory: ({ history, limit, step, }: {
3
4
  history: Map<number, PriceData>;
4
- hourlyLimit: number;
5
+ limit: number;
6
+ step: CropStep;
5
7
  }) => Map<number, PriceData>;
6
8
  export default cropHistory;
@@ -1,11 +1,15 @@
1
1
  import ms from 'ms';
2
2
  import lastTimestampFromPricesMap from './last-timestamp-from-prices-map.js';
3
- const hourMs = ms('1h');
4
- const cropHistory = ({ history, hourlyLimit, }) => {
3
+ const STEP_MS = {
4
+ hour: ms('1h'),
5
+ minute: ms('1m'),
6
+ };
7
+ const cropHistory = ({ history, limit, step, }) => {
8
+ const stepMs = STEP_MS[step];
5
9
  const lastCachedTime = lastTimestampFromPricesMap(history);
6
10
  if (!lastCachedTime)
7
11
  return history;
8
- const limitedTime = lastCachedTime - hourMs * hourlyLimit;
12
+ const limitedTime = lastCachedTime - stepMs * limit;
9
13
  const result = new Map();
10
14
  for (const [key, value] of history.entries()) {
11
15
  if (key > limitedTime) {
@@ -28,8 +28,11 @@ export default function processApiResponse({ assetTicker, fiatTicker, fetchedPri
28
28
  added++;
29
29
  }
30
30
  }
31
- if (granularity === 'hour' && !specificTimestamp && added > 0 && requestLimit) {
32
- history = cropHistory({ history, hourlyLimit: requestLimit });
31
+ if ((granularity === 'hour' || granularity === 'minute') &&
32
+ !specificTimestamp &&
33
+ added > 0 &&
34
+ requestLimit) {
35
+ history = cropHistory({ history, limit: requestLimit, step: granularity });
33
36
  }
34
37
  return history;
35
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/market-history",
3
- "version": "10.6.2",
3
+ "version": "10.6.3",
4
4
  "description": "Fetches historical prices for assets",
5
5
  "author": "Exodus Movement, Inc.",
6
6
  "license": "MIT",
@@ -61,5 +61,5 @@
61
61
  "access": "public",
62
62
  "provenance": false
63
63
  },
64
- "gitHead": "81d696384e63a90493e3e4b563ef60727f1b0db4"
64
+ "gitHead": "2c948759e38769a0d3a02916fd8b571e0c96e494"
65
65
  }