@adaptic/backend 0.0.1055 → 0.0.1057

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.
Files changed (199) hide show
  1. package/Account.cjs +14 -0
  2. package/AccountLinkingRequest.cjs +14 -0
  3. package/AccountRiskMetrics.cjs +11 -0
  4. package/AdaConversation.cjs +14 -0
  5. package/Alert.cjs +11 -0
  6. package/Allocation.cjs +11 -0
  7. package/AlpacaAccount.cjs +36 -0
  8. package/Authenticator.cjs +14 -0
  9. package/AutoFollowRule.cjs +14 -0
  10. package/BrokerageAccount.cjs +11 -0
  11. package/Customer.cjs +14 -0
  12. package/DeskDecision.cjs +11 -0
  13. package/FeatureFlagOverride.cjs +14 -0
  14. package/Follow.cjs +14 -0
  15. package/Fund.cjs +56 -0
  16. package/FundAssignment.cjs +14 -0
  17. package/Investor.cjs +14 -0
  18. package/LinkedProvider.cjs +14 -0
  19. package/LlmConfiguration.cjs +14 -0
  20. package/Mandate.cjs +14 -0
  21. package/MandateApproval.cjs +14 -0
  22. package/MandateVersion.cjs +14 -0
  23. package/NotificationDelivery.cjs +14 -0
  24. package/NotificationPreference.cjs +14 -0
  25. package/OrgMembership.cjs +14 -0
  26. package/PolicyOverlay.cjs +64 -0
  27. package/PushSubscription.cjs +14 -0
  28. package/RiskEscalationEvent.cjs +33 -0
  29. package/Session.cjs +14 -0
  30. package/Strategy.cjs +28 -0
  31. package/StrategyHealthSnapshot.cjs +11 -0
  32. package/StrategySubscription.cjs +11 -0
  33. package/TradingPolicy.cjs +6 -0
  34. package/User.cjs +11 -0
  35. package/UserTotp.cjs +14 -0
  36. package/WaitlistEntry.cjs +14 -0
  37. package/esm/Account.mjs +14 -0
  38. package/esm/AccountLinkingRequest.mjs +14 -0
  39. package/esm/AccountRiskMetrics.mjs +11 -0
  40. package/esm/AdaConversation.mjs +14 -0
  41. package/esm/Alert.mjs +11 -0
  42. package/esm/Allocation.mjs +11 -0
  43. package/esm/AlpacaAccount.mjs +36 -0
  44. package/esm/Authenticator.mjs +14 -0
  45. package/esm/AutoFollowRule.mjs +14 -0
  46. package/esm/BrokerageAccount.mjs +11 -0
  47. package/esm/Customer.mjs +14 -0
  48. package/esm/DeskDecision.mjs +11 -0
  49. package/esm/FeatureFlagOverride.mjs +14 -0
  50. package/esm/Follow.mjs +14 -0
  51. package/esm/Fund.mjs +56 -0
  52. package/esm/FundAssignment.mjs +14 -0
  53. package/esm/Investor.mjs +14 -0
  54. package/esm/LinkedProvider.mjs +14 -0
  55. package/esm/LlmConfiguration.mjs +14 -0
  56. package/esm/Mandate.mjs +14 -0
  57. package/esm/MandateApproval.mjs +14 -0
  58. package/esm/MandateVersion.mjs +14 -0
  59. package/esm/NotificationDelivery.mjs +14 -0
  60. package/esm/NotificationPreference.mjs +14 -0
  61. package/esm/OrgMembership.mjs +14 -0
  62. package/esm/PolicyOverlay.mjs +64 -0
  63. package/esm/PushSubscription.mjs +14 -0
  64. package/esm/RiskEscalationEvent.mjs +33 -0
  65. package/esm/Session.mjs +14 -0
  66. package/esm/Strategy.mjs +28 -0
  67. package/esm/StrategyHealthSnapshot.mjs +11 -0
  68. package/esm/StrategySubscription.mjs +11 -0
  69. package/esm/TradingPolicy.mjs +6 -0
  70. package/esm/User.mjs +11 -0
  71. package/esm/UserTotp.mjs +14 -0
  72. package/esm/WaitlistEntry.mjs +14 -0
  73. package/esm/auth/membership-write-authority.d.ts +110 -0
  74. package/esm/auth/membership-write-authority.mjs +125 -0
  75. package/esm/auth/mutation-authorization.d.ts +19 -3
  76. package/esm/auth/mutation-authorization.mjs +21 -2
  77. package/esm/auth/nested-write-policy.d.ts +4 -0
  78. package/esm/auth/nested-write-policy.mjs +19 -0
  79. package/esm/auth/tenancy-scope.d.ts +2 -1
  80. package/esm/auth/tenancy-scope.mjs +2 -1
  81. package/esm/generated/typeStrings/PolicyOverlay.d.ts +1 -1
  82. package/esm/generated/typeStrings/PolicyOverlay.mjs +18 -0
  83. package/esm/generated/typeStrings/TradingPolicy.d.ts +1 -1
  84. package/esm/generated/typeStrings/TradingPolicy.mjs +18 -0
  85. package/esm/generated/typeStrings/index.d.ts +2 -2
  86. package/esm/generated/typegraphql-prisma/enhance.mjs +18 -18
  87. package/esm/generated/typegraphql-prisma/enums/TradingPolicyScalarFieldEnum.d.ts +1 -0
  88. package/esm/generated/typegraphql-prisma/enums/TradingPolicyScalarFieldEnum.mjs +1 -0
  89. package/esm/generated/typegraphql-prisma/models/TradingPolicy.d.ts +20 -0
  90. package/esm/generated/typegraphql-prisma/models/TradingPolicy.mjs +27 -0
  91. package/esm/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindFirstTradingPolicyArgs.d.ts +1 -1
  92. package/esm/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindFirstTradingPolicyOrThrowArgs.d.ts +1 -1
  93. package/esm/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindManyTradingPolicyArgs.d.ts +1 -1
  94. package/esm/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/GroupByTradingPolicyArgs.d.ts +1 -1
  95. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCountOrderByAggregateInput.d.ts +1 -0
  96. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCountOrderByAggregateInput.mjs +7 -0
  97. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateInput.d.ts +1 -0
  98. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateInput.mjs +7 -0
  99. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateManyInput.d.ts +1 -0
  100. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateManyInput.mjs +7 -0
  101. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutAlpacaAccountInput.d.ts +1 -0
  102. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutAlpacaAccountInput.mjs +7 -0
  103. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutOverlaysInput.d.ts +1 -0
  104. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutOverlaysInput.mjs +7 -0
  105. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithAggregationInput.d.ts +1 -0
  106. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithAggregationInput.mjs +7 -0
  107. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithRelationInput.d.ts +1 -0
  108. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithRelationInput.mjs +7 -0
  109. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyScalarWhereWithAggregatesInput.d.ts +1 -0
  110. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyScalarWhereWithAggregatesInput.mjs +7 -0
  111. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateInput.d.ts +1 -0
  112. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateInput.mjs +7 -0
  113. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateManyMutationInput.d.ts +1 -0
  114. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateManyMutationInput.mjs +7 -0
  115. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutAlpacaAccountInput.d.ts +1 -0
  116. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutAlpacaAccountInput.mjs +7 -0
  117. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutOverlaysInput.d.ts +1 -0
  118. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutOverlaysInput.mjs +7 -0
  119. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereInput.d.ts +1 -0
  120. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereInput.mjs +7 -0
  121. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereUniqueInput.d.ts +1 -0
  122. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereUniqueInput.mjs +7 -0
  123. package/esm/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradingPolicy.d.ts +1 -0
  124. package/esm/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradingPolicy.mjs +7 -0
  125. package/esm/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyCountAggregate.d.ts +1 -0
  126. package/esm/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyCountAggregate.mjs +7 -0
  127. package/esm/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyGroupBy.d.ts +1 -0
  128. package/esm/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyGroupBy.mjs +7 -0
  129. package/esm/index.d.ts +1 -0
  130. package/esm/index.mjs +2 -0
  131. package/esm/middleware/__tests__/mutation-auth-guard.harness.d.ts +2 -0
  132. package/esm/middleware/__tests__/mutation-auth-guard.harness.mjs +141 -10
  133. package/esm/middleware/mutation-account-facts.d.ts +3 -0
  134. package/esm/middleware/mutation-account-facts.mjs +2 -0
  135. package/esm/middleware/mutation-auth-guard.d.ts +4 -2
  136. package/esm/middleware/mutation-auth-guard.mjs +20 -2
  137. package/esm/middleware/mutation-membership-facts.d.ts +133 -0
  138. package/esm/middleware/mutation-membership-facts.mjs +271 -0
  139. package/esm/middleware/mutation-tenant-facts.d.ts +4 -2
  140. package/esm/middleware/mutation-tenant-facts.mjs +4 -2
  141. package/esm/middleware/trading-policy-audit.d.ts +16 -4
  142. package/esm/middleware/trading-policy-audit.mjs +40 -11
  143. package/esm/readers/index.d.ts +10 -0
  144. package/esm/readers/index.mjs +10 -0
  145. package/esm/readers/intraday-lane-prefs.d.ts +45 -0
  146. package/esm/readers/intraday-lane-prefs.mjs +71 -0
  147. package/esm/tests/trading-policy-lane-fields-roundtrip.harness.d.ts +14 -0
  148. package/esm/tests/trading-policy-lane-fields-roundtrip.harness.mjs +107 -0
  149. package/generated/typeStrings/PolicyOverlay.cjs +18 -0
  150. package/generated/typeStrings/PolicyOverlay.d.ts +1 -1
  151. package/generated/typeStrings/TradingPolicy.cjs +18 -0
  152. package/generated/typeStrings/TradingPolicy.d.ts +1 -1
  153. package/generated/typeStrings/index.d.ts +2 -2
  154. package/generated/typegraphql-prisma/enhance.cjs +18 -18
  155. package/generated/typegraphql-prisma/enums/TradingPolicyScalarFieldEnum.cjs +1 -0
  156. package/generated/typegraphql-prisma/enums/TradingPolicyScalarFieldEnum.d.ts +1 -0
  157. package/generated/typegraphql-prisma/models/TradingPolicy.cjs +7 -0
  158. package/generated/typegraphql-prisma/models/TradingPolicy.d.ts +20 -0
  159. package/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindFirstTradingPolicyArgs.d.ts +1 -1
  160. package/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindFirstTradingPolicyOrThrowArgs.d.ts +1 -1
  161. package/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindManyTradingPolicyArgs.d.ts +1 -1
  162. package/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/GroupByTradingPolicyArgs.d.ts +1 -1
  163. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCountOrderByAggregateInput.cjs +6 -0
  164. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCountOrderByAggregateInput.d.ts +1 -0
  165. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateInput.cjs +6 -0
  166. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateInput.d.ts +1 -0
  167. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateManyInput.cjs +6 -0
  168. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateManyInput.d.ts +1 -0
  169. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutAlpacaAccountInput.cjs +6 -0
  170. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutAlpacaAccountInput.d.ts +1 -0
  171. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutOverlaysInput.cjs +6 -0
  172. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutOverlaysInput.d.ts +1 -0
  173. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithAggregationInput.cjs +6 -0
  174. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithAggregationInput.d.ts +1 -0
  175. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithRelationInput.cjs +6 -0
  176. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithRelationInput.d.ts +1 -0
  177. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyScalarWhereWithAggregatesInput.cjs +6 -0
  178. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyScalarWhereWithAggregatesInput.d.ts +1 -0
  179. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateInput.cjs +6 -0
  180. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateInput.d.ts +1 -0
  181. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateManyMutationInput.cjs +6 -0
  182. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateManyMutationInput.d.ts +1 -0
  183. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutAlpacaAccountInput.cjs +6 -0
  184. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutAlpacaAccountInput.d.ts +1 -0
  185. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutOverlaysInput.cjs +6 -0
  186. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutOverlaysInput.d.ts +1 -0
  187. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereInput.cjs +6 -0
  188. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereInput.d.ts +1 -0
  189. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereUniqueInput.cjs +6 -0
  190. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereUniqueInput.d.ts +1 -0
  191. package/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradingPolicy.cjs +6 -0
  192. package/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradingPolicy.d.ts +1 -0
  193. package/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyCountAggregate.cjs +6 -0
  194. package/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyCountAggregate.d.ts +1 -0
  195. package/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyGroupBy.cjs +6 -0
  196. package/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyGroupBy.d.ts +1 -0
  197. package/index.cjs +2 -0
  198. package/index.d.ts +1 -0
  199. package/package.json +1 -1
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Exercises the TradingPolicy lane-preferences carrier against a real Postgres
3
+ * built from the migration history: a policy created without it reads back
4
+ * null (disarmed) through the generated GraphQL resolvers, a written value
5
+ * round-trips, it can be set to armed:false and cleared back to null, and the
6
+ * migration's own SQL runs down and up again inside a transaction that is
7
+ * rolled back, leaving the database as it was.
8
+ *
9
+ * Assembled like `desk-attribution-roundtrip.harness.ts`. Needs
10
+ * `LANE_IT_DATABASE_URL` pointing at a disposable migrated database. Output is
11
+ * printed between `<<<RESULTS>>>` and `<<<END>>>`; seeded rows are removed.
12
+ */
13
+ import 'reflect-metadata';
14
+ import { randomUUID } from 'node:crypto';
15
+ import { readFileSync } from 'node:fs';
16
+ import { join } from 'node:path';
17
+ import { PrismaClient } from '@prisma/client';
18
+ import { buildSchema } from 'type-graphql';
19
+ import { graphql } from 'graphql';
20
+ import { resolvers } from '../generated/typegraphql-prisma/index.mjs';
21
+ import { withoutServerOnlyResolvers, withoutServerOnlySchemaSurface, } from '../config/server-only-models.mjs';
22
+ const MIGRATION_SQL = join(__dirname, '..', '..', 'prisma', 'migrations', '20261121130000_trading_policy_lane_fields', 'migration.sql');
23
+ const DOWN_SQL = `ALTER TABLE "trading_policies" DROP COLUMN "intradayLanePrefs"`;
24
+ const LANE_COLUMNS = `('intradayLanePrefs')`;
25
+ const POLICY_FIELDS = 'id intradayLanePrefs maxOpenPositions';
26
+ /** Arms the seeded row inside the transaction, so the down limb has a value to drop. */
27
+ const ARM_ROW_SQL = `UPDATE trading_policies SET "intradayLanePrefs" = '{"armed": true}'::jsonb WHERE id = $1::uuid`;
28
+ /** Raised to roll the down/up transaction back once its snapshots are taken. */
29
+ class RollbackSignal extends Error {
30
+ }
31
+ async function run(schema, prisma, source, variableValues = {}) {
32
+ const result = await graphql({ schema, source, variableValues, contextValue: { prisma } });
33
+ return {
34
+ data: result.data ?? null,
35
+ errors: (result.errors ?? []).map((error) => error.message),
36
+ };
37
+ }
38
+ async function snapshot(tx, policyId) {
39
+ const columns = await tx.$queryRawUnsafe(`SELECT column_name, is_nullable, column_default FROM information_schema.columns
40
+ WHERE table_name = 'trading_policies' AND column_name IN ${LANE_COLUMNS} ORDER BY column_name`);
41
+ const rows = await tx.$queryRawUnsafe(`SELECT row_to_json(t) AS row FROM trading_policies t WHERE id = $1::uuid`, policyId);
42
+ return { columns, row: rows[0]?.row ?? null };
43
+ }
44
+ async function main() {
45
+ const url = process.env.LANE_IT_DATABASE_URL;
46
+ if (!url)
47
+ throw new Error('LANE_IT_DATABASE_URL is not set');
48
+ const prisma = new PrismaClient({ datasourceUrl: url });
49
+ const schema = withoutServerOnlySchemaSurface(await buildSchema({ resolvers: withoutServerOnlyResolvers(resolvers), validate: false }));
50
+ const tag = randomUUID().slice(0, 8);
51
+ const user = await prisma.user.create({ data: { email: `lane-${tag}@example.invalid` } });
52
+ const account = await prisma.alpacaAccount.create({
53
+ data: { userId: user.id, APIKey: `k-${tag}`, APISecret: `s-${tag}` },
54
+ });
55
+ const steps = {};
56
+ const downUp = {};
57
+ try {
58
+ steps.created = await run(schema, prisma, `mutation ($data: TradingPolicyCreateInput!) { createOneTradingPolicy(data: $data) { ${POLICY_FIELDS} } }`, { data: { alpacaAccount: { connect: { id: account.id } }, maxOpenPositions: 7 } });
59
+ const policyId = steps.created.data
60
+ ?.createOneTradingPolicy?.id;
61
+ if (!policyId)
62
+ throw new Error(`policy create failed: ${steps.created.errors.join('; ')}`);
63
+ const UPDATE = `mutation ($id: String!, $data: TradingPolicyUpdateInput!) {
64
+ updateOneTradingPolicy(where: { id: $id }, data: $data) { ${POLICY_FIELDS} }
65
+ }`;
66
+ steps.armed = await run(schema, prisma, UPDATE, {
67
+ id: policyId,
68
+ data: { intradayLanePrefs: { armed: true, perLaneTradesPerDay: 4 } },
69
+ });
70
+ steps.cleared = await run(schema, prisma, UPDATE, {
71
+ id: policyId,
72
+ data: { intradayLanePrefs: { armed: false } },
73
+ });
74
+ // The generated update input types a Json? field as InputJsonValue; this
75
+ // proves a GraphQL null still clears the carrier, so an operator can
76
+ // disarm by unsetting it rather than only by writing armed: false.
77
+ steps.prefsNull = await run(schema, prisma, UPDATE, { id: policyId, data: { intradayLanePrefs: null } });
78
+ const up = readFileSync(MIGRATION_SQL, 'utf8');
79
+ await prisma
80
+ .$transaction(async (tx) => {
81
+ await tx.$executeRawUnsafe(ARM_ROW_SQL, policyId);
82
+ downUp.before = await snapshot(tx, policyId);
83
+ await tx.$executeRawUnsafe(DOWN_SQL);
84
+ downUp.down = await snapshot(tx, policyId);
85
+ await tx.$executeRawUnsafe(up);
86
+ downUp.up = await snapshot(tx, policyId);
87
+ throw new RollbackSignal('roll back the down/up run');
88
+ })
89
+ .catch((error) => {
90
+ if (!(error instanceof RollbackSignal))
91
+ throw error;
92
+ });
93
+ downUp.afterRollback = await snapshot(prisma, policyId);
94
+ }
95
+ finally {
96
+ await prisma.tradingPolicy.deleteMany({ where: { alpacaAccountId: account.id } });
97
+ await prisma.alpacaAccount.delete({ where: { id: account.id } });
98
+ await prisma.user.delete({ where: { id: user.id } });
99
+ await prisma.$disconnect();
100
+ }
101
+ process.stdout.write(`<<<RESULTS>>>${JSON.stringify({ tag, steps, downUp })}<<<END>>>\n`);
102
+ }
103
+ main().catch((error) => {
104
+ process.stderr.write(`harness failed: ${String(error)}\n`);
105
+ process.exit(1);
106
+ });
107
+ //# sourceMappingURL=trading-policy-lane-fields-roundtrip.harness.js.map
@@ -118,6 +118,24 @@ portfolioTrailRungs for the second round.
118
118
  orderWindowSeconds: number;
