@adaptic/utils 0.0.986 → 0.0.988
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 +111 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +111 -38
- package/dist/index.mjs.map +1 -1
- package/dist/test.js +4863 -0
- package/dist/test.js.map +1 -1
- package/dist/types/trading-policy/defaults/default-trading-policy.d.ts +16 -3
- package/dist/types/trading-policy/defaults/default-trading-policy.d.ts.map +1 -1
- package/dist/types/trading-policy/schemas/execution-prefs.schema.d.ts.map +1 -1
- package/dist/types/trading-policy/schemas/position-management-prefs.schema.d.ts.map +1 -1
- package/dist/types/trading-policy/schemas/risk-budget-prefs.schema.d.ts +10 -2
- package/dist/types/trading-policy/schemas/risk-budget-prefs.schema.d.ts.map +1 -1
- package/dist/types/trading-policy/schemas/signal-consumption-prefs.schema.d.ts +20 -4
- package/dist/types/trading-policy/schemas/signal-consumption-prefs.schema.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { type EffectiveTradingPolicy } from "../schemas/effective-policy.schema";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Default trading policy used as the baseline when no user-customized policy
|
|
4
|
+
* exists. Calibrated for short-horizon day trading / HFT-microstructuring /
|
|
5
|
+
* scalping (intraday holds, 5-min-bar-sized stops, fast cooldowns) per the
|
|
6
|
+
* 2026-05-10 audit, replacing the previous swing-trading calibration.
|
|
7
|
+
*
|
|
8
|
+
* All nested preference sub-objects are passed as empty objects so Zod applies
|
|
9
|
+
* their field-level defaults (which are themselves tuned for scalping in their
|
|
10
|
+
* respective schema files).
|
|
6
11
|
*
|
|
7
12
|
* Key choices:
|
|
8
13
|
* - Advisory-only autonomy (no autonomous execution)
|
|
@@ -11,6 +16,14 @@ import { type EffectiveTradingPolicy } from "../schemas/effective-policy.schema"
|
|
|
11
16
|
* - No shorting or margin (user must opt-in)
|
|
12
17
|
* - All protective overlays disabled (user must opt-in)
|
|
13
18
|
* - No LLM providers pre-configured
|
|
19
|
+
* - Tighter per-trade allocation (2% vs 5%) and concurrency (8 positions vs 20)
|
|
20
|
+
* reflecting the increased turnover and decreased per-position conviction
|
|
21
|
+
* characteristic of scalping
|
|
22
|
+
* - Faster equity wash-trade cooldown (5s vs 30s) — FINRA Rule 5210 governs
|
|
23
|
+
* opposing-side wash trades; same-side intraday re-entry can be much faster
|
|
24
|
+
* - Tighter daily-loss circuit breaker (2% vs 3%) reflecting that scalping
|
|
25
|
+
* strategies should fail fast rather than burn the day's risk budget on
|
|
26
|
+
* one bad regime
|
|
14
27
|
*/
|
|
15
28
|
export declare const DEFAULT_TRADING_POLICY: EffectiveTradingPolicy;
|
|
16
29
|
//# sourceMappingURL=default-trading-policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-trading-policy.d.ts","sourceRoot":"","sources":["../../../../src/trading-policy/defaults/default-trading-policy.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,oCAAoC,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"default-trading-policy.d.ts","sourceRoot":"","sources":["../../../../src/trading-policy/defaults/default-trading-policy.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,oCAAoC,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,sBAAsB,EAAE,sBA+DjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-prefs.schema.d.ts","sourceRoot":"","sources":["../../../../src/trading-policy/schemas/execution-prefs.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"execution-prefs.schema.d.ts","sourceRoot":"","sources":["../../../../src/trading-policy/schemas/execution-prefs.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCrC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyC,CAAC;AAE3E,0DAA0D;AAC1D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position-management-prefs.schema.d.ts","sourceRoot":"","sources":["../../../../src/trading-policy/schemas/position-management-prefs.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;;;;;;GAOG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"position-management-prefs.schema.d.ts","sourceRoot":"","sources":["../../../../src/trading-policy/schemas/position-management-prefs.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;;;;;;GAOG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoD9C,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GACO,CAAC;AAElD,oEAAoE;AACpE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC"}
|
|
@@ -28,7 +28,11 @@ export declare const RiskBudgetPrefsObjectSchema: z.ZodObject<{
|
|
|
28
28
|
weekendExposureCapPct: z.ZodDefault<z.ZodNumber>;
|
|
29
29
|
eventRiskExposureCapPct: z.ZodDefault<z.ZodNumber>;
|
|
30
30
|
gapRiskSensitivity: z.ZodDefault<z.ZodEnum<["low", "medium", "high"]>>;
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Per-trade equity allocation as % of account equity. Replaces legacy AlpacaAccount.tradeAllocationPct.
|
|
33
|
+
* Smaller per-trade size (2% vs 5%) for scalping — shorter holds + higher
|
|
34
|
+
* concurrency demand smaller per-position bets.
|
|
35
|
+
*/
|
|
32
36
|
perTradeAllocationPct: z.ZodDefault<z.ZodNumber>;
|
|
33
37
|
/** Per-trade crypto allocation as % of account equity. Replaces legacy AlpacaAccount.cryptoTradeAllocationPct. */
|
|
34
38
|
perTradeCryptoAllocationPct: z.ZodDefault<z.ZodNumber>;
|
|
@@ -112,7 +116,11 @@ export declare const RiskBudgetPrefsSchema: z.ZodDefault<z.ZodObject<{
|
|
|
112
116
|
weekendExposureCapPct: z.ZodDefault<z.ZodNumber>;
|
|
113
117
|
eventRiskExposureCapPct: z.ZodDefault<z.ZodNumber>;
|
|
114
118
|
gapRiskSensitivity: z.ZodDefault<z.ZodEnum<["low", "medium", "high"]>>;
|
|
115
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* Per-trade equity allocation as % of account equity. Replaces legacy AlpacaAccount.tradeAllocationPct.
|
|
121
|
+
* Smaller per-trade size (2% vs 5%) for scalping — shorter holds + higher
|
|
122
|
+
* concurrency demand smaller per-position bets.
|
|
123
|
+
*/
|
|
116
124
|
perTradeAllocationPct: z.ZodDefault<z.ZodNumber>;
|
|
117
125
|
/** Per-trade crypto allocation as % of account equity. Replaces legacy AlpacaAccount.cryptoTradeAllocationPct. */
|
|
118
126
|
perTradeCryptoAllocationPct: z.ZodDefault<z.ZodNumber>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"risk-budget-prefs.schema.d.ts","sourceRoot":"","sources":["../../../../src/trading-policy/schemas/risk-budget-prefs.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"risk-budget-prefs.schema.d.ts","sourceRoot":"","sources":["../../../../src/trading-policy/schemas/risk-budget-prefs.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;IA4BtC;;;;OAIG;;IAEH,kHAAkH;;IAGlH,+EAA+E;;IAE/E,wEAAwE;;IAExE,6FAA6F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE7F,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;IAjBhC;;;;OAIG;;IAEH,kHAAkH;;IAGlH,+EAA+E;;IAE/E,wEAAwE;;IAExE,6FAA6F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAInB,CAAC;AAE7E,4DAA4D;AAC5D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -57,9 +57,17 @@ export declare const SignalConsumptionPrefsObjectSchema: z.ZodObject<{
|
|
|
57
57
|
earningsBlackoutEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
58
58
|
earningsBlackoutHoursBefore: z.ZodDefault<z.ZodNumber>;
|
|
59
59
|
earningsBlackoutHoursAfter: z.ZodDefault<z.ZodNumber>;
|
|
60
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Minimum price movement % to qualify as a tradeable signal. Replaces legacy AlpacaAccount.minPercentageChange.
|
|
62
|
+
* Tighter intraday move filter (15bps vs 50bps) — scalping captures
|
|
63
|
+
* sub-percent moves that the swing-trading default would have ignored.
|
|
64
|
+
*/
|
|
61
65
|
minPercentageChange: z.ZodDefault<z.ZodNumber>;
|
|
62
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Minimum average daily volume to qualify a symbol for trading. Replaces legacy AlpacaAccount.volumeThreshold.
|
|
68
|
+
* Higher floor (100k vs 50k) — scalping requires consistent liquidity to
|
|
69
|
+
* keep slippage within the tightened maxSlippageTolerancePct (0.3%).
|
|
70
|
+
*/
|
|
63
71
|
volumeThreshold: z.ZodDefault<z.ZodNumber>;
|
|
64
72
|
}, "strip", z.ZodTypeAny, {
|
|
65
73
|
minPercentageChange: number;
|
|
@@ -180,9 +188,17 @@ export declare const SignalConsumptionPrefsSchema: z.ZodDefault<z.ZodObject<{
|
|
|
180
188
|
earningsBlackoutEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
181
189
|
earningsBlackoutHoursBefore: z.ZodDefault<z.ZodNumber>;
|
|
182
190
|
earningsBlackoutHoursAfter: z.ZodDefault<z.ZodNumber>;
|
|
183
|
-
/**
|
|
191
|
+
/**
|
|
192
|
+
* Minimum price movement % to qualify as a tradeable signal. Replaces legacy AlpacaAccount.minPercentageChange.
|
|
193
|
+
* Tighter intraday move filter (15bps vs 50bps) — scalping captures
|
|
194
|
+
* sub-percent moves that the swing-trading default would have ignored.
|
|
195
|
+
*/
|
|
184
196
|
minPercentageChange: z.ZodDefault<z.ZodNumber>;
|
|
185
|
-
/**
|
|
197
|
+
/**
|
|
198
|
+
* Minimum average daily volume to qualify a symbol for trading. Replaces legacy AlpacaAccount.volumeThreshold.
|
|
199
|
+
* Higher floor (100k vs 50k) — scalping requires consistent liquidity to
|
|
200
|
+
* keep slippage within the tightened maxSlippageTolerancePct (0.3%).
|
|
201
|
+
*/
|
|
186
202
|
volumeThreshold: z.ZodDefault<z.ZodNumber>;
|
|
187
203
|
}, "strip", z.ZodTypeAny, {
|
|
188
204
|
minPercentageChange: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal-consumption-prefs.schema.d.ts","sourceRoot":"","sources":["../../../../src/trading-policy/schemas/signal-consumption-prefs.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB;;;;;;;GAOG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"signal-consumption-prefs.schema.d.ts","sourceRoot":"","sources":["../../../../src/trading-policy/schemas/signal-consumption-prefs.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB;;;;;;;GAOG;AACH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqD7C;;;;OAIG;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAdvC;;;;OAIG;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAK2C,CAAC;AAEjD,mEAAmE;AACnE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptic/utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.988",
|
|
4
4
|
"author": "Adaptic.ai",
|
|
5
5
|
"description": "Utility functions used in Adaptic app and Lambda functions",
|
|
6
6
|
"always-build-npm": true,
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@adaptic/backend-legacy": "
|
|
41
|
+
"@adaptic/backend-legacy": "0.0.973",
|
|
42
42
|
"@adaptic/lumic-utils": "^1.0.15",
|
|
43
43
|
"@alpacahq/alpaca-trade-api": "^3.1.3",
|
|
44
44
|
"@apollo/client": "^3.13.8",
|