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