119
119
  // Enforce intraday-only trading (auto-close all positions before EOD). Default: false.
120
120
  dayTradeOnly: boolean;
121
+ // Per-account multi-lane intraday preferences: the single carrier of the
122
+ account's lane opt-in (\`armed\`) and its per-lane caps, including the
123
+ trades-per-day cap (\`perLaneTradesPerDay\`). It is validated at the engine's
124
+ read boundary by the strict IntradayLanePrefs schema in @adaptic/utils
125
+ (trading-policy/schemas). NULL, a value that fails that schema, or an
126
+ absent cap means the lanes are disarmed for this account. One JSON carrier
127
+ instead of separate arming and cap columns keeps a single arming predicate,
128
+ so there are no two homes for one setting that could disagree.
129
+
130
+ It is left out of every generated selection set (GQL.SKIP) on purpose. A
131
+ GraphQL server that predates the column rejects any operation that
132
+ selects it, and the TradingPolicy selection set feeds the engine's order
133
+ chokepoint and broker-credential reads. Keeping the field out lets a
134
+ consumer of this package run against a server whether or not the
135
+ migration has been applied. It is read through \`readIntradayLanePrefs\`,
136
+ whose failure the lane path treats as disarmed, and written through the
137
+ generated create and update inputs.
138
+ intradayLanePrefs?: any;
121
139
  riskBudgetPrefs?: any;
122
140
  signalConsumptionPrefs?: any;
123
141
  executionPrefs?: any;
@@ -1,2 +1,2 @@
1
- export declare const PolicyOverlayTypeString = "\n// Your response should adhere to the following type definition for the \"PolicyOverlay\" type.\n// Importantly, DO NOT include any annotations in your response (i.e., remove the ones we have provided for your reference below).\n\nexport type PolicyOverlay = {\n // Relation to TradingPolicy.\n tradingPolicy: {\n // Relation to AlpacaAccount.\n alpacaAccount: {\n // The type of Alpaca account (PAPER or LIVE).\n type: AlpacaAccountType;\n // JSON configuration settings for the Alpaca account.\n configuration?: any;\n };\n version: number;\n lastModifiedBy?: string;\n lastModifiedAt: Date;\n autonomyMode: AutonomyMode;\n realtimeTradingEnabled: boolean;\n paperTradingOnly: boolean;\n killSwitchEnabled: boolean;\n autonomyPrefs?: any;\n equitiesEnabled: boolean;\n etfsEnabled: boolean;\n cryptoEnabled: boolean;\n optionsEnabled: boolean;\n futuresEnabled: boolean;\n forexEnabled: boolean;\n shortingEnabled: boolean;\n marginEnabled: boolean;\n fractionalSharesEnabled: boolean;\n assetUniversePrefs?: any;\n maxBuyingPowerUtilPct: number;\n cashFloorPct: number;\n maxGrossExposurePct: number;\n maxNetExposurePct: number;\n maxLeverage: number;\n maxSymbolConcentrationPct: number;\n maxSectorConcentrationPct: number;\n maxOpenPositions: number;\n maxOpenOrders: number;\n // Percentage of account equity (with leverage) allocated per equities trade. Canonical replacement for legacy AlpacaAccount.tradeAllocationPct.\n perTradeEquityAllocationPct: number;\n // Percentage of the crypto allocation slice of account equity allocated per crypto trade. Canonical replacement for legacy AlpacaAccount.cryptoTradeAllocationPct.\n perTradeCryptoAllocationPct: number;\n // Opt-in for enabling the portfolio-level trailing stop service within Adaptic's Realtime Trade Engine. Canonical replacement for legacy AlpacaAccount.enablePortfolioTrailingStop.\n enablePortfolioTrailingStop: boolean;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioTrailPercent.\n portfolioTrailPercent: number;\n // Portfolio-level profit threshold percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioProfitThresholdPercent.\n portfolioProfitThresholdPercent: number;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine for reducing the trailing stop once the profit threshold is exceeded. Canonical replacement for legacy AlpacaAccount.reducedPortfolioTrailPercent.\n reducedPortfolioTrailPercent: number;\n // Ordered ladder of portfolio trailing-stop rungs, generalising the single\nportfolioProfitThresholdPercent/reducedPortfolioTrailPercent pair above.\nShape: [{ \"thresholdPercent\": 0.35, \"trailPercent\": 0.25 }, ...] in WHOLE\nPERCENT of the session's opening equity (0.35 = 35bp), ordered ascending by\nthreshold. The engine applies min() across every rung whose threshold the\nsession high-water mark has reached, so the trail tightens monotonically and\na mis-ordered or wider rung can never loosen a stop that has already\ntightened. NULL = use the single legacy rung, which reproduces today's\nbehaviour exactly.\n portfolioTrailRungs?: any;\n // Local ET time (\"HH:MM\", 24h) at which the portfolio trailing-stop state\nre-anchors for a SECOND intraday round: open equity re-seeds from that\ntick, the high-water mark resets to zero and the trail returns to base.\nIntended for an afternoon session traded with freshly entered positions.\nNULL = single round per day, which is today's behaviour.\n portfolioAfternoonResetEt?: string;\n // Rung ladder for the afternoon round, same shape as portfolioTrailRungs.\nThe afternoon window is materially shorter than the morning, so the\nthresholds that are reachable within it differ and must be set from the\nafternoon's own distribution rather than inherited. NULL = reuse\nportfolioTrailRungs for the second round.\n portfolioAfternoonTrailRungs?: any;\n // Whether the portfolio-level daily take-profit circuit breaker is enabled for this account.\n enablePortfolioTakeProfit?: boolean;\n // Daily gain target (whole percent, e.g. 1 = 1%) since the 09:30 open that trips the take-profit breaker.\n portfolioTakeProfitThresholdPercent?: number;\n // Initial trailing stop percentage used by the Position Trailing Stop Service. Canonical replacement for legacy AlpacaAccount.defaultTrailingStopPercentage100.\n defaultTrailingStopPercentage100: number;\n // First profit threshold at which the Position Trailing Stop Service reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.firstTrailReductionThreshold100.\n firstTrailReductionThreshold100: number;\n // Second profit threshold at which the Position Trailing Stop Service further reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.secondTrailReductionThreshold100.\n secondTrailReductionThreshold100: number;\n // Trailing stop percentage to use when profit exceeds the first threshold. Canonical replacement for legacy AlpacaAccount.firstReducedTrailPercentage100.\n firstReducedTrailPercentage100: number;\n // Trailing stop percentage to use when profit exceeds the second threshold. Canonical replacement for legacy AlpacaAccount.secondReducedTrailPercentage100.\n secondReducedTrailPercentage100: number;\n // Minimum change in trailing stop percent to warrant an adjustment. Canonical replacement for legacy AlpacaAccount.minimumPriceChangePercent100.\n minimumPriceChangePercent100: number;\n // Wash-trade cooldown period in milliseconds for equities \u2014 minimum elapsed time between opposing-side fills on the same symbol per FINRA Rule 5210. Mirrors the 30s default already enforced for crypto. Default: 30000 (30 seconds).\n equityWashTradeCooldownMs: number;\n // Minimum intraday liquidity threshold (shares traded in last 5 min). Required for scalping. Default: 10000 (10k shares in last 5 min).\n minIntradayLiquidityShares: number;\n // Maximum spread in basis points (1/100ths of 1%) to allow entry. Scalping requires tight spreads; use 1-3 bps. Default: 5 (0.05%).\n maxEntrySpreadBps: number;\n // Minimum time between same-symbol same-side entries (ms). FINRA Rule 5210 requires 30s for opposite-side trades; this controls same-side rapid re-entry. Default: 5000 (5 seconds) for scalping; 30000 for normal trading.\n sameSideReentryDelayMs: number;\n // Volatility filter: only trade if ATR(14) >= minAtrPercentage. Scalping needs moderate volatility; too low = no edge. Default: 0.3 (0.3%).\n minAtrPercentage: number;\n // Volatility filter: only trade if ATR(14) <= maxAtrPercentage. Scalping needs moderate volatility; too high = whipsaws. Default: 2.0 (2.0%).\n maxAtrPercentage: number;\n // Order book depth requirement: minimum shares at best bid/ask to qualify for entry. Scalping needs guaranteed liquidity. Default: 5000 shares.\n minBookDepthShares: number;\n // Maximum market order slippage in basis points before flagging as anomaly. Helps detect liquidity crunches. Default: 10 bps.\n maxAnomalousSlippageBps: number;\n // Intraday session windows allowed (JSON array). Format: [{ startMinutesFromOpen, endMinutesFromOpen, active }]. Example: skip first 5 min and last 10 min of RTH.\n intradayTradingWindows?: any;\n // Hard position exit clock (minutes from entry). 0 = disabled. Forces liquidation regardless of signal. Useful for strict day-trading discipline. Default: 0.\n hardPositionExitMinutes: number;\n // Rapid-fire order-rate limit: max orders within orderWindowSeconds. Default: 10 orders per 5 seconds.\n maxOrdersPerWindow: number;\n // Window size for maxOrdersPerWindow rate limit (seconds). Default: 5.\n orderWindowSeconds: number;\n // Enforce intraday-only trading (auto-close all positions before EOD). Default: false.\n dayTradeOnly: boolean;\n riskBudgetPrefs?: any;\n signalConsumptionPrefs?: any;\n executionPrefs?: any;\n positionManagementPrefs?: any;\n portfolioConstructionPrefs?: any;\n macroOverlayEnabled: boolean;\n sectorOverlayEnabled: boolean;\n volatilityOverlayEnabled: boolean;\n liquidityStressOverlayEnabled: boolean;\n blackSwanProtectionEnabled: boolean;\n drawdownGuardianEnabled: boolean;\n correlationSpikeProtectionEnabled: boolean;\n newsEventRiskOverlayEnabled: boolean;\n exchangeHealthOverlayEnabled: boolean;\n dataQualitySentinelEnabled: boolean;\n overlayResponsePrefs?: any;\n miniModelProvider?: LlmProvider;\n normalModelProvider?: LlmProvider;\n advancedModelProvider?: LlmProvider;\n modelPrefs?: any;\n auditNotificationPrefs?: any;\n // List of policy overlays.\n overlays: PolicyOverlay[];\n escalationPolicyOverrides?: any;\n currentRiskState: AccountRiskState;\n currentRiskStateAt?: Date;\n lastRiskStateChangedBy?: string;\n };\n overlayType: OverlayType;\n source: string;\n reason: string;\n severity: OverlaySeverity;\n version: number;\n mutations: any;\n status: OverlayStatus;\n activatedAt: Date;\n expiresAt?: Date;\n deactivatedAt?: Date;\n deactivatedBy?: string;\n};\n\nenum AlpacaAccountType {\n PAPER\n\n LIVE\n}\n\nenum AutonomyMode {\n ADVISORY_ONLY\n\n EXECUTION_ON_APPROVAL\n\n SEMI_AUTONOMOUS\n\n FULLY_AUTONOMOUS\n\n EMERGENCY_SAFE_MODE\n}\n\nenum LlmProvider {\n OPENAI\n\n ANTHROPIC\n\n DEEPSEEK\n\n KIMI\n\n QWEN\n\n XAI\n\n GEMINI\n\n DEEPINFRA\n}\n\nenum AccountRiskState {\n NORMAL\n\n WARN\n\n THROTTLE\n\n PAUSED\n\n FLATTEN\n\n HALT\n}\n\nenum OverlayType {\n BLACK_SWAN\n\n VOLATILITY_REGIME\n\n SECTOR_DETERIORATION\n\n DRAWDOWN_BREACH\n\n CORRELATION_SPIKE\n\n LIQUIDITY_STRESS\n\n EXCHANGE_DEGRADATION\n\n DATA_QUALITY\n\n NEWS_EVENT_RISK\n\n RATES_BONDS_STRESS\n\n MANUAL_OVERRIDE\n\n INCIDENT_RESPONSE\n}\n\nenum OverlaySeverity {\n LOW\n\n MEDIUM\n\n HIGH\n\n CRITICAL\n}\n\nenum OverlayStatus {\n ACTIVE\n\n EXPIRED\n\n DEACTIVATED\n\n SUPERSEDED\n}\n\n";
1
+ export declare const PolicyOverlayTypeString = "\n// Your response should adhere to the following type definition for the \"PolicyOverlay\" type.\n// Importantly, DO NOT include any annotations in your response (i.e., remove the ones we have provided for your reference below).\n\nexport type PolicyOverlay = {\n // Relation to TradingPolicy.\n tradingPolicy: {\n // Relation to AlpacaAccount.\n alpacaAccount: {\n // The type of Alpaca account (PAPER or LIVE).\n type: AlpacaAccountType;\n // JSON configuration settings for the Alpaca account.\n configuration?: any;\n };\n version: number;\n lastModifiedBy?: string;\n lastModifiedAt: Date;\n autonomyMode: AutonomyMode;\n realtimeTradingEnabled: boolean;\n paperTradingOnly: boolean;\n killSwitchEnabled: boolean;\n autonomyPrefs?: any;\n equitiesEnabled: boolean;\n etfsEnabled: boolean;\n cryptoEnabled: boolean;\n optionsEnabled: boolean;\n futuresEnabled: boolean;\n forexEnabled: boolean;\n shortingEnabled: boolean;\n marginEnabled: boolean;\n fractionalSharesEnabled: boolean;\n assetUniversePrefs?: any;\n maxBuyingPowerUtilPct: number;\n cashFloorPct: number;\n maxGrossExposurePct: number;\n maxNetExposurePct: number;\n maxLeverage: number;\n maxSymbolConcentrationPct: number;\n maxSectorConcentrationPct: number;\n maxOpenPositions: number;\n maxOpenOrders: number;\n // Percentage of account equity (with leverage) allocated per equities trade. Canonical replacement for legacy AlpacaAccount.tradeAllocationPct.\n perTradeEquityAllocationPct: number;\n // Percentage of the crypto allocation slice of account equity allocated per crypto trade. Canonical replacement for legacy AlpacaAccount.cryptoTradeAllocationPct.\n perTradeCryptoAllocationPct: number;\n // Opt-in for enabling the portfolio-level trailing stop service within Adaptic's Realtime Trade Engine. Canonical replacement for legacy AlpacaAccount.enablePortfolioTrailingStop.\n enablePortfolioTrailingStop: boolean;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioTrailPercent.\n portfolioTrailPercent: number;\n // Portfolio-level profit threshold percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioProfitThresholdPercent.\n portfolioProfitThresholdPercent: number;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine for reducing the trailing stop once the profit threshold is exceeded. Canonical replacement for legacy AlpacaAccount.reducedPortfolioTrailPercent.\n reducedPortfolioTrailPercent: number;\n // Ordered ladder of portfolio trailing-stop rungs, generalising the single\nportfolioProfitThresholdPercent/reducedPortfolioTrailPercent pair above.\nShape: [{ \"thresholdPercent\": 0.35, \"trailPercent\": 0.25 }, ...] in WHOLE\nPERCENT of the session's opening equity (0.35 = 35bp), ordered ascending by\nthreshold. The engine applies min() across every rung whose threshold the\nsession high-water mark has reached, so the trail tightens monotonically and\na mis-ordered or wider rung can never loosen a stop that has already\ntightened. NULL = use the single legacy rung, which reproduces today's\nbehaviour exactly.\n portfolioTrailRungs?: any;\n // Local ET time (\"HH:MM\", 24h) at which the portfolio trailing-stop state\nre-anchors for a SECOND intraday round: open equity re-seeds from that\ntick, the high-water mark resets to zero and the trail returns to base.\nIntended for an afternoon session traded with freshly entered positions.\nNULL = single round per day, which is today's behaviour.\n portfolioAfternoonResetEt?: string;\n // Rung ladder for the afternoon round, same shape as portfolioTrailRungs.\nThe afternoon window is materially shorter than the morning, so the\nthresholds that are reachable within it differ and must be set from the\nafternoon's own distribution rather than inherited. NULL = reuse\nportfolioTrailRungs for the second round.\n portfolioAfternoonTrailRungs?: any;\n // Whether the portfolio-level daily take-profit circuit breaker is enabled for this account.\n enablePortfolioTakeProfit?: boolean;\n // Daily gain target (whole percent, e.g. 1 = 1%) since the 09:30 open that trips the take-profit breaker.\n portfolioTakeProfitThresholdPercent?: number;\n // Initial trailing stop percentage used by the Position Trailing Stop Service. Canonical replacement for legacy AlpacaAccount.defaultTrailingStopPercentage100.\n defaultTrailingStopPercentage100: number;\n // First profit threshold at which the Position Trailing Stop Service reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.firstTrailReductionThreshold100.\n firstTrailReductionThreshold100: number;\n // Second profit threshold at which the Position Trailing Stop Service further reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.secondTrailReductionThreshold100.\n secondTrailReductionThreshold100: number;\n // Trailing stop percentage to use when profit exceeds the first threshold. Canonical replacement for legacy AlpacaAccount.firstReducedTrailPercentage100.\n firstReducedTrailPercentage100: number;\n // Trailing stop percentage to use when profit exceeds the second threshold. Canonical replacement for legacy AlpacaAccount.secondReducedTrailPercentage100.\n secondReducedTrailPercentage100: number;\n // Minimum change in trailing stop percent to warrant an adjustment. Canonical replacement for legacy AlpacaAccount.minimumPriceChangePercent100.\n minimumPriceChangePercent100: number;\n // Wash-trade cooldown period in milliseconds for equities \u2014 minimum elapsed time between opposing-side fills on the same symbol per FINRA Rule 5210. Mirrors the 30s default already enforced for crypto. Default: 30000 (30 seconds).\n equityWashTradeCooldownMs: number;\n // Minimum intraday liquidity threshold (shares traded in last 5 min). Required for scalping. Default: 10000 (10k shares in last 5 min).\n minIntradayLiquidityShares: number;\n // Maximum spread in basis points (1/100ths of 1%) to allow entry. Scalping requires tight spreads; use 1-3 bps. Default: 5 (0.05%).\n maxEntrySpreadBps: number;\n // Minimum time between same-symbol same-side entries (ms). FINRA Rule 5210 requires 30s for opposite-side trades; this controls same-side rapid re-entry. Default: 5000 (5 seconds) for scalping; 30000 for normal trading.\n sameSideReentryDelayMs: number;\n // Volatility filter: only trade if ATR(14) >= minAtrPercentage. Scalping needs moderate volatility; too low = no edge. Default: 0.3 (0.3%).\n minAtrPercentage: number;\n // Volatility filter: only trade if ATR(14) <= maxAtrPercentage. Scalping needs moderate volatility; too high = whipsaws. Default: 2.0 (2.0%).\n maxAtrPercentage: number;\n // Order book depth requirement: minimum shares at best bid/ask to qualify for entry. Scalping needs guaranteed liquidity. Default: 5000 shares.\n minBookDepthShares: number;\n // Maximum market order slippage in basis points before flagging as anomaly. Helps detect liquidity crunches. Default: 10 bps.\n maxAnomalousSlippageBps: number;\n // Intraday session windows allowed (JSON array). Format: [{ startMinutesFromOpen, endMinutesFromOpen, active }]. Example: skip first 5 min and last 10 min of RTH.\n intradayTradingWindows?: any;\n // Hard position exit clock (minutes from entry). 0 = disabled. Forces liquidation regardless of signal. Useful for strict day-trading discipline. Default: 0.\n hardPositionExitMinutes: number;\n // Rapid-fire order-rate limit: max orders within orderWindowSeconds. Default: 10 orders per 5 seconds.\n maxOrdersPerWindow: number;\n // Window size for maxOrdersPerWindow rate limit (seconds). Default: 5.\n orderWindowSeconds: number;\n // Enforce intraday-only trading (auto-close all positions before EOD). Default: false.\n dayTradeOnly: boolean;\n // Per-account multi-lane intraday preferences: the single carrier of the\naccount's lane opt-in (`armed`) and its per-lane caps, including the\ntrades-per-day cap (`perLaneTradesPerDay`). It is validated at the engine's\nread boundary by the strict IntradayLanePrefs schema in @adaptic/utils\n(trading-policy/schemas). NULL, a value that fails that schema, or an\nabsent cap means the lanes are disarmed for this account. One JSON carrier\ninstead of separate arming and cap columns keeps a single arming predicate,\nso there are no two homes for one setting that could disagree.\n\nIt is left out of every generated selection set (GQL.SKIP) on purpose. A\nGraphQL server that predates the column rejects any operation that\nselects it, and the TradingPolicy selection set feeds the engine's order\nchokepoint and broker-credential reads. Keeping the field out lets a\nconsumer of this package run against a server whether or not the\nmigration has been applied. It is read through `readIntradayLanePrefs`,\nwhose failure the lane path treats as disarmed, and written through the\ngenerated create and update inputs.\n intradayLanePrefs?: any;\n riskBudgetPrefs?: any;\n signalConsumptionPrefs?: any;\n executionPrefs?: any;\n positionManagementPrefs?: any;\n portfolioConstructionPrefs?: any;\n macroOverlayEnabled: boolean;\n sectorOverlayEnabled: boolean;\n volatilityOverlayEnabled: boolean;\n liquidityStressOverlayEnabled: boolean;\n blackSwanProtectionEnabled: boolean;\n drawdownGuardianEnabled: boolean;\n correlationSpikeProtectionEnabled: boolean;\n newsEventRiskOverlayEnabled: boolean;\n exchangeHealthOverlayEnabled: boolean;\n dataQualitySentinelEnabled: boolean;\n overlayResponsePrefs?: any;\n miniModelProvider?: LlmProvider;\n normalModelProvider?: LlmProvider;\n advancedModelProvider?: LlmProvider;\n modelPrefs?: any;\n auditNotificationPrefs?: any;\n // List of policy overlays.\n overlays: PolicyOverlay[];\n escalationPolicyOverrides?: any;\n currentRiskState: AccountRiskState;\n currentRiskStateAt?: Date;\n lastRiskStateChangedBy?: string;\n };\n overlayType: OverlayType;\n source: string;\n reason: string;\n severity: OverlaySeverity;\n version: number;\n mutations: any;\n status: OverlayStatus;\n activatedAt: Date;\n expiresAt?: Date;\n deactivatedAt?: Date;\n deactivatedBy?: string;\n};\n\nenum AlpacaAccountType {\n PAPER\n\n LIVE\n}\n\nenum AutonomyMode {\n ADVISORY_ONLY\n\n EXECUTION_ON_APPROVAL\n\n SEMI_AUTONOMOUS\n\n FULLY_AUTONOMOUS\n\n EMERGENCY_SAFE_MODE\n}\n\nenum LlmProvider {\n OPENAI\n\n ANTHROPIC\n\n DEEPSEEK\n\n KIMI\n\n QWEN\n\n XAI\n\n GEMINI\n\n DEEPINFRA\n}\n\nenum AccountRiskState {\n NORMAL\n\n WARN\n\n THROTTLE\n\n PAUSED\n\n FLATTEN\n\n HALT\n}\n\nenum OverlayType {\n BLACK_SWAN\n\n VOLATILITY_REGIME\n\n SECTOR_DETERIORATION\n\n DRAWDOWN_BREACH\n\n CORRELATION_SPIKE\n\n LIQUIDITY_STRESS\n\n EXCHANGE_DEGRADATION\n\n DATA_QUALITY\n\n NEWS_EVENT_RISK\n\n RATES_BONDS_STRESS\n\n MANUAL_OVERRIDE\n\n INCIDENT_RESPONSE\n}\n\nenum OverlaySeverity {\n LOW\n\n MEDIUM\n\n HIGH\n\n CRITICAL\n}\n\nenum OverlayStatus {\n ACTIVE\n\n EXPIRED\n\n DEACTIVATED\n\n SUPERSEDED\n}\n\n";
2
2
  //# sourceMappingURL=PolicyOverlay.d.ts.map
@@ -116,6 +116,24 @@ portfolioTrailRungs for the second round.
116
116
  orderWindowSeconds: number;
117
117
  // Enforce intraday-only trading (auto-close all positions before EOD). Default: false.
118
118
  dayTradeOnly: boolean;
119
+ // Per-account multi-lane intraday preferences: the single carrier of the
120
+ account's lane opt-in (\`armed\`) and its per-lane caps, including the
121
+ trades-per-day cap (\`perLaneTradesPerDay\`). It is validated at the engine's
122
+ read boundary by the strict IntradayLanePrefs schema in @adaptic/utils
123
+ (trading-policy/schemas). NULL, a value that fails that schema, or an
124
+ absent cap means the lanes are disarmed for this account. One JSON carrier
125
+ instead of separate arming and cap columns keeps a single arming predicate,
126
+ so there are no two homes for one setting that could disagree.
127
+
128
+ It is left out of every generated selection set (GQL.SKIP) on purpose. A
129
+ GraphQL server that predates the column rejects any operation that
130
+ selects it, and the TradingPolicy selection set feeds the engine's order
131
+ chokepoint and broker-credential reads. Keeping the field out lets a
132
+ consumer of this package run against a server whether or not the
133
+ migration has been applied. It is read through \`readIntradayLanePrefs\`,
134
+ whose failure the lane path treats as disarmed, and written through the
135
+ generated create and update inputs.
136
+ intradayLanePrefs?: any;
119
137
  riskBudgetPrefs?: any;
120
138
  signalConsumptionPrefs?: any;
121
139
  executionPrefs?: any;
@@ -1,2 +1,2 @@
1
- export declare const TradingPolicyTypeString = "\n// Your response should adhere to the following type definition for the \"TradingPolicy\" type.\n// Importantly, DO NOT include any annotations in your response (i.e., remove the ones we have provided for your reference below).\n\nexport type TradingPolicy = {\n // Relation to AlpacaAccount.\n alpacaAccount: {\n // The type of Alpaca account (PAPER or LIVE).\n type: AlpacaAccountType;\n // JSON configuration settings for the Alpaca account.\n configuration?: any;\n };\n version: number;\n lastModifiedBy?: string;\n lastModifiedAt: Date;\n autonomyMode: AutonomyMode;\n realtimeTradingEnabled: boolean;\n paperTradingOnly: boolean;\n killSwitchEnabled: boolean;\n autonomyPrefs?: any;\n equitiesEnabled: boolean;\n etfsEnabled: boolean;\n cryptoEnabled: boolean;\n optionsEnabled: boolean;\n futuresEnabled: boolean;\n forexEnabled: boolean;\n shortingEnabled: boolean;\n marginEnabled: boolean;\n fractionalSharesEnabled: boolean;\n assetUniversePrefs?: any;\n maxBuyingPowerUtilPct: number;\n cashFloorPct: number;\n maxGrossExposurePct: number;\n maxNetExposurePct: number;\n maxLeverage: number;\n maxSymbolConcentrationPct: number;\n maxSectorConcentrationPct: number;\n maxOpenPositions: number;\n maxOpenOrders: number;\n // Percentage of account equity (with leverage) allocated per equities trade. Canonical replacement for legacy AlpacaAccount.tradeAllocationPct.\n perTradeEquityAllocationPct: number;\n // Percentage of the crypto allocation slice of account equity allocated per crypto trade. Canonical replacement for legacy AlpacaAccount.cryptoTradeAllocationPct.\n perTradeCryptoAllocationPct: number;\n // Opt-in for enabling the portfolio-level trailing stop service within Adaptic's Realtime Trade Engine. Canonical replacement for legacy AlpacaAccount.enablePortfolioTrailingStop.\n enablePortfolioTrailingStop: boolean;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioTrailPercent.\n portfolioTrailPercent: number;\n // Portfolio-level profit threshold percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioProfitThresholdPercent.\n portfolioProfitThresholdPercent: number;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine for reducing the trailing stop once the profit threshold is exceeded. Canonical replacement for legacy AlpacaAccount.reducedPortfolioTrailPercent.\n reducedPortfolioTrailPercent: number;\n // Ordered ladder of portfolio trailing-stop rungs, generalising the single\nportfolioProfitThresholdPercent/reducedPortfolioTrailPercent pair above.\nShape: [{ \"thresholdPercent\": 0.35, \"trailPercent\": 0.25 }, ...] in WHOLE\nPERCENT of the session's opening equity (0.35 = 35bp), ordered ascending by\nthreshold. The engine applies min() across every rung whose threshold the\nsession high-water mark has reached, so the trail tightens monotonically and\na mis-ordered or wider rung can never loosen a stop that has already\ntightened. NULL = use the single legacy rung, which reproduces today's\nbehaviour exactly.\n portfolioTrailRungs?: any;\n // Local ET time (\"HH:MM\", 24h) at which the portfolio trailing-stop state\nre-anchors for a SECOND intraday round: open equity re-seeds from that\ntick, the high-water mark resets to zero and the trail returns to base.\nIntended for an afternoon session traded with freshly entered positions.\nNULL = single round per day, which is today's behaviour.\n portfolioAfternoonResetEt?: string;\n // Rung ladder for the afternoon round, same shape as portfolioTrailRungs.\nThe afternoon window is materially shorter than the morning, so the\nthresholds that are reachable within it differ and must be set from the\nafternoon's own distribution rather than inherited. NULL = reuse\nportfolioTrailRungs for the second round.\n portfolioAfternoonTrailRungs?: any;\n // Whether the portfolio-level daily take-profit circuit breaker is enabled for this account.\n enablePortfolioTakeProfit?: boolean;\n // Daily gain target (whole percent, e.g. 1 = 1%) since the 09:30 open that trips the take-profit breaker.\n portfolioTakeProfitThresholdPercent?: number;\n // Initial trailing stop percentage used by the Position Trailing Stop Service. Canonical replacement for legacy AlpacaAccount.defaultTrailingStopPercentage100.\n defaultTrailingStopPercentage100: number;\n // First profit threshold at which the Position Trailing Stop Service reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.firstTrailReductionThreshold100.\n firstTrailReductionThreshold100: number;\n // Second profit threshold at which the Position Trailing Stop Service further reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.secondTrailReductionThreshold100.\n secondTrailReductionThreshold100: number;\n // Trailing stop percentage to use when profit exceeds the first threshold. Canonical replacement for legacy AlpacaAccount.firstReducedTrailPercentage100.\n firstReducedTrailPercentage100: number;\n // Trailing stop percentage to use when profit exceeds the second threshold. Canonical replacement for legacy AlpacaAccount.secondReducedTrailPercentage100.\n secondReducedTrailPercentage100: number;\n // Minimum change in trailing stop percent to warrant an adjustment. Canonical replacement for legacy AlpacaAccount.minimumPriceChangePercent100.\n minimumPriceChangePercent100: number;\n // Wash-trade cooldown period in milliseconds for equities \u2014 minimum elapsed time between opposing-side fills on the same symbol per FINRA Rule 5210. Mirrors the 30s default already enforced for crypto. Default: 30000 (30 seconds).\n equityWashTradeCooldownMs: number;\n // Minimum intraday liquidity threshold (shares traded in last 5 min). Required for scalping. Default: 10000 (10k shares in last 5 min).\n minIntradayLiquidityShares: number;\n // Maximum spread in basis points (1/100ths of 1%) to allow entry. Scalping requires tight spreads; use 1-3 bps. Default: 5 (0.05%).\n maxEntrySpreadBps: number;\n // Minimum time between same-symbol same-side entries (ms). FINRA Rule 5210 requires 30s for opposite-side trades; this controls same-side rapid re-entry. Default: 5000 (5 seconds) for scalping; 30000 for normal trading.\n sameSideReentryDelayMs: number;\n // Volatility filter: only trade if ATR(14) >= minAtrPercentage. Scalping needs moderate volatility; too low = no edge. Default: 0.3 (0.3%).\n minAtrPercentage: number;\n // Volatility filter: only trade if ATR(14) <= maxAtrPercentage. Scalping needs moderate volatility; too high = whipsaws. Default: 2.0 (2.0%).\n maxAtrPercentage: number;\n // Order book depth requirement: minimum shares at best bid/ask to qualify for entry. Scalping needs guaranteed liquidity. Default: 5000 shares.\n minBookDepthShares: number;\n // Maximum market order slippage in basis points before flagging as anomaly. Helps detect liquidity crunches. Default: 10 bps.\n maxAnomalousSlippageBps: number;\n // Intraday session windows allowed (JSON array). Format: [{ startMinutesFromOpen, endMinutesFromOpen, active }]. Example: skip first 5 min and last 10 min of RTH.\n intradayTradingWindows?: any;\n // Hard position exit clock (minutes from entry). 0 = disabled. Forces liquidation regardless of signal. Useful for strict day-trading discipline. Default: 0.\n hardPositionExitMinutes: number;\n // Rapid-fire order-rate limit: max orders within orderWindowSeconds. Default: 10 orders per 5 seconds.\n maxOrdersPerWindow: number;\n // Window size for maxOrdersPerWindow rate limit (seconds). Default: 5.\n orderWindowSeconds: number;\n // Enforce intraday-only trading (auto-close all positions before EOD). Default: false.\n dayTradeOnly: boolean;\n riskBudgetPrefs?: any;\n signalConsumptionPrefs?: any;\n executionPrefs?: any;\n positionManagementPrefs?: any;\n portfolioConstructionPrefs?: any;\n macroOverlayEnabled: boolean;\n sectorOverlayEnabled: boolean;\n volatilityOverlayEnabled: boolean;\n liquidityStressOverlayEnabled: boolean;\n blackSwanProtectionEnabled: boolean;\n drawdownGuardianEnabled: boolean;\n correlationSpikeProtectionEnabled: boolean;\n newsEventRiskOverlayEnabled: boolean;\n exchangeHealthOverlayEnabled: boolean;\n dataQualitySentinelEnabled: boolean;\n overlayResponsePrefs?: any;\n miniModelProvider?: LlmProvider;\n normalModelProvider?: LlmProvider;\n advancedModelProvider?: LlmProvider;\n modelPrefs?: any;\n auditNotificationPrefs?: any;\n // List of policy overlays.\n overlays: {\n overlayType: OverlayType;\n source: string;\n reason: string;\n severity: OverlaySeverity;\n version: number;\n mutations: any;\n status: OverlayStatus;\n activatedAt: Date;\n expiresAt?: Date;\n deactivatedAt?: Date;\n deactivatedBy?: string;\n }[];\n escalationPolicyOverrides?: any;\n currentRiskState: AccountRiskState;\n currentRiskStateAt?: Date;\n lastRiskStateChangedBy?: string;\n};\n\nenum AlpacaAccountType {\n PAPER\n\n LIVE\n}\n\nenum AutonomyMode {\n ADVISORY_ONLY\n\n EXECUTION_ON_APPROVAL\n\n SEMI_AUTONOMOUS\n\n FULLY_AUTONOMOUS\n\n EMERGENCY_SAFE_MODE\n}\n\nenum LlmProvider {\n OPENAI\n\n ANTHROPIC\n\n DEEPSEEK\n\n KIMI\n\n QWEN\n\n XAI\n\n GEMINI\n\n DEEPINFRA\n}\n\nenum OverlayType {\n BLACK_SWAN\n\n VOLATILITY_REGIME\n\n SECTOR_DETERIORATION\n\n DRAWDOWN_BREACH\n\n CORRELATION_SPIKE\n\n LIQUIDITY_STRESS\n\n EXCHANGE_DEGRADATION\n\n DATA_QUALITY\n\n NEWS_EVENT_RISK\n\n RATES_BONDS_STRESS\n\n MANUAL_OVERRIDE\n\n INCIDENT_RESPONSE\n}\n\nenum OverlaySeverity {\n LOW\n\n MEDIUM\n\n HIGH\n\n CRITICAL\n}\n\nenum OverlayStatus {\n ACTIVE\n\n EXPIRED\n\n DEACTIVATED\n\n SUPERSEDED\n}\n\nenum AccountRiskState {\n NORMAL\n\n WARN\n\n THROTTLE\n\n PAUSED\n\n FLATTEN\n\n HALT\n}\n\n";
1
+ export declare const TradingPolicyTypeString = "\n// Your response should adhere to the following type definition for the \"TradingPolicy\" type.\n// Importantly, DO NOT include any annotations in your response (i.e., remove the ones we have provided for your reference below).\n\nexport type TradingPolicy = {\n // Relation to AlpacaAccount.\n alpacaAccount: {\n // The type of Alpaca account (PAPER or LIVE).\n type: AlpacaAccountType;\n // JSON configuration settings for the Alpaca account.\n configuration?: any;\n };\n version: number;\n lastModifiedBy?: string;\n lastModifiedAt: Date;\n autonomyMode: AutonomyMode;\n realtimeTradingEnabled: boolean;\n paperTradingOnly: boolean;\n killSwitchEnabled: boolean;\n autonomyPrefs?: any;\n equitiesEnabled: boolean;\n etfsEnabled: boolean;\n cryptoEnabled: boolean;\n optionsEnabled: boolean;\n futuresEnabled: boolean;\n forexEnabled: boolean;\n shortingEnabled: boolean;\n marginEnabled: boolean;\n fractionalSharesEnabled: boolean;\n assetUniversePrefs?: any;\n maxBuyingPowerUtilPct: number;\n cashFloorPct: number;\n maxGrossExposurePct: number;\n maxNetExposurePct: number;\n maxLeverage: number;\n maxSymbolConcentrationPct: number;\n maxSectorConcentrationPct: number;\n maxOpenPositions: number;\n maxOpenOrders: number;\n // Percentage of account equity (with leverage) allocated per equities trade. Canonical replacement for legacy AlpacaAccount.tradeAllocationPct.\n perTradeEquityAllocationPct: number;\n // Percentage of the crypto allocation slice of account equity allocated per crypto trade. Canonical replacement for legacy AlpacaAccount.cryptoTradeAllocationPct.\n perTradeCryptoAllocationPct: number;\n // Opt-in for enabling the portfolio-level trailing stop service within Adaptic's Realtime Trade Engine. Canonical replacement for legacy AlpacaAccount.enablePortfolioTrailingStop.\n enablePortfolioTrailingStop: boolean;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioTrailPercent.\n portfolioTrailPercent: number;\n // Portfolio-level profit threshold percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioProfitThresholdPercent.\n portfolioProfitThresholdPercent: number;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine for reducing the trailing stop once the profit threshold is exceeded. Canonical replacement for legacy AlpacaAccount.reducedPortfolioTrailPercent.\n reducedPortfolioTrailPercent: number;\n // Ordered ladder of portfolio trailing-stop rungs, generalising the single\nportfolioProfitThresholdPercent/reducedPortfolioTrailPercent pair above.\nShape: [{ \"thresholdPercent\": 0.35, \"trailPercent\": 0.25 }, ...] in WHOLE\nPERCENT of the session's opening equity (0.35 = 35bp), ordered ascending by\nthreshold. The engine applies min() across every rung whose threshold the\nsession high-water mark has reached, so the trail tightens monotonically and\na mis-ordered or wider rung can never loosen a stop that has already\ntightened. NULL = use the single legacy rung, which reproduces today's\nbehaviour exactly.\n portfolioTrailRungs?: any;\n // Local ET time (\"HH:MM\", 24h) at which the portfolio trailing-stop state\nre-anchors for a SECOND intraday round: open equity re-seeds from that\ntick, the high-water mark resets to zero and the trail returns to base.\nIntended for an afternoon session traded with freshly entered positions.\nNULL = single round per day, which is today's behaviour.\n portfolioAfternoonResetEt?: string;\n // Rung ladder for the afternoon round, same shape as portfolioTrailRungs.\nThe afternoon window is materially shorter than the morning, so the\nthresholds that are reachable within it differ and must be set from the\nafternoon's own distribution rather than inherited. NULL = reuse\nportfolioTrailRungs for the second round.\n portfolioAfternoonTrailRungs?: any;\n // Whether the portfolio-level daily take-profit circuit breaker is enabled for this account.\n enablePortfolioTakeProfit?: boolean;\n // Daily gain target (whole percent, e.g. 1 = 1%) since the 09:30 open that trips the take-profit breaker.\n portfolioTakeProfitThresholdPercent?: number;\n // Initial trailing stop percentage used by the Position Trailing Stop Service. Canonical replacement for legacy AlpacaAccount.defaultTrailingStopPercentage100.\n defaultTrailingStopPercentage100: number;\n // First profit threshold at which the Position Trailing Stop Service reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.firstTrailReductionThreshold100.\n firstTrailReductionThreshold100: number;\n // Second profit threshold at which the Position Trailing Stop Service further reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.secondTrailReductionThreshold100.\n secondTrailReductionThreshold100: number;\n // Trailing stop percentage to use when profit exceeds the first threshold. Canonical replacement for legacy AlpacaAccount.firstReducedTrailPercentage100.\n firstReducedTrailPercentage100: number;\n // Trailing stop percentage to use when profit exceeds the second threshold. Canonical replacement for legacy AlpacaAccount.secondReducedTrailPercentage100.\n secondReducedTrailPercentage100: number;\n // Minimum change in trailing stop percent to warrant an adjustment. Canonical replacement for legacy AlpacaAccount.minimumPriceChangePercent100.\n minimumPriceChangePercent100: number;\n // Wash-trade cooldown period in milliseconds for equities \u2014 minimum elapsed time between opposing-side fills on the same symbol per FINRA Rule 5210. Mirrors the 30s default already enforced for crypto. Default: 30000 (30 seconds).\n equityWashTradeCooldownMs: number;\n // Minimum intraday liquidity threshold (shares traded in last 5 min). Required for scalping. Default: 10000 (10k shares in last 5 min).\n minIntradayLiquidityShares: number;\n // Maximum spread in basis points (1/100ths of 1%) to allow entry. Scalping requires tight spreads; use 1-3 bps. Default: 5 (0.05%).\n maxEntrySpreadBps: number;\n // Minimum time between same-symbol same-side entries (ms). FINRA Rule 5210 requires 30s for opposite-side trades; this controls same-side rapid re-entry. Default: 5000 (5 seconds) for scalping; 30000 for normal trading.\n sameSideReentryDelayMs: number;\n // Volatility filter: only trade if ATR(14) >= minAtrPercentage. Scalping needs moderate volatility; too low = no edge. Default: 0.3 (0.3%).\n minAtrPercentage: number;\n // Volatility filter: only trade if ATR(14) <= maxAtrPercentage. Scalping needs moderate volatility; too high = whipsaws. Default: 2.0 (2.0%).\n maxAtrPercentage: number;\n // Order book depth requirement: minimum shares at best bid/ask to qualify for entry. Scalping needs guaranteed liquidity. Default: 5000 shares.\n minBookDepthShares: number;\n // Maximum market order slippage in basis points before flagging as anomaly. Helps detect liquidity crunches. Default: 10 bps.\n maxAnomalousSlippageBps: number;\n // Intraday session windows allowed (JSON array). Format: [{ startMinutesFromOpen, endMinutesFromOpen, active }]. Example: skip first 5 min and last 10 min of RTH.\n intradayTradingWindows?: any;\n // Hard position exit clock (minutes from entry). 0 = disabled. Forces liquidation regardless of signal. Useful for strict day-trading discipline. Default: 0.\n hardPositionExitMinutes: number;\n // Rapid-fire order-rate limit: max orders within orderWindowSeconds. Default: 10 orders per 5 seconds.\n maxOrdersPerWindow: number;\n // Window size for maxOrdersPerWindow rate limit (seconds). Default: 5.\n orderWindowSeconds: number;\n // Enforce intraday-only trading (auto-close all positions before EOD). Default: false.\n dayTradeOnly: boolean;\n // Per-account multi-lane intraday preferences: the single carrier of the\naccount's lane opt-in (`armed`) and its per-lane caps, including the\ntrades-per-day cap (`perLaneTradesPerDay`). It is validated at the engine's\nread boundary by the strict IntradayLanePrefs schema in @adaptic/utils\n(trading-policy/schemas). NULL, a value that fails that schema, or an\nabsent cap means the lanes are disarmed for this account. One JSON carrier\ninstead of separate arming and cap columns keeps a single arming predicate,\nso there are no two homes for one setting that could disagree.\n\nIt is left out of every generated selection set (GQL.SKIP) on purpose. A\nGraphQL server that predates the column rejects any operation that\nselects it, and the TradingPolicy selection set feeds the engine's order\nchokepoint and broker-credential reads. Keeping the field out lets a\nconsumer of this package run against a server whether or not the\nmigration has been applied. It is read through `readIntradayLanePrefs`,\nwhose failure the lane path treats as disarmed, and written through the\ngenerated create and update inputs.\n intradayLanePrefs?: any;\n riskBudgetPrefs?: any;\n signalConsumptionPrefs?: any;\n executionPrefs?: any;\n positionManagementPrefs?: any;\n portfolioConstructionPrefs?: any;\n macroOverlayEnabled: boolean;\n sectorOverlayEnabled: boolean;\n volatilityOverlayEnabled: boolean;\n liquidityStressOverlayEnabled: boolean;\n blackSwanProtectionEnabled: boolean;\n drawdownGuardianEnabled: boolean;\n correlationSpikeProtectionEnabled: boolean;\n newsEventRiskOverlayEnabled: boolean;\n exchangeHealthOverlayEnabled: boolean;\n dataQualitySentinelEnabled: boolean;\n overlayResponsePrefs?: any;\n miniModelProvider?: LlmProvider;\n normalModelProvider?: LlmProvider;\n advancedModelProvider?: LlmProvider;\n modelPrefs?: any;\n auditNotificationPrefs?: any;\n // List of policy overlays.\n overlays: {\n overlayType: OverlayType;\n source: string;\n reason: string;\n severity: OverlaySeverity;\n version: number;\n mutations: any;\n status: OverlayStatus;\n activatedAt: Date;\n expiresAt?: Date;\n deactivatedAt?: Date;\n deactivatedBy?: string;\n }[];\n escalationPolicyOverrides?: any;\n currentRiskState: AccountRiskState;\n currentRiskStateAt?: Date;\n lastRiskStateChangedBy?: string;\n};\n\nenum AlpacaAccountType {\n PAPER\n\n LIVE\n}\n\nenum AutonomyMode {\n ADVISORY_ONLY\n\n EXECUTION_ON_APPROVAL\n\n SEMI_AUTONOMOUS\n\n FULLY_AUTONOMOUS\n\n EMERGENCY_SAFE_MODE\n}\n\nenum LlmProvider {\n OPENAI\n\n ANTHROPIC\n\n DEEPSEEK\n\n KIMI\n\n QWEN\n\n XAI\n\n GEMINI\n\n DEEPINFRA\n}\n\nenum OverlayType {\n BLACK_SWAN\n\n VOLATILITY_REGIME\n\n SECTOR_DETERIORATION\n\n DRAWDOWN_BREACH\n\n CORRELATION_SPIKE\n\n LIQUIDITY_STRESS\n\n EXCHANGE_DEGRADATION\n\n DATA_QUALITY\n\n NEWS_EVENT_RISK\n\n RATES_BONDS_STRESS\n\n MANUAL_OVERRIDE\n\n INCIDENT_RESPONSE\n}\n\nenum OverlaySeverity {\n LOW\n\n MEDIUM\n\n HIGH\n\n CRITICAL\n}\n\nenum OverlayStatus {\n ACTIVE\n\n EXPIRED\n\n DEACTIVATED\n\n SUPERSEDED\n}\n\nenum AccountRiskState {\n NORMAL\n\n WARN\n\n THROTTLE\n\n PAUSED\n\n FLATTEN\n\n HALT\n}\n\n";
2
2
  //# sourceMappingURL=TradingPolicy.d.ts.map
@@ -56,8 +56,8 @@ export declare const typeStrings: {
56
56
  readonly waitlistEntry: "\n// Your response should adhere to the following type definition for the \"WaitlistEntry\" type.\n// Importantly, DO NOT include any annotations in your response (i.e., remove the ones we have provided for your reference below).\n\nexport type WaitlistEntry = {\n // The email address of the person on the waitlist.\n email: string;\n // The full name of the person on the waitlist.\n fullName: string;\n // The company name of the person on the waitlist.\n companyName: string;\n // The company website URL (optional).\n companyWebsite?: string;\n // The job role/title of the person on the waitlist.\n jobRole: string;\n // Whether the person has confirmed they are a professional investor.\n professionalInvestorConfirmed: boolean;\n // The current status of the waitlist entry.\n status: WaitlistStatus;\n // The position in the waitlist queue.\n queuePosition: number;\n};\n\nenum WaitlistStatus {\n PENDING\n\n APPROVED\n\n REJECTED\n}\n\n";
57
57
  readonly inviteToken: "\n// Your response should adhere to the following type definition for the \"InviteToken\" type.\n// Importantly, DO NOT include any annotations in your response (i.e., remove the ones we have provided for your reference below).\n\nexport type InviteToken = {\n // The unique token string used for invitation.\n token: string;\n // The email address the token was generated for.\n email: string;\n // Whether the token has been used.\n used: boolean;\n};\n\n";
58
58
  readonly auditLog: "\n// Your response should adhere to the following type definition for the \"AuditLog\" type.\n// Importantly, DO NOT include any annotations in your response (i.e., remove the ones we have provided for your reference below).\n\nexport type AuditLog = {\n // The type of mutation operation performed.\n operationType: AuditOperationType;\n // The name of the Prisma model that was mutated.\n modelName: string;\n // JSON snapshot of the fields that were changed. For creates: all fields. For updates: changed fields with before/after values. For deletes: all fields at time of deletion.\n changedFields: any;\n // The GraphQL operation name that triggered the mutation, if available.\n operationName?: string;\n // Ledger position, assigned by the database from the `audit_logs_ledger_seq`\nsequence on insert and never by a caller (omitted from the create and\nupdate inputs). Strictly increasing across all rows, so increasing within\nevery fund, with gaps. Rows written before the ledger existed hold null:\nnumbering them would invent an order their timestamps do not establish.\nThe desk ledger id is `L-<ledgerSeq>`; a page before a cursor is\n`where: { fundId: { equals }, ledgerSeq: { lt } }`, `orderBy: [{ ledgerSeq: { sort: desc } }]`.\n@TypeGraphQL.omit(input: [\"create\", \"update\"])\n ledgerSeq?: any;\n};\n\nenum AuditOperationType {\n CREATE\n\n UPDATE\n\n DELETE\n}\n\n";
59
- readonly tradingPolicy: "\n// Your response should adhere to the following type definition for the \"TradingPolicy\" type.\n// Importantly, DO NOT include any annotations in your response (i.e., remove the ones we have provided for your reference below).\n\nexport type TradingPolicy = {\n // Relation to AlpacaAccount.\n alpacaAccount: {\n // The type of Alpaca account (PAPER or LIVE).\n type: AlpacaAccountType;\n // JSON configuration settings for the Alpaca account.\n configuration?: any;\n };\n version: number;\n lastModifiedBy?: string;\n lastModifiedAt: Date;\n autonomyMode: AutonomyMode;\n realtimeTradingEnabled: boolean;\n paperTradingOnly: boolean;\n killSwitchEnabled: boolean;\n autonomyPrefs?: any;\n equitiesEnabled: boolean;\n etfsEnabled: boolean;\n cryptoEnabled: boolean;\n optionsEnabled: boolean;\n futuresEnabled: boolean;\n forexEnabled: boolean;\n shortingEnabled: boolean;\n marginEnabled: boolean;\n fractionalSharesEnabled: boolean;\n assetUniversePrefs?: any;\n maxBuyingPowerUtilPct: number;\n cashFloorPct: number;\n maxGrossExposurePct: number;\n maxNetExposurePct: number;\n maxLeverage: number;\n maxSymbolConcentrationPct: number;\n maxSectorConcentrationPct: number;\n maxOpenPositions: number;\n maxOpenOrders: number;\n // Percentage of account equity (with leverage) allocated per equities trade. Canonical replacement for legacy AlpacaAccount.tradeAllocationPct.\n perTradeEquityAllocationPct: number;\n // Percentage of the crypto allocation slice of account equity allocated per crypto trade. Canonical replacement for legacy AlpacaAccount.cryptoTradeAllocationPct.\n perTradeCryptoAllocationPct: number;\n // Opt-in for enabling the portfolio-level trailing stop service within Adaptic's Realtime Trade Engine. Canonical replacement for legacy AlpacaAccount.enablePortfolioTrailingStop.\n enablePortfolioTrailingStop: boolean;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioTrailPercent.\n portfolioTrailPercent: number;\n // Portfolio-level profit threshold percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioProfitThresholdPercent.\n portfolioProfitThresholdPercent: number;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine for reducing the trailing stop once the profit threshold is exceeded. Canonical replacement for legacy AlpacaAccount.reducedPortfolioTrailPercent.\n reducedPortfolioTrailPercent: number;\n // Ordered ladder of portfolio trailing-stop rungs, generalising the single\nportfolioProfitThresholdPercent/reducedPortfolioTrailPercent pair above.\nShape: [{ \"thresholdPercent\": 0.35, \"trailPercent\": 0.25 }, ...] in WHOLE\nPERCENT of the session's opening equity (0.35 = 35bp), ordered ascending by\nthreshold. The engine applies min() across every rung whose threshold the\nsession high-water mark has reached, so the trail tightens monotonically and\na mis-ordered or wider rung can never loosen a stop that has already\ntightened. NULL = use the single legacy rung, which reproduces today's\nbehaviour exactly.\n portfolioTrailRungs?: any;\n // Local ET time (\"HH:MM\", 24h) at which the portfolio trailing-stop state\nre-anchors for a SECOND intraday round: open equity re-seeds from that\ntick, the high-water mark resets to zero and the trail returns to base.\nIntended for an afternoon session traded with freshly entered positions.\nNULL = single round per day, which is today's behaviour.\n portfolioAfternoonResetEt?: string;\n // Rung ladder for the afternoon round, same shape as portfolioTrailRungs.\nThe afternoon window is materially shorter than the morning, so the\nthresholds that are reachable within it differ and must be set from the\nafternoon's own distribution rather than inherited. NULL = reuse\nportfolioTrailRungs for the second round.\n portfolioAfternoonTrailRungs?: any;\n // Whether the portfolio-level daily take-profit circuit breaker is enabled for this account.\n enablePortfolioTakeProfit?: boolean;\n // Daily gain target (whole percent, e.g. 1 = 1%) since the 09:30 open that trips the take-profit breaker.\n portfolioTakeProfitThresholdPercent?: number;\n // Initial trailing stop percentage used by the Position Trailing Stop Service. Canonical replacement for legacy AlpacaAccount.defaultTrailingStopPercentage100.\n defaultTrailingStopPercentage100: number;\n // First profit threshold at which the Position Trailing Stop Service reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.firstTrailReductionThreshold100.\n firstTrailReductionThreshold100: number;\n // Second profit threshold at which the Position Trailing Stop Service further reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.secondTrailReductionThreshold100.\n secondTrailReductionThreshold100: number;\n // Trailing stop percentage to use when profit exceeds the first threshold. Canonical replacement for legacy AlpacaAccount.firstReducedTrailPercentage100.\n firstReducedTrailPercentage100: number;\n // Trailing stop percentage to use when profit exceeds the second threshold. Canonical replacement for legacy AlpacaAccount.secondReducedTrailPercentage100.\n secondReducedTrailPercentage100: number;\n // Minimum change in trailing stop percent to warrant an adjustment. Canonical replacement for legacy AlpacaAccount.minimumPriceChangePercent100.\n minimumPriceChangePercent100: number;\n // Wash-trade cooldown period in milliseconds for equities — minimum elapsed time between opposing-side fills on the same symbol per FINRA Rule 5210. Mirrors the 30s default already enforced for crypto. Default: 30000 (30 seconds).\n equityWashTradeCooldownMs: number;\n // Minimum intraday liquidity threshold (shares traded in last 5 min). Required for scalping. Default: 10000 (10k shares in last 5 min).\n minIntradayLiquidityShares: number;\n // Maximum spread in basis points (1/100ths of 1%) to allow entry. Scalping requires tight spreads; use 1-3 bps. Default: 5 (0.05%).\n maxEntrySpreadBps: number;\n // Minimum time between same-symbol same-side entries (ms). FINRA Rule 5210 requires 30s for opposite-side trades; this controls same-side rapid re-entry. Default: 5000 (5 seconds) for scalping; 30000 for normal trading.\n sameSideReentryDelayMs: number;\n // Volatility filter: only trade if ATR(14) >= minAtrPercentage. Scalping needs moderate volatility; too low = no edge. Default: 0.3 (0.3%).\n minAtrPercentage: number;\n // Volatility filter: only trade if ATR(14) <= maxAtrPercentage. Scalping needs moderate volatility; too high = whipsaws. Default: 2.0 (2.0%).\n maxAtrPercentage: number;\n // Order book depth requirement: minimum shares at best bid/ask to qualify for entry. Scalping needs guaranteed liquidity. Default: 5000 shares.\n minBookDepthShares: number;\n // Maximum market order slippage in basis points before flagging as anomaly. Helps detect liquidity crunches. Default: 10 bps.\n maxAnomalousSlippageBps: number;\n // Intraday session windows allowed (JSON array). Format: [{ startMinutesFromOpen, endMinutesFromOpen, active }]. Example: skip first 5 min and last 10 min of RTH.\n intradayTradingWindows?: any;\n // Hard position exit clock (minutes from entry). 0 = disabled. Forces liquidation regardless of signal. Useful for strict day-trading discipline. Default: 0.\n hardPositionExitMinutes: number;\n // Rapid-fire order-rate limit: max orders within orderWindowSeconds. Default: 10 orders per 5 seconds.\n maxOrdersPerWindow: number;\n // Window size for maxOrdersPerWindow rate limit (seconds). Default: 5.\n orderWindowSeconds: number;\n // Enforce intraday-only trading (auto-close all positions before EOD). Default: false.\n dayTradeOnly: boolean;\n riskBudgetPrefs?: any;\n signalConsumptionPrefs?: any;\n executionPrefs?: any;\n positionManagementPrefs?: any;\n portfolioConstructionPrefs?: any;\n macroOverlayEnabled: boolean;\n sectorOverlayEnabled: boolean;\n volatilityOverlayEnabled: boolean;\n liquidityStressOverlayEnabled: boolean;\n blackSwanProtectionEnabled: boolean;\n drawdownGuardianEnabled: boolean;\n correlationSpikeProtectionEnabled: boolean;\n newsEventRiskOverlayEnabled: boolean;\n exchangeHealthOverlayEnabled: boolean;\n dataQualitySentinelEnabled: boolean;\n overlayResponsePrefs?: any;\n miniModelProvider?: LlmProvider;\n normalModelProvider?: LlmProvider;\n advancedModelProvider?: LlmProvider;\n modelPrefs?: any;\n auditNotificationPrefs?: any;\n // List of policy overlays.\n overlays: {\n overlayType: OverlayType;\n source: string;\n reason: string;\n severity: OverlaySeverity;\n version: number;\n mutations: any;\n status: OverlayStatus;\n activatedAt: Date;\n expiresAt?: Date;\n deactivatedAt?: Date;\n deactivatedBy?: string;\n }[];\n escalationPolicyOverrides?: any;\n currentRiskState: AccountRiskState;\n currentRiskStateAt?: Date;\n lastRiskStateChangedBy?: string;\n};\n\nenum AlpacaAccountType {\n PAPER\n\n LIVE\n}\n\nenum AutonomyMode {\n ADVISORY_ONLY\n\n EXECUTION_ON_APPROVAL\n\n SEMI_AUTONOMOUS\n\n FULLY_AUTONOMOUS\n\n EMERGENCY_SAFE_MODE\n}\n\nenum LlmProvider {\n OPENAI\n\n ANTHROPIC\n\n DEEPSEEK\n\n KIMI\n\n QWEN\n\n XAI\n\n GEMINI\n\n DEEPINFRA\n}\n\nenum OverlayType {\n BLACK_SWAN\n\n VOLATILITY_REGIME\n\n SECTOR_DETERIORATION\n\n DRAWDOWN_BREACH\n\n CORRELATION_SPIKE\n\n LIQUIDITY_STRESS\n\n EXCHANGE_DEGRADATION\n\n DATA_QUALITY\n\n NEWS_EVENT_RISK\n\n RATES_BONDS_STRESS\n\n MANUAL_OVERRIDE\n\n INCIDENT_RESPONSE\n}\n\nenum OverlaySeverity {\n LOW\n\n MEDIUM\n\n HIGH\n\n CRITICAL\n}\n\nenum OverlayStatus {\n ACTIVE\n\n EXPIRED\n\n DEACTIVATED\n\n SUPERSEDED\n}\n\nenum AccountRiskState {\n NORMAL\n\n WARN\n\n THROTTLE\n\n PAUSED\n\n FLATTEN\n\n HALT\n}\n\n";
60
- readonly policyOverlay: "\n// Your response should adhere to the following type definition for the \"PolicyOverlay\" type.\n// Importantly, DO NOT include any annotations in your response (i.e., remove the ones we have provided for your reference below).\n\nexport type PolicyOverlay = {\n // Relation to TradingPolicy.\n tradingPolicy: {\n // Relation to AlpacaAccount.\n alpacaAccount: {\n // The type of Alpaca account (PAPER or LIVE).\n type: AlpacaAccountType;\n // JSON configuration settings for the Alpaca account.\n configuration?: any;\n };\n version: number;\n lastModifiedBy?: string;\n lastModifiedAt: Date;\n autonomyMode: AutonomyMode;\n realtimeTradingEnabled: boolean;\n paperTradingOnly: boolean;\n killSwitchEnabled: boolean;\n autonomyPrefs?: any;\n equitiesEnabled: boolean;\n etfsEnabled: boolean;\n cryptoEnabled: boolean;\n optionsEnabled: boolean;\n futuresEnabled: boolean;\n forexEnabled: boolean;\n shortingEnabled: boolean;\n marginEnabled: boolean;\n fractionalSharesEnabled: boolean;\n assetUniversePrefs?: any;\n maxBuyingPowerUtilPct: number;\n cashFloorPct: number;\n maxGrossExposurePct: number;\n maxNetExposurePct: number;\n maxLeverage: number;\n maxSymbolConcentrationPct: number;\n maxSectorConcentrationPct: number;\n maxOpenPositions: number;\n maxOpenOrders: number;\n // Percentage of account equity (with leverage) allocated per equities trade. Canonical replacement for legacy AlpacaAccount.tradeAllocationPct.\n perTradeEquityAllocationPct: number;\n // Percentage of the crypto allocation slice of account equity allocated per crypto trade. Canonical replacement for legacy AlpacaAccount.cryptoTradeAllocationPct.\n perTradeCryptoAllocationPct: number;\n // Opt-in for enabling the portfolio-level trailing stop service within Adaptic's Realtime Trade Engine. Canonical replacement for legacy AlpacaAccount.enablePortfolioTrailingStop.\n enablePortfolioTrailingStop: boolean;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioTrailPercent.\n portfolioTrailPercent: number;\n // Portfolio-level profit threshold percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioProfitThresholdPercent.\n portfolioProfitThresholdPercent: number;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine for reducing the trailing stop once the profit threshold is exceeded. Canonical replacement for legacy AlpacaAccount.reducedPortfolioTrailPercent.\n reducedPortfolioTrailPercent: number;\n // Ordered ladder of portfolio trailing-stop rungs, generalising the single\nportfolioProfitThresholdPercent/reducedPortfolioTrailPercent pair above.\nShape: [{ \"thresholdPercent\": 0.35, \"trailPercent\": 0.25 }, ...] in WHOLE\nPERCENT of the session's opening equity (0.35 = 35bp), ordered ascending by\nthreshold. The engine applies min() across every rung whose threshold the\nsession high-water mark has reached, so the trail tightens monotonically and\na mis-ordered or wider rung can never loosen a stop that has already\ntightened. NULL = use the single legacy rung, which reproduces today's\nbehaviour exactly.\n portfolioTrailRungs?: any;\n // Local ET time (\"HH:MM\", 24h) at which the portfolio trailing-stop state\nre-anchors for a SECOND intraday round: open equity re-seeds from that\ntick, the high-water mark resets to zero and the trail returns to base.\nIntended for an afternoon session traded with freshly entered positions.\nNULL = single round per day, which is today's behaviour.\n portfolioAfternoonResetEt?: string;\n // Rung ladder for the afternoon round, same shape as portfolioTrailRungs.\nThe afternoon window is materially shorter than the morning, so the\nthresholds that are reachable within it differ and must be set from the\nafternoon's own distribution rather than inherited. NULL = reuse\nportfolioTrailRungs for the second round.\n portfolioAfternoonTrailRungs?: any;\n // Whether the portfolio-level daily take-profit circuit breaker is enabled for this account.\n enablePortfolioTakeProfit?: boolean;\n // Daily gain target (whole percent, e.g. 1 = 1%) since the 09:30 open that trips the take-profit breaker.\n portfolioTakeProfitThresholdPercent?: number;\n // Initial trailing stop percentage used by the Position Trailing Stop Service. Canonical replacement for legacy AlpacaAccount.defaultTrailingStopPercentage100.\n defaultTrailingStopPercentage100: number;\n // First profit threshold at which the Position Trailing Stop Service reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.firstTrailReductionThreshold100.\n firstTrailReductionThreshold100: number;\n // Second profit threshold at which the Position Trailing Stop Service further reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.secondTrailReductionThreshold100.\n secondTrailReductionThreshold100: number;\n // Trailing stop percentage to use when profit exceeds the first threshold. Canonical replacement for legacy AlpacaAccount.firstReducedTrailPercentage100.\n firstReducedTrailPercentage100: number;\n // Trailing stop percentage to use when profit exceeds the second threshold. Canonical replacement for legacy AlpacaAccount.secondReducedTrailPercentage100.\n secondReducedTrailPercentage100: number;\n // Minimum change in trailing stop percent to warrant an adjustment. Canonical replacement for legacy AlpacaAccount.minimumPriceChangePercent100.\n minimumPriceChangePercent100: number;\n // Wash-trade cooldown period in milliseconds for equities — minimum elapsed time between opposing-side fills on the same symbol per FINRA Rule 5210. Mirrors the 30s default already enforced for crypto. Default: 30000 (30 seconds).\n equityWashTradeCooldownMs: number;\n // Minimum intraday liquidity threshold (shares traded in last 5 min). Required for scalping. Default: 10000 (10k shares in last 5 min).\n minIntradayLiquidityShares: number;\n // Maximum spread in basis points (1/100ths of 1%) to allow entry. Scalping requires tight spreads; use 1-3 bps. Default: 5 (0.05%).\n maxEntrySpreadBps: number;\n // Minimum time between same-symbol same-side entries (ms). FINRA Rule 5210 requires 30s for opposite-side trades; this controls same-side rapid re-entry. Default: 5000 (5 seconds) for scalping; 30000 for normal trading.\n sameSideReentryDelayMs: number;\n // Volatility filter: only trade if ATR(14) >= minAtrPercentage. Scalping needs moderate volatility; too low = no edge. Default: 0.3 (0.3%).\n minAtrPercentage: number;\n // Volatility filter: only trade if ATR(14) <= maxAtrPercentage. Scalping needs moderate volatility; too high = whipsaws. Default: 2.0 (2.0%).\n maxAtrPercentage: number;\n // Order book depth requirement: minimum shares at best bid/ask to qualify for entry. Scalping needs guaranteed liquidity. Default: 5000 shares.\n minBookDepthShares: number;\n // Maximum market order slippage in basis points before flagging as anomaly. Helps detect liquidity crunches. Default: 10 bps.\n maxAnomalousSlippageBps: number;\n // Intraday session windows allowed (JSON array). Format: [{ startMinutesFromOpen, endMinutesFromOpen, active }]. Example: skip first 5 min and last 10 min of RTH.\n intradayTradingWindows?: any;\n // Hard position exit clock (minutes from entry). 0 = disabled. Forces liquidation regardless of signal. Useful for strict day-trading discipline. Default: 0.\n hardPositionExitMinutes: number;\n // Rapid-fire order-rate limit: max orders within orderWindowSeconds. Default: 10 orders per 5 seconds.\n maxOrdersPerWindow: number;\n // Window size for maxOrdersPerWindow rate limit (seconds). Default: 5.\n orderWindowSeconds: number;\n // Enforce intraday-only trading (auto-close all positions before EOD). Default: false.\n dayTradeOnly: boolean;\n riskBudgetPrefs?: any;\n signalConsumptionPrefs?: any;\n executionPrefs?: any;\n positionManagementPrefs?: any;\n portfolioConstructionPrefs?: any;\n macroOverlayEnabled: boolean;\n sectorOverlayEnabled: boolean;\n volatilityOverlayEnabled: boolean;\n liquidityStressOverlayEnabled: boolean;\n blackSwanProtectionEnabled: boolean;\n drawdownGuardianEnabled: boolean;\n correlationSpikeProtectionEnabled: boolean;\n newsEventRiskOverlayEnabled: boolean;\n exchangeHealthOverlayEnabled: boolean;\n dataQualitySentinelEnabled: boolean;\n overlayResponsePrefs?: any;\n miniModelProvider?: LlmProvider;\n normalModelProvider?: LlmProvider;\n advancedModelProvider?: LlmProvider;\n modelPrefs?: any;\n auditNotificationPrefs?: any;\n // List of policy overlays.\n overlays: PolicyOverlay[];\n escalationPolicyOverrides?: any;\n currentRiskState: AccountRiskState;\n currentRiskStateAt?: Date;\n lastRiskStateChangedBy?: string;\n };\n overlayType: OverlayType;\n source: string;\n reason: string;\n severity: OverlaySeverity;\n version: number;\n mutations: any;\n status: OverlayStatus;\n activatedAt: Date;\n expiresAt?: Date;\n deactivatedAt?: Date;\n deactivatedBy?: string;\n};\n\nenum AlpacaAccountType {\n PAPER\n\n LIVE\n}\n\nenum AutonomyMode {\n ADVISORY_ONLY\n\n EXECUTION_ON_APPROVAL\n\n SEMI_AUTONOMOUS\n\n FULLY_AUTONOMOUS\n\n EMERGENCY_SAFE_MODE\n}\n\nenum LlmProvider {\n OPENAI\n\n ANTHROPIC\n\n DEEPSEEK\n\n KIMI\n\n QWEN\n\n XAI\n\n GEMINI\n\n DEEPINFRA\n}\n\nenum AccountRiskState {\n NORMAL\n\n WARN\n\n THROTTLE\n\n PAUSED\n\n FLATTEN\n\n HALT\n}\n\nenum OverlayType {\n BLACK_SWAN\n\n VOLATILITY_REGIME\n\n SECTOR_DETERIORATION\n\n DRAWDOWN_BREACH\n\n CORRELATION_SPIKE\n\n LIQUIDITY_STRESS\n\n EXCHANGE_DEGRADATION\n\n DATA_QUALITY\n\n NEWS_EVENT_RISK\n\n RATES_BONDS_STRESS\n\n MANUAL_OVERRIDE\n\n INCIDENT_RESPONSE\n}\n\nenum OverlaySeverity {\n LOW\n\n MEDIUM\n\n HIGH\n\n CRITICAL\n}\n\nenum OverlayStatus {\n ACTIVE\n\n EXPIRED\n\n DEACTIVATED\n\n SUPERSEDED\n}\n\n";
59
+ readonly tradingPolicy: "\n// Your response should adhere to the following type definition for the \"TradingPolicy\" type.\n// Importantly, DO NOT include any annotations in your response (i.e., remove the ones we have provided for your reference below).\n\nexport type TradingPolicy = {\n // Relation to AlpacaAccount.\n alpacaAccount: {\n // The type of Alpaca account (PAPER or LIVE).\n type: AlpacaAccountType;\n // JSON configuration settings for the Alpaca account.\n configuration?: any;\n };\n version: number;\n lastModifiedBy?: string;\n lastModifiedAt: Date;\n autonomyMode: AutonomyMode;\n realtimeTradingEnabled: boolean;\n paperTradingOnly: boolean;\n killSwitchEnabled: boolean;\n autonomyPrefs?: any;\n equitiesEnabled: boolean;\n etfsEnabled: boolean;\n cryptoEnabled: boolean;\n optionsEnabled: boolean;\n futuresEnabled: boolean;\n forexEnabled: boolean;\n shortingEnabled: boolean;\n marginEnabled: boolean;\n fractionalSharesEnabled: boolean;\n assetUniversePrefs?: any;\n maxBuyingPowerUtilPct: number;\n cashFloorPct: number;\n maxGrossExposurePct: number;\n maxNetExposurePct: number;\n maxLeverage: number;\n maxSymbolConcentrationPct: number;\n maxSectorConcentrationPct: number;\n maxOpenPositions: number;\n maxOpenOrders: number;\n // Percentage of account equity (with leverage) allocated per equities trade. Canonical replacement for legacy AlpacaAccount.tradeAllocationPct.\n perTradeEquityAllocationPct: number;\n // Percentage of the crypto allocation slice of account equity allocated per crypto trade. Canonical replacement for legacy AlpacaAccount.cryptoTradeAllocationPct.\n perTradeCryptoAllocationPct: number;\n // Opt-in for enabling the portfolio-level trailing stop service within Adaptic's Realtime Trade Engine. Canonical replacement for legacy AlpacaAccount.enablePortfolioTrailingStop.\n enablePortfolioTrailingStop: boolean;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioTrailPercent.\n portfolioTrailPercent: number;\n // Portfolio-level profit threshold percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioProfitThresholdPercent.\n portfolioProfitThresholdPercent: number;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine for reducing the trailing stop once the profit threshold is exceeded. Canonical replacement for legacy AlpacaAccount.reducedPortfolioTrailPercent.\n reducedPortfolioTrailPercent: number;\n // Ordered ladder of portfolio trailing-stop rungs, generalising the single\nportfolioProfitThresholdPercent/reducedPortfolioTrailPercent pair above.\nShape: [{ \"thresholdPercent\": 0.35, \"trailPercent\": 0.25 }, ...] in WHOLE\nPERCENT of the session's opening equity (0.35 = 35bp), ordered ascending by\nthreshold. The engine applies min() across every rung whose threshold the\nsession high-water mark has reached, so the trail tightens monotonically and\na mis-ordered or wider rung can never loosen a stop that has already\ntightened. NULL = use the single legacy rung, which reproduces today's\nbehaviour exactly.\n portfolioTrailRungs?: any;\n // Local ET time (\"HH:MM\", 24h) at which the portfolio trailing-stop state\nre-anchors for a SECOND intraday round: open equity re-seeds from that\ntick, the high-water mark resets to zero and the trail returns to base.\nIntended for an afternoon session traded with freshly entered positions.\nNULL = single round per day, which is today's behaviour.\n portfolioAfternoonResetEt?: string;\n // Rung ladder for the afternoon round, same shape as portfolioTrailRungs.\nThe afternoon window is materially shorter than the morning, so the\nthresholds that are reachable within it differ and must be set from the\nafternoon's own distribution rather than inherited. NULL = reuse\nportfolioTrailRungs for the second round.\n portfolioAfternoonTrailRungs?: any;\n // Whether the portfolio-level daily take-profit circuit breaker is enabled for this account.\n enablePortfolioTakeProfit?: boolean;\n // Daily gain target (whole percent, e.g. 1 = 1%) since the 09:30 open that trips the take-profit breaker.\n portfolioTakeProfitThresholdPercent?: number;\n // Initial trailing stop percentage used by the Position Trailing Stop Service. Canonical replacement for legacy AlpacaAccount.defaultTrailingStopPercentage100.\n defaultTrailingStopPercentage100: number;\n // First profit threshold at which the Position Trailing Stop Service reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.firstTrailReductionThreshold100.\n firstTrailReductionThreshold100: number;\n // Second profit threshold at which the Position Trailing Stop Service further reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.secondTrailReductionThreshold100.\n secondTrailReductionThreshold100: number;\n // Trailing stop percentage to use when profit exceeds the first threshold. Canonical replacement for legacy AlpacaAccount.firstReducedTrailPercentage100.\n firstReducedTrailPercentage100: number;\n // Trailing stop percentage to use when profit exceeds the second threshold. Canonical replacement for legacy AlpacaAccount.secondReducedTrailPercentage100.\n secondReducedTrailPercentage100: number;\n // Minimum change in trailing stop percent to warrant an adjustment. Canonical replacement for legacy AlpacaAccount.minimumPriceChangePercent100.\n minimumPriceChangePercent100: number;\n // Wash-trade cooldown period in milliseconds for equities — minimum elapsed time between opposing-side fills on the same symbol per FINRA Rule 5210. Mirrors the 30s default already enforced for crypto. Default: 30000 (30 seconds).\n equityWashTradeCooldownMs: number;\n // Minimum intraday liquidity threshold (shares traded in last 5 min). Required for scalping. Default: 10000 (10k shares in last 5 min).\n minIntradayLiquidityShares: number;\n // Maximum spread in basis points (1/100ths of 1%) to allow entry. Scalping requires tight spreads; use 1-3 bps. Default: 5 (0.05%).\n maxEntrySpreadBps: number;\n // Minimum time between same-symbol same-side entries (ms). FINRA Rule 5210 requires 30s for opposite-side trades; this controls same-side rapid re-entry. Default: 5000 (5 seconds) for scalping; 30000 for normal trading.\n sameSideReentryDelayMs: number;\n // Volatility filter: only trade if ATR(14) >= minAtrPercentage. Scalping needs moderate volatility; too low = no edge. Default: 0.3 (0.3%).\n minAtrPercentage: number;\n // Volatility filter: only trade if ATR(14) <= maxAtrPercentage. Scalping needs moderate volatility; too high = whipsaws. Default: 2.0 (2.0%).\n maxAtrPercentage: number;\n // Order book depth requirement: minimum shares at best bid/ask to qualify for entry. Scalping needs guaranteed liquidity. Default: 5000 shares.\n minBookDepthShares: number;\n // Maximum market order slippage in basis points before flagging as anomaly. Helps detect liquidity crunches. Default: 10 bps.\n maxAnomalousSlippageBps: number;\n // Intraday session windows allowed (JSON array). Format: [{ startMinutesFromOpen, endMinutesFromOpen, active }]. Example: skip first 5 min and last 10 min of RTH.\n intradayTradingWindows?: any;\n // Hard position exit clock (minutes from entry). 0 = disabled. Forces liquidation regardless of signal. Useful for strict day-trading discipline. Default: 0.\n hardPositionExitMinutes: number;\n // Rapid-fire order-rate limit: max orders within orderWindowSeconds. Default: 10 orders per 5 seconds.\n maxOrdersPerWindow: number;\n // Window size for maxOrdersPerWindow rate limit (seconds). Default: 5.\n orderWindowSeconds: number;\n // Enforce intraday-only trading (auto-close all positions before EOD). Default: false.\n dayTradeOnly: boolean;\n // Per-account multi-lane intraday preferences: the single carrier of the\naccount's lane opt-in (`armed`) and its per-lane caps, including the\ntrades-per-day cap (`perLaneTradesPerDay`). It is validated at the engine's\nread boundary by the strict IntradayLanePrefs schema in @adaptic/utils\n(trading-policy/schemas). NULL, a value that fails that schema, or an\nabsent cap means the lanes are disarmed for this account. One JSON carrier\ninstead of separate arming and cap columns keeps a single arming predicate,\nso there are no two homes for one setting that could disagree.\n\nIt is left out of every generated selection set (GQL.SKIP) on purpose. A\nGraphQL server that predates the column rejects any operation that\nselects it, and the TradingPolicy selection set feeds the engine's order\nchokepoint and broker-credential reads. Keeping the field out lets a\nconsumer of this package run against a server whether or not the\nmigration has been applied. It is read through `readIntradayLanePrefs`,\nwhose failure the lane path treats as disarmed, and written through the\ngenerated create and update inputs.\n intradayLanePrefs?: any;\n riskBudgetPrefs?: any;\n signalConsumptionPrefs?: any;\n executionPrefs?: any;\n positionManagementPrefs?: any;\n portfolioConstructionPrefs?: any;\n macroOverlayEnabled: boolean;\n sectorOverlayEnabled: boolean;\n volatilityOverlayEnabled: boolean;\n liquidityStressOverlayEnabled: boolean;\n blackSwanProtectionEnabled: boolean;\n drawdownGuardianEnabled: boolean;\n correlationSpikeProtectionEnabled: boolean;\n newsEventRiskOverlayEnabled: boolean;\n exchangeHealthOverlayEnabled: boolean;\n dataQualitySentinelEnabled: boolean;\n overlayResponsePrefs?: any;\n miniModelProvider?: LlmProvider;\n normalModelProvider?: LlmProvider;\n advancedModelProvider?: LlmProvider;\n modelPrefs?: any;\n auditNotificationPrefs?: any;\n // List of policy overlays.\n overlays: {\n overlayType: OverlayType;\n source: string;\n reason: string;\n severity: OverlaySeverity;\n version: number;\n mutations: any;\n status: OverlayStatus;\n activatedAt: Date;\n expiresAt?: Date;\n deactivatedAt?: Date;\n deactivatedBy?: string;\n }[];\n escalationPolicyOverrides?: any;\n currentRiskState: AccountRiskState;\n currentRiskStateAt?: Date;\n lastRiskStateChangedBy?: string;\n};\n\nenum AlpacaAccountType {\n PAPER\n\n LIVE\n}\n\nenum AutonomyMode {\n ADVISORY_ONLY\n\n EXECUTION_ON_APPROVAL\n\n SEMI_AUTONOMOUS\n\n FULLY_AUTONOMOUS\n\n EMERGENCY_SAFE_MODE\n}\n\nenum LlmProvider {\n OPENAI\n\n ANTHROPIC\n\n DEEPSEEK\n\n KIMI\n\n QWEN\n\n XAI\n\n GEMINI\n\n DEEPINFRA\n}\n\nenum OverlayType {\n BLACK_SWAN\n\n VOLATILITY_REGIME\n\n SECTOR_DETERIORATION\n\n DRAWDOWN_BREACH\n\n CORRELATION_SPIKE\n\n LIQUIDITY_STRESS\n\n EXCHANGE_DEGRADATION\n\n DATA_QUALITY\n\n NEWS_EVENT_RISK\n\n RATES_BONDS_STRESS\n\n MANUAL_OVERRIDE\n\n INCIDENT_RESPONSE\n}\n\nenum OverlaySeverity {\n LOW\n\n MEDIUM\n\n HIGH\n\n CRITICAL\n}\n\nenum OverlayStatus {\n ACTIVE\n\n EXPIRED\n\n DEACTIVATED\n\n SUPERSEDED\n}\n\nenum AccountRiskState {\n NORMAL\n\n WARN\n\n THROTTLE\n\n PAUSED\n\n FLATTEN\n\n HALT\n}\n\n";
60
+ readonly policyOverlay: "\n// Your response should adhere to the following type definition for the \"PolicyOverlay\" type.\n// Importantly, DO NOT include any annotations in your response (i.e., remove the ones we have provided for your reference below).\n\nexport type PolicyOverlay = {\n // Relation to TradingPolicy.\n tradingPolicy: {\n // Relation to AlpacaAccount.\n alpacaAccount: {\n // The type of Alpaca account (PAPER or LIVE).\n type: AlpacaAccountType;\n // JSON configuration settings for the Alpaca account.\n configuration?: any;\n };\n version: number;\n lastModifiedBy?: string;\n lastModifiedAt: Date;\n autonomyMode: AutonomyMode;\n realtimeTradingEnabled: boolean;\n paperTradingOnly: boolean;\n killSwitchEnabled: boolean;\n autonomyPrefs?: any;\n equitiesEnabled: boolean;\n etfsEnabled: boolean;\n cryptoEnabled: boolean;\n optionsEnabled: boolean;\n futuresEnabled: boolean;\n forexEnabled: boolean;\n shortingEnabled: boolean;\n marginEnabled: boolean;\n fractionalSharesEnabled: boolean;\n assetUniversePrefs?: any;\n maxBuyingPowerUtilPct: number;\n cashFloorPct: number;\n maxGrossExposurePct: number;\n maxNetExposurePct: number;\n maxLeverage: number;\n maxSymbolConcentrationPct: number;\n maxSectorConcentrationPct: number;\n maxOpenPositions: number;\n maxOpenOrders: number;\n // Percentage of account equity (with leverage) allocated per equities trade. Canonical replacement for legacy AlpacaAccount.tradeAllocationPct.\n perTradeEquityAllocationPct: number;\n // Percentage of the crypto allocation slice of account equity allocated per crypto trade. Canonical replacement for legacy AlpacaAccount.cryptoTradeAllocationPct.\n perTradeCryptoAllocationPct: number;\n // Opt-in for enabling the portfolio-level trailing stop service within Adaptic's Realtime Trade Engine. Canonical replacement for legacy AlpacaAccount.enablePortfolioTrailingStop.\n enablePortfolioTrailingStop: boolean;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioTrailPercent.\n portfolioTrailPercent: number;\n // Portfolio-level profit threshold percentage used by the Realtime Trade Engine, if opted into the portfolio-level trailing stop service. Canonical replacement for legacy AlpacaAccount.portfolioProfitThresholdPercent.\n portfolioProfitThresholdPercent: number;\n // Portfolio-level trailing stop percentage used by the Realtime Trade Engine for reducing the trailing stop once the profit threshold is exceeded. Canonical replacement for legacy AlpacaAccount.reducedPortfolioTrailPercent.\n reducedPortfolioTrailPercent: number;\n // Ordered ladder of portfolio trailing-stop rungs, generalising the single\nportfolioProfitThresholdPercent/reducedPortfolioTrailPercent pair above.\nShape: [{ \"thresholdPercent\": 0.35, \"trailPercent\": 0.25 }, ...] in WHOLE\nPERCENT of the session's opening equity (0.35 = 35bp), ordered ascending by\nthreshold. The engine applies min() across every rung whose threshold the\nsession high-water mark has reached, so the trail tightens monotonically and\na mis-ordered or wider rung can never loosen a stop that has already\ntightened. NULL = use the single legacy rung, which reproduces today's\nbehaviour exactly.\n portfolioTrailRungs?: any;\n // Local ET time (\"HH:MM\", 24h) at which the portfolio trailing-stop state\nre-anchors for a SECOND intraday round: open equity re-seeds from that\ntick, the high-water mark resets to zero and the trail returns to base.\nIntended for an afternoon session traded with freshly entered positions.\nNULL = single round per day, which is today's behaviour.\n portfolioAfternoonResetEt?: string;\n // Rung ladder for the afternoon round, same shape as portfolioTrailRungs.\nThe afternoon window is materially shorter than the morning, so the\nthresholds that are reachable within it differ and must be set from the\nafternoon's own distribution rather than inherited. NULL = reuse\nportfolioTrailRungs for the second round.\n portfolioAfternoonTrailRungs?: any;\n // Whether the portfolio-level daily take-profit circuit breaker is enabled for this account.\n enablePortfolioTakeProfit?: boolean;\n // Daily gain target (whole percent, e.g. 1 = 1%) since the 09:30 open that trips the take-profit breaker.\n portfolioTakeProfitThresholdPercent?: number;\n // Initial trailing stop percentage used by the Position Trailing Stop Service. Canonical replacement for legacy AlpacaAccount.defaultTrailingStopPercentage100.\n defaultTrailingStopPercentage100: number;\n // First profit threshold at which the Position Trailing Stop Service reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.firstTrailReductionThreshold100.\n firstTrailReductionThreshold100: number;\n // Second profit threshold at which the Position Trailing Stop Service further reduces the trailing stop. Canonical replacement for legacy AlpacaAccount.secondTrailReductionThreshold100.\n secondTrailReductionThreshold100: number;\n // Trailing stop percentage to use when profit exceeds the first threshold. Canonical replacement for legacy AlpacaAccount.firstReducedTrailPercentage100.\n firstReducedTrailPercentage100: number;\n // Trailing stop percentage to use when profit exceeds the second threshold. Canonical replacement for legacy AlpacaAccount.secondReducedTrailPercentage100.\n secondReducedTrailPercentage100: number;\n // Minimum change in trailing stop percent to warrant an adjustment. Canonical replacement for legacy AlpacaAccount.minimumPriceChangePercent100.\n minimumPriceChangePercent100: number;\n // Wash-trade cooldown period in milliseconds for equities — minimum elapsed time between opposing-side fills on the same symbol per FINRA Rule 5210. Mirrors the 30s default already enforced for crypto. Default: 30000 (30 seconds).\n equityWashTradeCooldownMs: number;\n // Minimum intraday liquidity threshold (shares traded in last 5 min). Required for scalping. Default: 10000 (10k shares in last 5 min).\n minIntradayLiquidityShares: number;\n // Maximum spread in basis points (1/100ths of 1%) to allow entry. Scalping requires tight spreads; use 1-3 bps. Default: 5 (0.05%).\n maxEntrySpreadBps: number;\n // Minimum time between same-symbol same-side entries (ms). FINRA Rule 5210 requires 30s for opposite-side trades; this controls same-side rapid re-entry. Default: 5000 (5 seconds) for scalping; 30000 for normal trading.\n sameSideReentryDelayMs: number;\n // Volatility filter: only trade if ATR(14) >= minAtrPercentage. Scalping needs moderate volatility; too low = no edge. Default: 0.3 (0.3%).\n minAtrPercentage: number;\n // Volatility filter: only trade if ATR(14) <= maxAtrPercentage. Scalping needs moderate volatility; too high = whipsaws. Default: 2.0 (2.0%).\n maxAtrPercentage: number;\n // Order book depth requirement: minimum shares at best bid/ask to qualify for entry. Scalping needs guaranteed liquidity. Default: 5000 shares.\n minBookDepthShares: number;\n // Maximum market order slippage in basis points before flagging as anomaly. Helps detect liquidity crunches. Default: 10 bps.\n maxAnomalousSlippageBps: number;\n // Intraday session windows allowed (JSON array). Format: [{ startMinutesFromOpen, endMinutesFromOpen, active }]. Example: skip first 5 min and last 10 min of RTH.\n intradayTradingWindows?: any;\n // Hard position exit clock (minutes from entry). 0 = disabled. Forces liquidation regardless of signal. Useful for strict day-trading discipline. Default: 0.\n hardPositionExitMinutes: number;\n // Rapid-fire order-rate limit: max orders within orderWindowSeconds. Default: 10 orders per 5 seconds.\n maxOrdersPerWindow: number;\n // Window size for maxOrdersPerWindow rate limit (seconds). Default: 5.\n orderWindowSeconds: number;\n // Enforce intraday-only trading (auto-close all positions before EOD). Default: false.\n dayTradeOnly: boolean;\n // Per-account multi-lane intraday preferences: the single carrier of the\naccount's lane opt-in (`armed`) and its per-lane caps, including the\ntrades-per-day cap (`perLaneTradesPerDay`). It is validated at the engine's\nread boundary by the strict IntradayLanePrefs schema in @adaptic/utils\n(trading-policy/schemas). NULL, a value that fails that schema, or an\nabsent cap means the lanes are disarmed for this account. One JSON carrier\ninstead of separate arming and cap columns keeps a single arming predicate,\nso there are no two homes for one setting that could disagree.\n\nIt is left out of every generated selection set (GQL.SKIP) on purpose. A\nGraphQL server that predates the column rejects any operation that\nselects it, and the TradingPolicy selection set feeds the engine's order\nchokepoint and broker-credential reads. Keeping the field out lets a\nconsumer of this package run against a server whether or not the\nmigration has been applied. It is read through `readIntradayLanePrefs`,\nwhose failure the lane path treats as disarmed, and written through the\ngenerated create and update inputs.\n intradayLanePrefs?: any;\n riskBudgetPrefs?: any;\n signalConsumptionPrefs?: any;\n executionPrefs?: any;\n positionManagementPrefs?: any;\n portfolioConstructionPrefs?: any;\n macroOverlayEnabled: boolean;\n sectorOverlayEnabled: boolean;\n volatilityOverlayEnabled: boolean;\n liquidityStressOverlayEnabled: boolean;\n blackSwanProtectionEnabled: boolean;\n drawdownGuardianEnabled: boolean;\n correlationSpikeProtectionEnabled: boolean;\n newsEventRiskOverlayEnabled: boolean;\n exchangeHealthOverlayEnabled: boolean;\n dataQualitySentinelEnabled: boolean;\n overlayResponsePrefs?: any;\n miniModelProvider?: LlmProvider;\n normalModelProvider?: LlmProvider;\n advancedModelProvider?: LlmProvider;\n modelPrefs?: any;\n auditNotificationPrefs?: any;\n // List of policy overlays.\n overlays: PolicyOverlay[];\n escalationPolicyOverrides?: any;\n currentRiskState: AccountRiskState;\n currentRiskStateAt?: Date;\n lastRiskStateChangedBy?: string;\n };\n overlayType: OverlayType;\n source: string;\n reason: string;\n severity: OverlaySeverity;\n version: number;\n mutations: any;\n status: OverlayStatus;\n activatedAt: Date;\n expiresAt?: Date;\n deactivatedAt?: Date;\n deactivatedBy?: string;\n};\n\nenum AlpacaAccountType {\n PAPER\n\n LIVE\n}\n\nenum AutonomyMode {\n ADVISORY_ONLY\n\n EXECUTION_ON_APPROVAL\n\n SEMI_AUTONOMOUS\n\n FULLY_AUTONOMOUS\n\n EMERGENCY_SAFE_MODE\n}\n\nenum LlmProvider {\n OPENAI\n\n ANTHROPIC\n\n DEEPSEEK\n\n KIMI\n\n QWEN\n\n XAI\n\n GEMINI\n\n DEEPINFRA\n}\n\nenum AccountRiskState {\n NORMAL\n\n WARN\n\n THROTTLE\n\n PAUSED\n\n FLATTEN\n\n HALT\n}\n\nenum OverlayType {\n BLACK_SWAN\n\n VOLATILITY_REGIME\n\n SECTOR_DETERIORATION\n\n DRAWDOWN_BREACH\n\n CORRELATION_SPIKE\n\n LIQUIDITY_STRESS\n\n EXCHANGE_DEGRADATION\n\n DATA_QUALITY\n\n NEWS_EVENT_RISK\n\n RATES_BONDS_STRESS\n\n MANUAL_OVERRIDE\n\n INCIDENT_RESPONSE\n}\n\nenum OverlaySeverity {\n LOW\n\n MEDIUM\n\n HIGH\n\n CRITICAL\n}\n\nenum OverlayStatus {\n ACTIVE\n\n EXPIRED\n\n DEACTIVATED\n\n SUPERSEDED\n}\n\n";
61
61
  readonly accountDecisionRecord: "\n// Your response should adhere to the following type definition for the \"AccountDecisionRecord\" type.\n// Importantly, DO NOT include any annotations in your response (i.e., remove the ones we have provided for your reference below).\n\nexport type AccountDecisionRecord = {\n symbol: string;\n assetClass: string;\n signalAction: string;\n signalConfidence: number;\n decision: DecisionOutcome;\n decisionRationale?: string;\n decisionConfidence?: number;\n actionIntents?: any;\n validationResults?: any;\n executionResults?: any;\n effectivePolicySnapshot: any;\n positionsSnapshot?: any;\n openOrdersSnapshot?: any;\n exposureSnapshot?: any;\n overlaysSnapshot?: any;\n modelProvider: string;\n modelTier: string;\n routingReason?: string;\n tokenUsage?: any;\n sessionDurationMs?: number;\n gatingDurationMs?: number;\n validationDurationMs?: number;\n executionDurationMs?: number;\n status: DecisionRecordStatus;\n};\n\nenum DecisionOutcome {\n DO_NOTHING\n\n OPEN_POSITION\n\n ADD_TO_POSITION\n\n REDUCE_POSITION\n\n CLOSE_POSITION\n\n REVERSE_POSITION\n\n MODIFY_ORDERS\n\n CANCEL_ORDERS\n\n REBALANCE\n\n MUTATE_POLICY\n\n ESCALATE_FOR_APPROVAL\n\n SKIP_INELIGIBLE\n}\n\nenum DecisionRecordStatus {\n PENDING\n\n EXECUTING\n\n COMPLETED\n\n FAILED\n\n CANCELLED\n\n ESCALATED\n}\n\n";
62
62
  readonly decisionMemorySummary: "\n// Your response should adhere to the following type definition for the \"DecisionMemorySummary\" type.\n// Importantly, DO NOT include any annotations in your response (i.e., remove the ones we have provided for your reference below).\n\nexport type DecisionMemorySummary = {\n symbol?: string;\n sector?: string;\n assetClass?: string;\n summary: string;\n keyFactors?: any;\n outcome: DecisionMemoryOutcome;\n outcomeDetails?: any;\n relevanceScore: number;\n expiresAt?: Date;\n};\n\nenum DecisionMemoryOutcome {\n PENDING\n\n PROFITABLE\n\n UNPROFITABLE\n\n STOPPED_OUT\n\n CANCELLED\n}\n\n";
63
63
  readonly equityBar: "\n// Your response should adhere to the following type definition for the \"EquityBar\" type.\n// Importantly, DO NOT include any annotations in your response (i.e., remove the ones we have provided for your reference below).\n\nexport type EquityBar = {\n symbol: string;\n timeStamp: any;\n timespan: EquityBarTimespan;\n open: number;\n high: number;\n low: number;\n close: number;\n vol: number;\n vwap?: number;\n trades?: number;\n source: string;\n};\n\nenum EquityBarTimespan {\n second\n\n minute\n\n hour\n\n day\n}\n\n";