@t2000/sdk 0.16.0 → 0.16.1
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/dist/index.cjs +8 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3097,15 +3097,14 @@ var StrategyManager = class {
|
|
|
3097
3097
|
}
|
|
3098
3098
|
}
|
|
3099
3099
|
validateMinAmount(allocations, totalUsd) {
|
|
3100
|
-
const
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
}
|
|
3100
|
+
const smallestPct = Math.min(...Object.values(allocations));
|
|
3101
|
+
const minRequired = Math.ceil(100 / smallestPct);
|
|
3102
|
+
if (totalUsd < minRequired) {
|
|
3103
|
+
const smallestAsset = Object.entries(allocations).find(([, p]) => p === smallestPct)?.[0] ?? "?";
|
|
3104
|
+
throw new T2000Error(
|
|
3105
|
+
"STRATEGY_MIN_AMOUNT",
|
|
3106
|
+
`Minimum $${minRequired} for this strategy (${smallestAsset} at ${smallestPct}% needs at least $1)`
|
|
3107
|
+
);
|
|
3109
3108
|
}
|
|
3110
3109
|
}
|
|
3111
3110
|
};
|