@secapi/cli 0.3.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +173 -0
- package/dist/index.js +3533 -191
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { homedir } from "node:os";
|
|
6
|
+
import { dirname, join } from "node:path";
|
|
7
|
+
|
|
3
8
|
// src/generated-contracts/agent-prompts.ts
|
|
4
9
|
var AGENT_PROMPT_PERSONAS = [
|
|
5
10
|
"law-firm",
|
|
@@ -15295,12 +15300,23 @@ var responseMetadataSchema = exports_external.object({
|
|
|
15295
15300
|
requestId: exports_external.string(),
|
|
15296
15301
|
traceparent: exports_external.string().nullable().optional()
|
|
15297
15302
|
});
|
|
15303
|
+
var freshnessStatusSchema = exports_external.enum([
|
|
15304
|
+
"fresh",
|
|
15305
|
+
"current",
|
|
15306
|
+
"archival",
|
|
15307
|
+
"stale",
|
|
15308
|
+
"degraded",
|
|
15309
|
+
"unknown"
|
|
15310
|
+
]);
|
|
15298
15311
|
var freshnessMetadataSchema = exports_external.object({
|
|
15299
|
-
status:
|
|
15312
|
+
status: freshnessStatusSchema,
|
|
15300
15313
|
asOf: exports_external.string(),
|
|
15301
15314
|
sourcePublishedAt: exports_external.string().nullable().optional(),
|
|
15302
15315
|
lagMs: exports_external.number().int().nonnegative().nullable().optional()
|
|
15303
15316
|
});
|
|
15317
|
+
var DEFAULT_FILING_FRESH_MS = 24 * 60 * 60 * 1000;
|
|
15318
|
+
var DEFAULT_FILING_DEGRADED_MS = 72 * 60 * 60 * 1000;
|
|
15319
|
+
var DEFAULT_FILING_ARCHIVAL_AGE_MS = 30 * 24 * 60 * 60 * 1000;
|
|
15304
15320
|
var materializationMetadataSchema = exports_external.object({
|
|
15305
15321
|
parserVersion: exports_external.string(),
|
|
15306
15322
|
materializationVersion: exports_external.string()
|
|
@@ -15407,7 +15423,7 @@ var validationStatusSchema = exports_external.object({
|
|
|
15407
15423
|
var dataQualityFreshnessSchema = exports_external.object({
|
|
15408
15424
|
latestObservationAt: exports_external.string().nullable(),
|
|
15409
15425
|
averageLagMs: exports_external.number().nonnegative().nullable(),
|
|
15410
|
-
status:
|
|
15426
|
+
status: freshnessStatusSchema,
|
|
15411
15427
|
observationCount: exports_external.number().int().nonnegative()
|
|
15412
15428
|
});
|
|
15413
15429
|
var dataQualityCompletenessSchema = exports_external.object({
|
|
@@ -15583,6 +15599,21 @@ var statementRowSchema = exports_external.object({
|
|
|
15583
15599
|
unit: exports_external.string().nullable(),
|
|
15584
15600
|
values: exports_external.array(statementValueSchema)
|
|
15585
15601
|
});
|
|
15602
|
+
var compactStatementRowSchema = exports_external.object({
|
|
15603
|
+
key: exports_external.string().nullable(),
|
|
15604
|
+
label: exports_external.string().nullable().optional(),
|
|
15605
|
+
unit: exports_external.string().nullable(),
|
|
15606
|
+
values: exports_external.array(exports_external.number().nullable())
|
|
15607
|
+
});
|
|
15608
|
+
var compactStatementSchema = exports_external.object({
|
|
15609
|
+
ticker: exports_external.string().nullable(),
|
|
15610
|
+
statementKey: exports_external.string().nullable(),
|
|
15611
|
+
period: exports_external.enum(["annual", "quarterly"]).nullable(),
|
|
15612
|
+
periods: exports_external.array(statementPeriodSchema),
|
|
15613
|
+
rows: exports_external.array(compactStatementRowSchema),
|
|
15614
|
+
requestId: exports_external.string().optional(),
|
|
15615
|
+
traceparent: exports_external.string().nullable().optional()
|
|
15616
|
+
});
|
|
15586
15617
|
var statementSchema = exports_external.object({
|
|
15587
15618
|
object: exports_external.literal("statement"),
|
|
15588
15619
|
id: exports_external.string(),
|
|
@@ -16897,6 +16928,14 @@ var billingBudgetSchema = exports_external.object({
|
|
|
16897
16928
|
hardCapReached: exports_external.boolean(),
|
|
16898
16929
|
lineItems: exports_external.array(billingBudgetLineItemSchema)
|
|
16899
16930
|
});
|
|
16931
|
+
var monthlyQuotaSnapshotSchema = exports_external.object({
|
|
16932
|
+
family: exports_external.string(),
|
|
16933
|
+
limit: exports_external.number().int(),
|
|
16934
|
+
used: exports_external.number().int(),
|
|
16935
|
+
remaining: exports_external.number().int(),
|
|
16936
|
+
resetAt: exports_external.string(),
|
|
16937
|
+
graceUntil: exports_external.string().nullable()
|
|
16938
|
+
});
|
|
16900
16939
|
var billingBudgetGateSchema = exports_external.object({
|
|
16901
16940
|
code: exports_external.string(),
|
|
16902
16941
|
status: exports_external.number().int(),
|
|
@@ -16924,6 +16963,7 @@ var billingAccountSchema = exports_external.object({
|
|
|
16924
16963
|
plans: exports_external.array(billingPlanSchema),
|
|
16925
16964
|
settlement: billingSettlementSchema,
|
|
16926
16965
|
budget: billingBudgetSchema,
|
|
16966
|
+
monthlyQuotas: exports_external.record(exports_external.string(), monthlyQuotaSnapshotSchema),
|
|
16927
16967
|
requestId: exports_external.string().optional()
|
|
16928
16968
|
});
|
|
16929
16969
|
var billingQuoteSchema = exports_external.object({
|
|
@@ -16975,6 +17015,75 @@ var dashboardPrincipalSchema = exports_external.object({
|
|
|
16975
17015
|
scopes: exports_external.array(exports_external.string()),
|
|
16976
17016
|
livemode: exports_external.boolean()
|
|
16977
17017
|
}).passthrough();
|
|
17018
|
+
var dashboardSettingsPrincipalSchema = exports_external.object({
|
|
17019
|
+
principalId: exports_external.string(),
|
|
17020
|
+
subject: exports_external.string(),
|
|
17021
|
+
orgId: exports_external.string().nullable(),
|
|
17022
|
+
authMode: exports_external.string(),
|
|
17023
|
+
scopes: exports_external.array(exports_external.string()),
|
|
17024
|
+
livemode: exports_external.boolean()
|
|
17025
|
+
});
|
|
17026
|
+
var dashboardOverviewSummarySchema = exports_external.object({
|
|
17027
|
+
object: exports_external.literal("dashboard_overview_summary"),
|
|
17028
|
+
recordedAt: exports_external.string(),
|
|
17029
|
+
privateBeta: exports_external.object({
|
|
17030
|
+
object: exports_external.literal("dashboard_auth_gate_state"),
|
|
17031
|
+
privateBetaEnabled: exports_external.boolean(),
|
|
17032
|
+
publicSignupEnabled: exports_external.boolean(),
|
|
17033
|
+
authkitConfigured: exports_external.boolean(),
|
|
17034
|
+
clientIdConfigured: exports_external.boolean(),
|
|
17035
|
+
workosConfigured: exports_external.boolean(),
|
|
17036
|
+
loginEnabled: exports_external.boolean(),
|
|
17037
|
+
signupEnabled: exports_external.boolean()
|
|
17038
|
+
}),
|
|
17039
|
+
capabilities: exports_external.object({
|
|
17040
|
+
authMode: exports_external.string(),
|
|
17041
|
+
canManageApiKeys: exports_external.boolean(),
|
|
17042
|
+
canCreateApiKeys: exports_external.boolean(),
|
|
17043
|
+
canManageBilling: exports_external.boolean(),
|
|
17044
|
+
acceptedApiKeyManagementScopes: exports_external.array(exports_external.string()),
|
|
17045
|
+
acceptedBillingManagementScopes: exports_external.array(exports_external.string())
|
|
17046
|
+
}),
|
|
17047
|
+
apiKeys: exports_external.object({
|
|
17048
|
+
activeCount: exports_external.number().int(),
|
|
17049
|
+
revokedCount: exports_external.number().int(),
|
|
17050
|
+
totalCount: exports_external.number().int(),
|
|
17051
|
+
activeKeyLimit: exports_external.number().int(),
|
|
17052
|
+
remainingCreateCount: exports_external.number().int()
|
|
17053
|
+
}),
|
|
17054
|
+
usage: exports_external.object({
|
|
17055
|
+
totalRequests: exports_external.number().int(),
|
|
17056
|
+
successCount: exports_external.number().int(),
|
|
17057
|
+
errorCount: exports_external.number().int(),
|
|
17058
|
+
errorRate: exports_external.number(),
|
|
17059
|
+
lastSeenAt: exports_external.string().nullable(),
|
|
17060
|
+
topMeters: usageSummarySchema.shape.meters
|
|
17061
|
+
}),
|
|
17062
|
+
billing: exports_external.object({
|
|
17063
|
+
publicPlanKey: exports_external.string(),
|
|
17064
|
+
billingState: exports_external.string(),
|
|
17065
|
+
rightsKey: exports_external.string(),
|
|
17066
|
+
cardOnFile: exports_external.boolean(),
|
|
17067
|
+
cardRequired: exports_external.boolean(),
|
|
17068
|
+
freeGrant: exports_external.object({
|
|
17069
|
+
total: exports_external.number().int(),
|
|
17070
|
+
used: exports_external.number().int(),
|
|
17071
|
+
remaining: exports_external.number().int()
|
|
17072
|
+
}),
|
|
17073
|
+
monthlyQuotas: exports_external.record(exports_external.string(), monthlyQuotaSnapshotSchema),
|
|
17074
|
+
budget: billingBudgetSchema,
|
|
17075
|
+
settlementStatus: exports_external.string(),
|
|
17076
|
+
nextRecommendedPlan: exports_external.string().nullable(),
|
|
17077
|
+
subscriptionStatus: exports_external.string().nullable(),
|
|
17078
|
+
currentPeriodEnd: exports_external.string().nullable()
|
|
17079
|
+
}),
|
|
17080
|
+
actions: exports_external.array(exports_external.object({
|
|
17081
|
+
id: exports_external.string(),
|
|
17082
|
+
label: exports_external.string(),
|
|
17083
|
+
enabled: exports_external.boolean(),
|
|
17084
|
+
reason: exports_external.string().nullable()
|
|
17085
|
+
}))
|
|
17086
|
+
});
|
|
16978
17087
|
var dashboardOverviewSchema = exports_external.object({
|
|
16979
17088
|
object: exports_external.literal("dashboard_overview"),
|
|
16980
17089
|
requestId: exports_external.string(),
|
|
@@ -16982,7 +17091,189 @@ var dashboardOverviewSchema = exports_external.object({
|
|
|
16982
17091
|
organization: organizationSchema.omit({ object: true }).nullable(),
|
|
16983
17092
|
billing: billingAccountSchema,
|
|
16984
17093
|
usage: usageSummarySchema,
|
|
16985
|
-
apiKeys: exports_external.array(apiKeySchema)
|
|
17094
|
+
apiKeys: exports_external.array(apiKeySchema),
|
|
17095
|
+
overview: dashboardOverviewSummarySchema
|
|
17096
|
+
});
|
|
17097
|
+
var dashboardAccountSettingsSchema = exports_external.object({
|
|
17098
|
+
object: exports_external.literal("dashboard_account_settings"),
|
|
17099
|
+
requestId: exports_external.string(),
|
|
17100
|
+
principal: dashboardSettingsPrincipalSchema.nullable(),
|
|
17101
|
+
profile: exports_external.object({
|
|
17102
|
+
object: exports_external.literal("dashboard_profile"),
|
|
17103
|
+
userId: exports_external.string().nullable(),
|
|
17104
|
+
email: exports_external.string().nullable(),
|
|
17105
|
+
emailNormalized: exports_external.string().nullable(),
|
|
17106
|
+
name: exports_external.string().nullable(),
|
|
17107
|
+
displayName: exports_external.string().nullable(),
|
|
17108
|
+
displayNameSource: exports_external.enum(["dashboard_settings", "workos", "unknown"]),
|
|
17109
|
+
avatarUrl: exports_external.string().nullable(),
|
|
17110
|
+
editable: exports_external.object({
|
|
17111
|
+
displayName: exports_external.boolean(),
|
|
17112
|
+
email: exports_external.boolean(),
|
|
17113
|
+
name: exports_external.boolean(),
|
|
17114
|
+
avatarUrl: exports_external.boolean()
|
|
17115
|
+
}),
|
|
17116
|
+
updatedAt: exports_external.string().nullable()
|
|
17117
|
+
}),
|
|
17118
|
+
organization: exports_external.object({
|
|
17119
|
+
id: exports_external.string(),
|
|
17120
|
+
name: exports_external.string().nullable(),
|
|
17121
|
+
nameSource: exports_external.enum(["dashboard_settings", "workos"]),
|
|
17122
|
+
workosName: exports_external.string().nullable(),
|
|
17123
|
+
livemode: exports_external.boolean(),
|
|
17124
|
+
createdAt: exports_external.string(),
|
|
17125
|
+
settings: exports_external.object({
|
|
17126
|
+
organization: exports_external.object({
|
|
17127
|
+
displayName: exports_external.string().nullable(),
|
|
17128
|
+
updatedAt: exports_external.string().nullable()
|
|
17129
|
+
}),
|
|
17130
|
+
appearance: exports_external.object({
|
|
17131
|
+
theme: exports_external.enum(["dark", "system"]),
|
|
17132
|
+
density: exports_external.enum(["comfortable", "compact"])
|
|
17133
|
+
}),
|
|
17134
|
+
accountDeletionRequest: exports_external.object({
|
|
17135
|
+
status: exports_external.enum(["not_requested", "requested"]),
|
|
17136
|
+
requestedAt: exports_external.string().nullable(),
|
|
17137
|
+
requestedByPrincipalId: exports_external.string().nullable(),
|
|
17138
|
+
reason: exports_external.string().nullable()
|
|
17139
|
+
})
|
|
17140
|
+
})
|
|
17141
|
+
}).nullable(),
|
|
17142
|
+
membership: exports_external.object({
|
|
17143
|
+
object: exports_external.literal("workos_org_membership"),
|
|
17144
|
+
userId: exports_external.string(),
|
|
17145
|
+
orgId: exports_external.string(),
|
|
17146
|
+
status: exports_external.enum(["active", "inactive", "suspended"]),
|
|
17147
|
+
scopes: exports_external.array(exports_external.string()),
|
|
17148
|
+
firstSeenAt: exports_external.string(),
|
|
17149
|
+
lastSeenAt: exports_external.string(),
|
|
17150
|
+
createdAt: exports_external.string(),
|
|
17151
|
+
updatedAt: exports_external.string()
|
|
17152
|
+
}).nullable(),
|
|
17153
|
+
appearance: exports_external.object({
|
|
17154
|
+
theme: exports_external.enum(["dark", "system"]),
|
|
17155
|
+
density: exports_external.enum(["comfortable", "compact"])
|
|
17156
|
+
}),
|
|
17157
|
+
security: exports_external.object({
|
|
17158
|
+
object: exports_external.literal("dashboard_security_settings"),
|
|
17159
|
+
authProvider: exports_external.literal("workos"),
|
|
17160
|
+
authMode: exports_external.string(),
|
|
17161
|
+
sessionExpiresAt: exports_external.string().nullable(),
|
|
17162
|
+
scopes: exports_external.array(exports_external.string()),
|
|
17163
|
+
logoutPath: exports_external.string(),
|
|
17164
|
+
profileFieldsManagedBy: exports_external.literal("workos")
|
|
17165
|
+
}),
|
|
17166
|
+
accountDeletion: exports_external.object({
|
|
17167
|
+
status: exports_external.enum(["not_requested", "requested"]),
|
|
17168
|
+
requestedAt: exports_external.string().nullable(),
|
|
17169
|
+
requestedByPrincipalId: exports_external.string().nullable(),
|
|
17170
|
+
reason: exports_external.string().nullable()
|
|
17171
|
+
}),
|
|
17172
|
+
actions: exports_external.array(exports_external.object({
|
|
17173
|
+
id: exports_external.string(),
|
|
17174
|
+
method: exports_external.string(),
|
|
17175
|
+
path: exports_external.string(),
|
|
17176
|
+
enabled: exports_external.boolean()
|
|
17177
|
+
}))
|
|
17178
|
+
});
|
|
17179
|
+
var dashboardUsageSeriesSchema = exports_external.object({
|
|
17180
|
+
object: exports_external.literal("dashboard_usage_series"),
|
|
17181
|
+
requestId: exports_external.string().optional(),
|
|
17182
|
+
orgId: exports_external.string(),
|
|
17183
|
+
bucket: exports_external.enum(["hour", "day"]),
|
|
17184
|
+
since: exports_external.string(),
|
|
17185
|
+
until: exports_external.string(),
|
|
17186
|
+
data: exports_external.array(exports_external.object({
|
|
17187
|
+
bucketStart: exports_external.string(),
|
|
17188
|
+
requestCount: exports_external.number().int(),
|
|
17189
|
+
successCount: exports_external.number().int(),
|
|
17190
|
+
errorCount: exports_external.number().int(),
|
|
17191
|
+
units: exports_external.number().int(),
|
|
17192
|
+
avgLatencyMs: exports_external.number()
|
|
17193
|
+
}))
|
|
17194
|
+
});
|
|
17195
|
+
var dashboardEndpointBreakdownSchema = exports_external.object({
|
|
17196
|
+
object: exports_external.literal("dashboard_endpoint_breakdown"),
|
|
17197
|
+
requestId: exports_external.string().optional(),
|
|
17198
|
+
orgId: exports_external.string(),
|
|
17199
|
+
since: exports_external.string(),
|
|
17200
|
+
until: exports_external.string(),
|
|
17201
|
+
data: exports_external.array(exports_external.object({
|
|
17202
|
+
endpointKey: exports_external.string(),
|
|
17203
|
+
method: exports_external.string(),
|
|
17204
|
+
path: exports_external.string(),
|
|
17205
|
+
meterClass: exports_external.string(),
|
|
17206
|
+
meterFamily: exports_external.string(),
|
|
17207
|
+
requestCount: exports_external.number().int(),
|
|
17208
|
+
successCount: exports_external.number().int(),
|
|
17209
|
+
errorCount: exports_external.number().int(),
|
|
17210
|
+
units: exports_external.number().int(),
|
|
17211
|
+
avgLatencyMs: exports_external.number(),
|
|
17212
|
+
lastSeenAt: exports_external.string().nullable()
|
|
17213
|
+
}))
|
|
17214
|
+
});
|
|
17215
|
+
var dashboardUsageRequestSchema = exports_external.object({
|
|
17216
|
+
id: exports_external.string(),
|
|
17217
|
+
requestId: exports_external.string(),
|
|
17218
|
+
principalId: exports_external.string().nullable(),
|
|
17219
|
+
endpointKey: exports_external.string(),
|
|
17220
|
+
method: exports_external.string(),
|
|
17221
|
+
path: exports_external.string(),
|
|
17222
|
+
status: exports_external.number().int(),
|
|
17223
|
+
authMode: exports_external.string().nullable(),
|
|
17224
|
+
meterClass: exports_external.string(),
|
|
17225
|
+
meterFamily: exports_external.string(),
|
|
17226
|
+
mcpToolName: exports_external.string().nullable(),
|
|
17227
|
+
units: exports_external.number().int(),
|
|
17228
|
+
latencyMs: exports_external.number(),
|
|
17229
|
+
invoicePeriod: exports_external.string(),
|
|
17230
|
+
recordedAt: exports_external.string()
|
|
17231
|
+
});
|
|
17232
|
+
var dashboardAuditEventSchema = exports_external.object({
|
|
17233
|
+
id: exports_external.string(),
|
|
17234
|
+
orgId: exports_external.string().nullable(),
|
|
17235
|
+
actorPrincipalId: exports_external.string().nullable(),
|
|
17236
|
+
eventType: exports_external.string(),
|
|
17237
|
+
category: exports_external.string(),
|
|
17238
|
+
outcome: exports_external.enum(["started", "succeeded", "failed", "blocked"]),
|
|
17239
|
+
requestId: exports_external.string().nullable(),
|
|
17240
|
+
authMode: exports_external.string().nullable(),
|
|
17241
|
+
source: exports_external.string(),
|
|
17242
|
+
metadata: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
17243
|
+
occurredAt: exports_external.string()
|
|
17244
|
+
});
|
|
17245
|
+
var dashboardUsageRequestLogSchema = exports_external.object({
|
|
17246
|
+
object: exports_external.literal("dashboard_usage_request_log"),
|
|
17247
|
+
requestId: exports_external.string(),
|
|
17248
|
+
orgId: exports_external.string(),
|
|
17249
|
+
since: exports_external.string(),
|
|
17250
|
+
until: exports_external.string(),
|
|
17251
|
+
data: exports_external.array(dashboardUsageRequestSchema)
|
|
17252
|
+
});
|
|
17253
|
+
var dashboardUsageExportSchema = exports_external.object({
|
|
17254
|
+
object: exports_external.literal("dashboard_usage_export"),
|
|
17255
|
+
requestId: exports_external.string(),
|
|
17256
|
+
orgId: exports_external.string(),
|
|
17257
|
+
since: exports_external.string(),
|
|
17258
|
+
until: exports_external.string(),
|
|
17259
|
+
format: exports_external.literal("json"),
|
|
17260
|
+
data: exports_external.array(dashboardUsageRequestSchema)
|
|
17261
|
+
});
|
|
17262
|
+
var dashboardUsageActivitySchema = exports_external.object({
|
|
17263
|
+
object: exports_external.literal("dashboard_usage_activity"),
|
|
17264
|
+
requestId: exports_external.string(),
|
|
17265
|
+
orgId: exports_external.string(),
|
|
17266
|
+
since: exports_external.string(),
|
|
17267
|
+
until: exports_external.string(),
|
|
17268
|
+
totalRequests: exports_external.number().int(),
|
|
17269
|
+
successCount: exports_external.number().int(),
|
|
17270
|
+
errorCount: exports_external.number().int(),
|
|
17271
|
+
firstSeenAt: exports_external.string().nullable(),
|
|
17272
|
+
lastSeenAt: exports_external.string().nullable(),
|
|
17273
|
+
activePrincipalCount: exports_external.number().int(),
|
|
17274
|
+
endpointCount: exports_external.number().int(),
|
|
17275
|
+
recentRequests: exports_external.array(dashboardUsageRequestSchema),
|
|
17276
|
+
recentAuditEvents: exports_external.array(dashboardAuditEventSchema)
|
|
16986
17277
|
});
|
|
16987
17278
|
var installPayloadSchema = exports_external.object({
|
|
16988
17279
|
transport: exports_external.object({
|
|
@@ -17140,6 +17431,8 @@ var listSchema = (itemSchema) => exports_external.object({
|
|
|
17140
17431
|
data: exports_external.array(itemSchema),
|
|
17141
17432
|
hasMore: exports_external.boolean(),
|
|
17142
17433
|
nextCursor: exports_external.string().nullable(),
|
|
17434
|
+
responseMode: exports_external.enum(["compact", "standard", "verbose"]).nullable().optional(),
|
|
17435
|
+
include: exports_external.array(exports_external.string()).nullable().optional(),
|
|
17143
17436
|
requestId: exports_external.string()
|
|
17144
17437
|
});
|
|
17145
17438
|
var entityListSchema = listSchema(entitySchema);
|
|
@@ -17193,12 +17486,19 @@ var entityAgentRecordSchema = exports_external.object({
|
|
|
17193
17486
|
var statementAgentRecordSchema = statementSchema.pick({
|
|
17194
17487
|
object: true,
|
|
17195
17488
|
ticker: true,
|
|
17489
|
+
companyName: true,
|
|
17196
17490
|
statementKey: true,
|
|
17197
17491
|
title: true,
|
|
17198
17492
|
period: true,
|
|
17199
17493
|
periods: true,
|
|
17200
17494
|
rows: true
|
|
17201
17495
|
}).extend({
|
|
17496
|
+
sources: exports_external.array(exports_external.object({
|
|
17497
|
+
source: exports_external.string(),
|
|
17498
|
+
sourceKind: exports_external.enum(["company_facts", "filing"]),
|
|
17499
|
+
accessionNumber: exports_external.string().nullable(),
|
|
17500
|
+
sourceUrl: exports_external.string().url()
|
|
17501
|
+
})).default([]),
|
|
17202
17502
|
requestId: exports_external.string()
|
|
17203
17503
|
});
|
|
17204
17504
|
var factPointAgentItemSchema = factPointSchema.pick({
|
|
@@ -17347,6 +17647,7 @@ var ownershipReportAgentRecordSchema = ownershipReportSchema.pick({
|
|
|
17347
17647
|
managerName: true,
|
|
17348
17648
|
form: true,
|
|
17349
17649
|
filingDate: true,
|
|
17650
|
+
reportDate: true,
|
|
17350
17651
|
accessionNumber: true
|
|
17351
17652
|
}).extend({
|
|
17352
17653
|
filingUrl: exports_external.string().nullable(),
|
|
@@ -17500,10 +17801,15 @@ var observabilityExportSchema = exports_external.object({
|
|
|
17500
17801
|
var symbolSchema = exports_external.string().min(1);
|
|
17501
17802
|
var isoCountryCodeSchema = exports_external.string().length(2);
|
|
17502
17803
|
var investorMetadataShape = {
|
|
17503
|
-
|
|
17804
|
+
responseMode: exports_external.enum(["compact", "standard", "verbose"]).optional(),
|
|
17805
|
+
dataAsOf: exports_external.string().optional(),
|
|
17806
|
+
freshnessStatus: exports_external.string().optional(),
|
|
17807
|
+
methodologyVersion: exports_external.string().optional(),
|
|
17808
|
+
materializationVersion: exports_external.string().optional(),
|
|
17809
|
+
provenance: provenanceSchema.optional(),
|
|
17504
17810
|
freshness: freshnessMetadataSchema.optional(),
|
|
17505
17811
|
materialization: materializationMetadataSchema.optional(),
|
|
17506
|
-
sourceRights: sourceRightsMetadataSchema,
|
|
17812
|
+
sourceRights: sourceRightsMetadataSchema.optional(),
|
|
17507
17813
|
methodology: methodologyMetadataSchema.optional(),
|
|
17508
17814
|
revision: revisionMetadataSchema.optional(),
|
|
17509
17815
|
degradedState: degradedStateSchema.nullable().optional()
|
|
@@ -17664,16 +17970,55 @@ var macroForecastSchema = exports_external.object({
|
|
|
17664
17970
|
scenario: exports_external.string().nullable().optional(),
|
|
17665
17971
|
...investorMetadataShape
|
|
17666
17972
|
});
|
|
17973
|
+
var factorQualityProofSourceMetadataSchema = exports_external.object({
|
|
17974
|
+
latestAsOf: exports_external.string().nullable(),
|
|
17975
|
+
latestSourcePublishedAt: exports_external.string().nullable(),
|
|
17976
|
+
observedModelNameCount: exports_external.number().int().nonnegative(),
|
|
17977
|
+
observedModelNamesSample: exports_external.array(exports_external.string()).default([]),
|
|
17978
|
+
nonStockBasketRowCount: exports_external.number().int().nonnegative(),
|
|
17979
|
+
metadataModelNames: exports_external.array(exports_external.string()).default([]),
|
|
17980
|
+
metadataModelVersions: exports_external.array(exports_external.string()).default([]),
|
|
17981
|
+
metadataMethodologyUrls: exports_external.array(exports_external.string()).default([])
|
|
17982
|
+
});
|
|
17983
|
+
var factorQualityProofSchema = exports_external.object({
|
|
17984
|
+
object: exports_external.literal("factor_quality_proof"),
|
|
17985
|
+
status: exports_external.enum(["ready", "degraded", "not_available"]),
|
|
17986
|
+
proofSource: exports_external.string().nullable(),
|
|
17987
|
+
proofObservedAt: exports_external.string().nullable(),
|
|
17988
|
+
rowLevelProofAvailable: exports_external.boolean(),
|
|
17989
|
+
proofReady: exports_external.boolean(),
|
|
17990
|
+
firstDate: exports_external.string().nullable(),
|
|
17991
|
+
lastDate: exports_external.string().nullable(),
|
|
17992
|
+
firstRequiredMarketDate: exports_external.string().nullable(),
|
|
17993
|
+
latestMarketDay: exports_external.string().nullable(),
|
|
17994
|
+
targetHistoryStartDate: exports_external.string().nullable(),
|
|
17995
|
+
requiredHistoryStartDate: exports_external.string().nullable(),
|
|
17996
|
+
shortHistoryExempt: exports_external.boolean(),
|
|
17997
|
+
historyStartMarketDayLag: exports_external.number().int().nullable(),
|
|
17998
|
+
latestMarketDayLag: exports_external.number().int().nullable(),
|
|
17999
|
+
rowCount: exports_external.number().int().nonnegative().nullable(),
|
|
18000
|
+
distinctFactorDateCount: exports_external.number().int().nonnegative().nullable(),
|
|
18001
|
+
coveredMarketDateCount: exports_external.number().int().nonnegative().nullable(),
|
|
18002
|
+
expectedMarketDateCount: exports_external.number().int().nonnegative().nullable(),
|
|
18003
|
+
missingSessionCount: exports_external.number().int().nonnegative().nullable(),
|
|
18004
|
+
coveragePct: exports_external.number().min(0).max(1).nullable(),
|
|
18005
|
+
methodologyVersion: exports_external.string().nullable(),
|
|
18006
|
+
modelName: exports_external.string().nullable(),
|
|
18007
|
+
methodologyUrl: exports_external.string().nullable(),
|
|
18008
|
+
sourceMetadata: factorQualityProofSourceMetadataSchema.nullable(),
|
|
18009
|
+
degradedReasons: exports_external.array(exports_external.string()).default([])
|
|
18010
|
+
});
|
|
17667
18011
|
var factorDefinitionSchema = exports_external.object({
|
|
17668
18012
|
object: exports_external.literal("factor_definition"),
|
|
17669
18013
|
id: exports_external.string(),
|
|
17670
18014
|
key: exports_external.string(),
|
|
17671
18015
|
name: exports_external.string(),
|
|
17672
|
-
category: exports_external.enum(["market", "style", "macro", "sector", "industry", "country", "
|
|
18016
|
+
category: exports_external.enum(["market", "style", "macro", "sector", "industry", "country", "thematic"]),
|
|
17673
18017
|
description: exports_external.string(),
|
|
17674
18018
|
benchmarkSymbol: exports_external.string().nullable().optional(),
|
|
17675
18019
|
equation: exports_external.record(exports_external.string(), exports_external.number()).optional(),
|
|
17676
18020
|
orthogonalizedAgainst: exports_external.array(exports_external.string()).default([]),
|
|
18021
|
+
qualityProof: factorQualityProofSchema,
|
|
17677
18022
|
...investorMetadataShape
|
|
17678
18023
|
});
|
|
17679
18024
|
var factorReturnSchema = exports_external.object({
|
|
@@ -17687,6 +18032,212 @@ var factorReturnSchema = exports_external.object({
|
|
|
17687
18032
|
scaledReturn: exports_external.number().nullable().optional(),
|
|
17688
18033
|
zScore: exports_external.number().nullable().optional(),
|
|
17689
18034
|
leverage: exports_external.number().nullable().optional(),
|
|
18035
|
+
qualityProof: factorQualityProofSchema,
|
|
18036
|
+
...investorMetadataShape
|
|
18037
|
+
});
|
|
18038
|
+
var factorExtremeMoveSchema = exports_external.object({
|
|
18039
|
+
object: exports_external.literal("factor_extreme_move"),
|
|
18040
|
+
id: exports_external.string(),
|
|
18041
|
+
rank: exports_external.number().int().positive(),
|
|
18042
|
+
factorKey: exports_external.string(),
|
|
18043
|
+
factorName: exports_external.string(),
|
|
18044
|
+
category: exports_external.string(),
|
|
18045
|
+
window: exports_external.string(),
|
|
18046
|
+
lookback: exports_external.string(),
|
|
18047
|
+
direction: exports_external.enum(["up", "down", "flat"]),
|
|
18048
|
+
sort: exports_external.enum(["abs_z_score", "abs_scaled_return"]),
|
|
18049
|
+
score: exports_external.number(),
|
|
18050
|
+
absZScore: exports_external.number().nonnegative(),
|
|
18051
|
+
absScaledReturn: exports_external.number().nonnegative(),
|
|
18052
|
+
minAbsZScore: exports_external.number().nonnegative(),
|
|
18053
|
+
isExtreme: exports_external.boolean(),
|
|
18054
|
+
asOf: exports_external.string(),
|
|
18055
|
+
rawReturn: exports_external.number().nullable().optional(),
|
|
18056
|
+
pureReturn: exports_external.number().nullable().optional(),
|
|
18057
|
+
scaledReturn: exports_external.number().nullable().optional(),
|
|
18058
|
+
zScore: exports_external.number().nullable().optional(),
|
|
18059
|
+
leverage: exports_external.number().nullable().optional(),
|
|
18060
|
+
...investorMetadataShape
|
|
18061
|
+
});
|
|
18062
|
+
var factorExtremePairSchema = exports_external.object({
|
|
18063
|
+
object: exports_external.literal("factor_extreme_pair"),
|
|
18064
|
+
id: exports_external.string(),
|
|
18065
|
+
rank: exports_external.number().int().positive(),
|
|
18066
|
+
factor1: exports_external.string(),
|
|
18067
|
+
factor2: exports_external.string(),
|
|
18068
|
+
factor1Name: exports_external.string(),
|
|
18069
|
+
factor2Name: exports_external.string(),
|
|
18070
|
+
category1: exports_external.string(),
|
|
18071
|
+
category2: exports_external.string(),
|
|
18072
|
+
window: exports_external.enum(["1d", "5d", "10d", "21d", "63d", "126d", "252d"]),
|
|
18073
|
+
lookback: exports_external.string(),
|
|
18074
|
+
direction: exports_external.enum(["factor1", "factor2", "flat"]),
|
|
18075
|
+
sort: exports_external.enum(["abs_z_score", "abs_spread_return"]),
|
|
18076
|
+
score: exports_external.number(),
|
|
18077
|
+
absZScore: exports_external.number().nonnegative(),
|
|
18078
|
+
absSpreadReturn: exports_external.number().nonnegative(),
|
|
18079
|
+
minAbsZScore: exports_external.number().nonnegative(),
|
|
18080
|
+
isExtreme: exports_external.boolean(),
|
|
18081
|
+
spreadReturn: exports_external.number(),
|
|
18082
|
+
factor1Return: exports_external.number(),
|
|
18083
|
+
factor2Return: exports_external.number(),
|
|
18084
|
+
averageSpreadReturn: exports_external.number(),
|
|
18085
|
+
spreadVolatility: exports_external.number().nonnegative(),
|
|
18086
|
+
zScore: exports_external.number(),
|
|
18087
|
+
spreadZScore: exports_external.number(),
|
|
18088
|
+
meanReversionSignal: exports_external.enum(["factor1_overextended", "factor2_overextended", "neutral"]),
|
|
18089
|
+
meanReversionSummary: exports_external.string(),
|
|
18090
|
+
windowStartDate: exports_external.string(),
|
|
18091
|
+
windowEndDate: exports_external.string(),
|
|
18092
|
+
pairHistory: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
18093
|
+
observationCount: exports_external.number().int().nonnegative(),
|
|
18094
|
+
rollingObservationCount: exports_external.number().int().nonnegative(),
|
|
18095
|
+
asOf: exports_external.string(),
|
|
18096
|
+
...investorMetadataShape
|
|
18097
|
+
});
|
|
18098
|
+
var factorValuationSchema = exports_external.object({
|
|
18099
|
+
object: exports_external.literal("factor_valuation"),
|
|
18100
|
+
id: exports_external.string(),
|
|
18101
|
+
rank: exports_external.number().int().positive(),
|
|
18102
|
+
factorKey: exports_external.string(),
|
|
18103
|
+
factorName: exports_external.string(),
|
|
18104
|
+
category: exports_external.string(),
|
|
18105
|
+
valuationMetric: exports_external.string(),
|
|
18106
|
+
longLeg: exports_external.string(),
|
|
18107
|
+
shortLeg: exports_external.string(),
|
|
18108
|
+
window: exports_external.string(),
|
|
18109
|
+
lookback: exports_external.string(),
|
|
18110
|
+
signal: exports_external.enum(["tailwind", "headwind", "neutral"]),
|
|
18111
|
+
signalDirection: exports_external.enum(["tailwind", "headwind", "neutral"]),
|
|
18112
|
+
weightingMode: exports_external.enum(["long_short_equal", "long_leg_focus", "short_leg_focus"]),
|
|
18113
|
+
legWeights: exports_external.object({
|
|
18114
|
+
long: exports_external.number(),
|
|
18115
|
+
short: exports_external.number()
|
|
18116
|
+
}),
|
|
18117
|
+
rawFactorZScore: exports_external.number(),
|
|
18118
|
+
weightedZScore: exports_external.number(),
|
|
18119
|
+
sort: exports_external.enum(["opportunity_score", "abs_z_score", "factor_key"]),
|
|
18120
|
+
score: exports_external.number(),
|
|
18121
|
+
opportunityScore: exports_external.number(),
|
|
18122
|
+
zScore: exports_external.number(),
|
|
18123
|
+
absZScore: exports_external.number().nonnegative(),
|
|
18124
|
+
scaledReturn: exports_external.number().nullable().optional(),
|
|
18125
|
+
pureReturn: exports_external.number().nullable().optional(),
|
|
18126
|
+
rawReturn: exports_external.number().nullable().optional(),
|
|
18127
|
+
asOf: exports_external.string(),
|
|
18128
|
+
signalSource: exports_external.literal("materialized_factor_return_z_score"),
|
|
18129
|
+
stockDrilldown: exports_external.record(exports_external.string(), exports_external.unknown()),
|
|
18130
|
+
opportunitySummary: exports_external.string(),
|
|
18131
|
+
...investorMetadataShape
|
|
18132
|
+
});
|
|
18133
|
+
var factorValuationStockSchema = exports_external.object({
|
|
18134
|
+
object: exports_external.literal("factor_valuation_stock"),
|
|
18135
|
+
id: exports_external.string(),
|
|
18136
|
+
rank: exports_external.number().int().positive(),
|
|
18137
|
+
symbol: symbolSchema,
|
|
18138
|
+
factorKey: exports_external.string(),
|
|
18139
|
+
factorName: exports_external.string(),
|
|
18140
|
+
category: exports_external.string(),
|
|
18141
|
+
valuationMetric: exports_external.string(),
|
|
18142
|
+
valuationSignal: exports_external.enum(["tailwind", "headwind", "neutral"]),
|
|
18143
|
+
signalDirection: exports_external.enum(["tailwind", "headwind", "neutral"]),
|
|
18144
|
+
weightingMode: exports_external.enum(["long_short_equal", "long_leg_focus", "short_leg_focus"]),
|
|
18145
|
+
legWeights: exports_external.object({
|
|
18146
|
+
long: exports_external.number(),
|
|
18147
|
+
short: exports_external.number()
|
|
18148
|
+
}),
|
|
18149
|
+
stance: exports_external.enum(["beneficiaries", "at_risk", "both"]),
|
|
18150
|
+
impact: exports_external.enum(["beneficiary", "at_risk", "neutral"]),
|
|
18151
|
+
sort: exports_external.enum(["score", "abs_beta", "symbol"]),
|
|
18152
|
+
score: exports_external.number(),
|
|
18153
|
+
expectedFactorImpactScore: exports_external.number(),
|
|
18154
|
+
factorZScore: exports_external.number(),
|
|
18155
|
+
rawFactorZScore: exports_external.number(),
|
|
18156
|
+
weightedFactorZScore: exports_external.number(),
|
|
18157
|
+
exposureAdjustedFactorZScore: exports_external.number(),
|
|
18158
|
+
exposureBeta: exports_external.number(),
|
|
18159
|
+
absExposureBeta: exports_external.number().nonnegative(),
|
|
18160
|
+
exposurePercentile: exports_external.number().nullable().optional(),
|
|
18161
|
+
exposureConfidence: exports_external.enum(["high", "medium", "low"]).nullable().optional(),
|
|
18162
|
+
nActiveFactors: exports_external.number().int().nonnegative(),
|
|
18163
|
+
window: exports_external.string(),
|
|
18164
|
+
lookback: exports_external.string(),
|
|
18165
|
+
modelName: exports_external.string(),
|
|
18166
|
+
asOf: exports_external.string(),
|
|
18167
|
+
factorAsOf: exports_external.string(),
|
|
18168
|
+
factorFreshness: freshnessMetadataSchema.optional(),
|
|
18169
|
+
factorMaterialization: materializationMetadataSchema.optional(),
|
|
18170
|
+
signalSource: exports_external.literal("materialized_factor_return_z_score_plus_latest_factor_exposure"),
|
|
18171
|
+
rankingRationale: exports_external.string(),
|
|
18172
|
+
opportunitySummary: exports_external.string(),
|
|
18173
|
+
...investorMetadataShape
|
|
18174
|
+
});
|
|
18175
|
+
var factorHistoryPointSchema = exports_external.object({
|
|
18176
|
+
date: exports_external.string(),
|
|
18177
|
+
rawReturn: exports_external.number().nullable().optional(),
|
|
18178
|
+
pureReturn: exports_external.number().nullable().optional(),
|
|
18179
|
+
scaledReturn: exports_external.number().nullable().optional(),
|
|
18180
|
+
zScore: exports_external.number().nullable().optional(),
|
|
18181
|
+
leverage: exports_external.number().nullable().optional()
|
|
18182
|
+
});
|
|
18183
|
+
var factorHistoryWindowSchema = exports_external.object({
|
|
18184
|
+
window: exports_external.string(),
|
|
18185
|
+
rawReturn: exports_external.number().nullable().optional(),
|
|
18186
|
+
pureReturn: exports_external.number().nullable().optional(),
|
|
18187
|
+
scaledReturn: exports_external.number().nullable().optional(),
|
|
18188
|
+
observationCount: exports_external.number().int().nonnegative(),
|
|
18189
|
+
startDate: exports_external.string().nullable().optional(),
|
|
18190
|
+
endDate: exports_external.string().nullable().optional()
|
|
18191
|
+
});
|
|
18192
|
+
var factorHistorySchema = exports_external.object({
|
|
18193
|
+
object: exports_external.literal("factor_history"),
|
|
18194
|
+
id: exports_external.string(),
|
|
18195
|
+
factorKey: exports_external.string(),
|
|
18196
|
+
factorName: exports_external.string(),
|
|
18197
|
+
category: exports_external.string(),
|
|
18198
|
+
range: exports_external.string(),
|
|
18199
|
+
dateFrom: exports_external.string(),
|
|
18200
|
+
dateTo: exports_external.string(),
|
|
18201
|
+
historyStartDate: exports_external.string().nullable().optional(),
|
|
18202
|
+
historyEndDate: exports_external.string().nullable().optional(),
|
|
18203
|
+
observationCount: exports_external.number().int().nonnegative(),
|
|
18204
|
+
asOf: exports_external.string(),
|
|
18205
|
+
series: exports_external.array(factorHistoryPointSchema).default([]),
|
|
18206
|
+
seriesCount: exports_external.number().int().nonnegative().optional(),
|
|
18207
|
+
seriesSample: exports_external.array(factorHistoryPointSchema).optional(),
|
|
18208
|
+
expansionHints: exports_external.array(exports_external.string()).optional(),
|
|
18209
|
+
summaryWindows: exports_external.array(factorHistoryWindowSchema).default([]),
|
|
18210
|
+
qualityProof: factorQualityProofSchema,
|
|
18211
|
+
...investorMetadataShape
|
|
18212
|
+
});
|
|
18213
|
+
var factorSparklinePointSchema = exports_external.object({
|
|
18214
|
+
date: exports_external.string(),
|
|
18215
|
+
value: exports_external.number()
|
|
18216
|
+
});
|
|
18217
|
+
var factorSparklineSchema = exports_external.object({
|
|
18218
|
+
object: exports_external.literal("factor_sparkline"),
|
|
18219
|
+
id: exports_external.string(),
|
|
18220
|
+
factorKey: exports_external.string(),
|
|
18221
|
+
factorName: exports_external.string(),
|
|
18222
|
+
category: exports_external.string(),
|
|
18223
|
+
range: exports_external.string(),
|
|
18224
|
+
metric: exports_external.enum(["scaled_return", "pure_return", "raw_return", "z_score"]),
|
|
18225
|
+
dateFrom: exports_external.string(),
|
|
18226
|
+
dateTo: exports_external.string(),
|
|
18227
|
+
historyStartDate: exports_external.string().nullable().optional(),
|
|
18228
|
+
historyEndDate: exports_external.string().nullable().optional(),
|
|
18229
|
+
observationCount: exports_external.number().int().nonnegative(),
|
|
18230
|
+
pointCount: exports_external.number().int().nonnegative(),
|
|
18231
|
+
asOf: exports_external.string(),
|
|
18232
|
+
latestValue: exports_external.number().nullable().optional(),
|
|
18233
|
+
latestRawReturn: exports_external.number().nullable().optional(),
|
|
18234
|
+
latestPureReturn: exports_external.number().nullable().optional(),
|
|
18235
|
+
latestScaledReturn: exports_external.number().nullable().optional(),
|
|
18236
|
+
latestZScore: exports_external.number().nullable().optional(),
|
|
18237
|
+
latestLeverage: exports_external.number().nullable().optional(),
|
|
18238
|
+
summaryWindows: exports_external.array(factorHistoryWindowSchema).default([]),
|
|
18239
|
+
points: exports_external.array(factorSparklinePointSchema).default([]),
|
|
18240
|
+
qualityProof: factorQualityProofSchema,
|
|
17690
18241
|
...investorMetadataShape
|
|
17691
18242
|
});
|
|
17692
18243
|
var factorIntradaySnapshotSchema = exports_external.object({
|
|
@@ -17714,7 +18265,7 @@ var factorRegimePerformanceSchema = exports_external.object({
|
|
|
17714
18265
|
regimeLabel: exports_external.string(),
|
|
17715
18266
|
factorKey: exports_external.string(),
|
|
17716
18267
|
factorName: exports_external.string(),
|
|
17717
|
-
factorCategory: exports_external.enum(["market", "style", "macro", "sector", "industry", "country", "
|
|
18268
|
+
factorCategory: exports_external.enum(["market", "style", "macro", "sector", "industry", "country", "thematic"]),
|
|
17718
18269
|
window: exports_external.string(),
|
|
17719
18270
|
lookback: exports_external.string(),
|
|
17720
18271
|
rank: exports_external.number().int().positive(),
|
|
@@ -17930,16 +18481,149 @@ var countryReportRequestSchema = exports_external.object({
|
|
|
17930
18481
|
var portfolioIntelligenceRequestSchema = exports_external.object({
|
|
17931
18482
|
country: exports_external.string().min(2).max(12).default("US"),
|
|
17932
18483
|
lookback: exports_external.string().min(2).max(12).optional(),
|
|
18484
|
+
category: exports_external.string().min(2).max(32).optional(),
|
|
18485
|
+
keys: exports_external.array(exports_external.string()).default([]),
|
|
18486
|
+
holdings: exports_external.array(portfolioHoldingInputSchema).min(1).max(250),
|
|
18487
|
+
benchmarkLabel: exports_external.string().min(1).max(160).optional(),
|
|
18488
|
+
benchmarkHoldings: exports_external.array(portfolioHoldingInputSchema).min(1).max(250).optional(),
|
|
18489
|
+
whatIfLabel: exports_external.string().min(1).max(160).optional(),
|
|
18490
|
+
whatIfHoldings: exports_external.array(portfolioHoldingInputSchema).min(1).max(250).optional()
|
|
18491
|
+
});
|
|
18492
|
+
var portfolioAttributionRequestSchema = exports_external.object({
|
|
18493
|
+
country: exports_external.string().min(2).max(12).default("US"),
|
|
18494
|
+
lookback: exports_external.string().min(2).max(12).optional(),
|
|
18495
|
+
window: exports_external.string().min(2).max(12).optional(),
|
|
18496
|
+
frequency: exports_external.enum(["daily", "weekly", "monthly", "quarterly", "annual"]).default("daily"),
|
|
18497
|
+
exportFormat: exports_external.enum(["json", "csv", "both"]).default("json"),
|
|
18498
|
+
category: exports_external.string().min(2).max(32).optional(),
|
|
17933
18499
|
keys: exports_external.array(exports_external.string()).default([]),
|
|
17934
18500
|
holdings: exports_external.array(portfolioHoldingInputSchema).min(1).max(250)
|
|
17935
18501
|
});
|
|
18502
|
+
var portfolioHedgeInstrumentTypeSchema = exports_external.enum(["equity", "etf", "future", "option", "cash"]);
|
|
18503
|
+
var portfolioHedgeConstraintsSchema = exports_external.object({
|
|
18504
|
+
maxHedges: exports_external.number().int().min(1).max(5).default(3),
|
|
18505
|
+
maxPositionWeight: exports_external.number().min(0.001).max(1).default(0.1),
|
|
18506
|
+
maxTotalHedgeWeight: exports_external.number().min(0.001).max(1).default(0.3),
|
|
18507
|
+
maxSectorWeight: exports_external.number().min(0.001).max(1).default(1),
|
|
18508
|
+
hedgeIntensity: exports_external.number().min(0.05).max(1).default(1),
|
|
18509
|
+
longOnly: exports_external.boolean().default(false),
|
|
18510
|
+
allowedInstrumentTypes: exports_external.array(portfolioHedgeInstrumentTypeSchema).min(1).default(["etf"]),
|
|
18511
|
+
customUniverse: exports_external.array(symbolSchema).max(250).default([]),
|
|
18512
|
+
targetExposures: exports_external.record(exports_external.string(), exports_external.number()).default({}),
|
|
18513
|
+
minConfidence: exports_external.enum(["low", "medium", "high"]).default("medium"),
|
|
18514
|
+
minLiquidityUsd: exports_external.number().min(0).default(0),
|
|
18515
|
+
excludedSectors: exports_external.array(exports_external.string()).max(64).default([])
|
|
18516
|
+
}).strict().default({
|
|
18517
|
+
maxHedges: 3,
|
|
18518
|
+
maxPositionWeight: 0.1,
|
|
18519
|
+
maxTotalHedgeWeight: 0.3,
|
|
18520
|
+
maxSectorWeight: 1,
|
|
18521
|
+
hedgeIntensity: 1,
|
|
18522
|
+
longOnly: false,
|
|
18523
|
+
allowedInstrumentTypes: ["etf"],
|
|
18524
|
+
customUniverse: [],
|
|
18525
|
+
targetExposures: {},
|
|
18526
|
+
minConfidence: "medium",
|
|
18527
|
+
minLiquidityUsd: 0,
|
|
18528
|
+
excludedSectors: []
|
|
18529
|
+
});
|
|
18530
|
+
var portfolioOptimizerConstraintsSchema = exports_external.object({
|
|
18531
|
+
maxCandidates: exports_external.number().int().min(1).max(8).default(3),
|
|
18532
|
+
maxIterations: exports_external.number().int().min(10).max(250).default(50),
|
|
18533
|
+
maxRuntimeMs: exports_external.number().int().min(50).max(2500).default(750),
|
|
18534
|
+
maxPositionWeight: exports_external.number().min(0.001).max(1).default(0.35),
|
|
18535
|
+
minPositionWeight: exports_external.number().min(0).max(0.5).default(0),
|
|
18536
|
+
longOnly: exports_external.boolean().default(true),
|
|
18537
|
+
turnoverLimit: exports_external.number().min(0).max(2).default(0.25),
|
|
18538
|
+
riskFreeRate: exports_external.number().min(-0.25).max(0.25).default(0)
|
|
18539
|
+
}).strict().default({
|
|
18540
|
+
maxCandidates: 3,
|
|
18541
|
+
maxIterations: 50,
|
|
18542
|
+
maxRuntimeMs: 750,
|
|
18543
|
+
maxPositionWeight: 0.35,
|
|
18544
|
+
minPositionWeight: 0,
|
|
18545
|
+
longOnly: true,
|
|
18546
|
+
turnoverLimit: 0.25,
|
|
18547
|
+
riskFreeRate: 0
|
|
18548
|
+
});
|
|
18549
|
+
var portfolioOptimizeRequestSchema = exports_external.object({
|
|
18550
|
+
country: exports_external.string().min(2).max(12).default("US"),
|
|
18551
|
+
lookback: exports_external.string().min(2).max(12).optional(),
|
|
18552
|
+
category: exports_external.string().min(2).max(32).optional(),
|
|
18553
|
+
keys: exports_external.array(exports_external.string()).default([]),
|
|
18554
|
+
objective: exports_external.enum(["factor_neutral", "min_drawdown", "regime_aware"]).default("factor_neutral"),
|
|
18555
|
+
maxHedges: exports_external.number().int().min(1).max(5).optional(),
|
|
18556
|
+
constraints: portfolioOptimizerConstraintsSchema.optional(),
|
|
18557
|
+
holdings: exports_external.array(portfolioHoldingInputSchema).min(1).max(250)
|
|
18558
|
+
}).strict();
|
|
18559
|
+
var portfolioHedgeRequestSchema = exports_external.object({
|
|
18560
|
+
country: exports_external.string().min(2).max(12).default("US"),
|
|
18561
|
+
lookback: exports_external.string().min(2).max(12).optional(),
|
|
18562
|
+
category: exports_external.string().min(2).max(32).optional(),
|
|
18563
|
+
keys: exports_external.array(exports_external.string()).default([]),
|
|
18564
|
+
objective: exports_external.enum(["factor_neutral", "min_drawdown", "regime_aware"]).default("factor_neutral"),
|
|
18565
|
+
mode: exports_external.enum(["compact", "standard"]).default("compact"),
|
|
18566
|
+
constraints: portfolioHedgeConstraintsSchema,
|
|
18567
|
+
holdings: exports_external.array(portfolioHoldingInputSchema).min(1).max(250)
|
|
18568
|
+
}).strict();
|
|
17936
18569
|
var portfolioStressTestRequestSchema = exports_external.object({
|
|
17937
18570
|
country: exports_external.string().min(2).max(12).default("US"),
|
|
17938
18571
|
lookback: exports_external.string().min(2).max(12).optional(),
|
|
17939
18572
|
category: exports_external.string().min(2).max(32).optional(),
|
|
18573
|
+
keys: exports_external.array(exports_external.string()).default([]),
|
|
17940
18574
|
scenarioKey: exports_external.enum(["us_recession", "higher_for_longer", "china_growth_scare"]).optional(),
|
|
17941
18575
|
holdings: exports_external.array(portfolioHoldingInputSchema).min(1).max(250)
|
|
17942
18576
|
});
|
|
18577
|
+
var modelFactorAnalysisModelInputSchema = exports_external.object({
|
|
18578
|
+
id: exports_external.string().min(1).max(120).optional(),
|
|
18579
|
+
label: exports_external.string().min(1).max(160).default("Ad hoc model"),
|
|
18580
|
+
description: exports_external.string().max(500).default("Ad hoc model submitted for factor analysis."),
|
|
18581
|
+
tags: exports_external.array(exports_external.string().min(1).max(64)).max(20).default([]),
|
|
18582
|
+
source: exports_external.enum(["turos", "client", "model_builder"]).default("client")
|
|
18583
|
+
}).strict().default({
|
|
18584
|
+
label: "Ad hoc model",
|
|
18585
|
+
description: "Ad hoc model submitted for factor analysis.",
|
|
18586
|
+
tags: [],
|
|
18587
|
+
source: "client"
|
|
18588
|
+
});
|
|
18589
|
+
var modelFactorAnalysisIncludeSchema = exports_external.object({
|
|
18590
|
+
attribution: exports_external.boolean().default(true),
|
|
18591
|
+
hedge: exports_external.boolean().default(false),
|
|
18592
|
+
optimizer: exports_external.boolean().default(false),
|
|
18593
|
+
positionViews: exports_external.boolean().default(true)
|
|
18594
|
+
}).strict().default({
|
|
18595
|
+
attribution: true,
|
|
18596
|
+
hedge: false,
|
|
18597
|
+
optimizer: false,
|
|
18598
|
+
positionViews: true
|
|
18599
|
+
});
|
|
18600
|
+
var modelFactorAnalysisHedgeOptionsSchema = exports_external.object({
|
|
18601
|
+
objective: exports_external.enum(["factor_neutral", "min_drawdown", "regime_aware"]).default("factor_neutral"),
|
|
18602
|
+
mode: exports_external.enum(["compact", "standard"]).default("compact"),
|
|
18603
|
+
constraints: portfolioHedgeConstraintsSchema
|
|
18604
|
+
}).strict().default({
|
|
18605
|
+
objective: "factor_neutral",
|
|
18606
|
+
mode: "compact",
|
|
18607
|
+
constraints: portfolioHedgeConstraintsSchema.parse(undefined)
|
|
18608
|
+
});
|
|
18609
|
+
var modelFactorAnalysisOptimizerOptionsSchema = exports_external.object({
|
|
18610
|
+
objective: exports_external.enum(["factor_neutral", "min_drawdown", "regime_aware"]).default("factor_neutral"),
|
|
18611
|
+
constraints: portfolioOptimizerConstraintsSchema.optional()
|
|
18612
|
+
}).strict().default({
|
|
18613
|
+
objective: "factor_neutral"
|
|
18614
|
+
});
|
|
18615
|
+
var modelFactorAnalysisRequestSchema = exports_external.object({
|
|
18616
|
+
model: modelFactorAnalysisModelInputSchema,
|
|
18617
|
+
country: exports_external.string().min(2).max(12).default("US"),
|
|
18618
|
+
lookback: exports_external.string().min(2).max(12).optional(),
|
|
18619
|
+
window: exports_external.string().min(2).max(12).optional(),
|
|
18620
|
+
category: exports_external.string().min(2).max(32).optional(),
|
|
18621
|
+
keys: exports_external.array(exports_external.string()).default([]),
|
|
18622
|
+
include: modelFactorAnalysisIncludeSchema,
|
|
18623
|
+
hedge: modelFactorAnalysisHedgeOptionsSchema,
|
|
18624
|
+
optimizer: modelFactorAnalysisOptimizerOptionsSchema,
|
|
18625
|
+
holdings: exports_external.array(portfolioHoldingInputSchema).min(1).max(250)
|
|
18626
|
+
}).strict();
|
|
17943
18627
|
var watchlistIntelligenceRequestSchema = exports_external.object({
|
|
17944
18628
|
country: exports_external.string().min(2).max(12).default("US"),
|
|
17945
18629
|
lookback: exports_external.string().min(2).max(12).optional(),
|
|
@@ -17989,42 +18673,250 @@ var earningsPreviewBundleSchema = exports_external.object({
|
|
|
17989
18673
|
summaryMd: exports_external.string(),
|
|
17990
18674
|
...investorMetadataShape
|
|
17991
18675
|
});
|
|
18676
|
+
var portfolioFitSummarySchema = exports_external.object({
|
|
18677
|
+
object: exports_external.literal("portfolio_fit_summary"),
|
|
18678
|
+
exposureCount: exports_external.number().int().nonnegative(),
|
|
18679
|
+
activeFactorCount: exports_external.number().int().nonnegative(),
|
|
18680
|
+
averageRSquared: exports_external.number().min(0).max(1).nullable(),
|
|
18681
|
+
averageAdjustedRSquared: exports_external.number().nullable(),
|
|
18682
|
+
idiosyncraticRiskScore: exports_external.number().min(0).max(1).nullable(),
|
|
18683
|
+
rSquaredMethod: exports_external.literal("unweighted_average_of_factor_exposure_r_squared"),
|
|
18684
|
+
idiosyncraticRiskMethod: exports_external.literal("one_minus_average_factor_exposure_r_squared_proxy"),
|
|
18685
|
+
observationCount: exports_external.number().int().nonnegative().nullable(),
|
|
18686
|
+
interpretation: exports_external.string()
|
|
18687
|
+
});
|
|
18688
|
+
var portfolioBenchmarkTiltSchema = exports_external.object({
|
|
18689
|
+
object: exports_external.literal("portfolio_benchmark_tilt"),
|
|
18690
|
+
factorKey: exports_external.string(),
|
|
18691
|
+
portfolioBeta: exports_external.number(),
|
|
18692
|
+
benchmarkBeta: exports_external.number(),
|
|
18693
|
+
activeTilt: exports_external.number(),
|
|
18694
|
+
direction: exports_external.enum(["overweight", "underweight", "neutral"]),
|
|
18695
|
+
summary: exports_external.string()
|
|
18696
|
+
});
|
|
18697
|
+
var portfolioWhatIfComparisonSchema = exports_external.object({
|
|
18698
|
+
object: exports_external.literal("portfolio_what_if_comparison"),
|
|
18699
|
+
label: exports_external.string(),
|
|
18700
|
+
holdings: exports_external.array(portfolioHoldingInputSchema),
|
|
18701
|
+
exposureDeltas: exports_external.array(portfolioBenchmarkTiltSchema).default([]),
|
|
18702
|
+
summaryMd: exports_external.string()
|
|
18703
|
+
});
|
|
18704
|
+
var portfolioOptimizerCandidateSchema = exports_external.object({
|
|
18705
|
+
object: exports_external.literal("portfolio_optimizer_candidate"),
|
|
18706
|
+
rank: exports_external.number().int().positive(),
|
|
18707
|
+
name: exports_external.string(),
|
|
18708
|
+
objective: exports_external.enum(["current_reference", "factor_neutral", "min_drawdown", "regime_aware"]),
|
|
18709
|
+
holdings: exports_external.array(portfolioHoldingInputSchema),
|
|
18710
|
+
expectedReturn: exports_external.number(),
|
|
18711
|
+
expectedVolatility: exports_external.number(),
|
|
18712
|
+
expectedSharpe: exports_external.number(),
|
|
18713
|
+
maxDrawdownProxy: exports_external.number(),
|
|
18714
|
+
factorExposureScore: exports_external.number(),
|
|
18715
|
+
turnover: exports_external.number(),
|
|
18716
|
+
score: exports_external.number(),
|
|
18717
|
+
constraintStatus: exports_external.enum(["ok", "capped", "rejected"]),
|
|
18718
|
+
constraintsApplied: exports_external.array(exports_external.string()).default([]),
|
|
18719
|
+
rationale: exports_external.string()
|
|
18720
|
+
});
|
|
18721
|
+
var portfolioOptimizerCandidateSummarySchema = portfolioOptimizerCandidateSchema.omit({
|
|
18722
|
+
holdings: true
|
|
18723
|
+
});
|
|
18724
|
+
var portfolioOptimizerRuntimeSchema = exports_external.object({
|
|
18725
|
+
object: exports_external.literal("portfolio_optimizer_runtime"),
|
|
18726
|
+
method: exports_external.literal("bounded_deterministic_candidate_search"),
|
|
18727
|
+
candidateCount: exports_external.number().int().nonnegative(),
|
|
18728
|
+
iterationBudget: exports_external.number().int().positive(),
|
|
18729
|
+
iterationsRun: exports_external.number().int().nonnegative(),
|
|
18730
|
+
runtimeMs: exports_external.number(),
|
|
18731
|
+
maxRuntimeMs: exports_external.number().int().positive(),
|
|
18732
|
+
timeout: exports_external.boolean()
|
|
18733
|
+
});
|
|
17992
18734
|
var portfolioAnalysisSchema = exports_external.object({
|
|
17993
18735
|
object: exports_external.literal("portfolio_analysis"),
|
|
17994
18736
|
id: exports_external.string(),
|
|
17995
18737
|
asOf: exports_external.string(),
|
|
17996
18738
|
holdings: exports_external.array(portfolioHoldingInputSchema),
|
|
17997
18739
|
exposures: exports_external.array(factorExposureSchema).default([]),
|
|
18740
|
+
fit: portfolioFitSummarySchema.nullable().default(null),
|
|
18741
|
+
benchmarkLabel: exports_external.string().nullable().default(null),
|
|
18742
|
+
benchmarkTilts: exports_external.array(portfolioBenchmarkTiltSchema).default([]),
|
|
18743
|
+
whatIfComparison: portfolioWhatIfComparisonSchema.nullable().default(null),
|
|
17998
18744
|
positionViews: exports_external.array(exports_external.lazy(() => portfolioPositionFactorViewSchema)).default([]),
|
|
17999
18745
|
positionExposures: exports_external.array(factorExposureSchema).default([]),
|
|
18000
18746
|
attribution: exports_external.array(attributionContributionSchema).default([]),
|
|
18001
18747
|
hedgeSuggestions: exports_external.array(hedgeCandidateSchema).default([]),
|
|
18002
18748
|
optimizationNotes: exports_external.array(exports_external.string()).default([]),
|
|
18003
18749
|
factorNeutralPlan: exports_external.array(exports_external.string()).default([]),
|
|
18750
|
+
optimizerObjective: exports_external.enum(["factor_neutral", "min_drawdown", "regime_aware"]).optional(),
|
|
18751
|
+
optimizerConstraints: portfolioOptimizerConstraintsSchema.optional(),
|
|
18752
|
+
optimizerRuntime: portfolioOptimizerRuntimeSchema.optional(),
|
|
18753
|
+
optimizerCandidates: exports_external.array(portfolioOptimizerCandidateSchema).default([]).optional(),
|
|
18754
|
+
optimizerCandidateCount: exports_external.number().int().nonnegative().optional(),
|
|
18755
|
+
optimizerCandidateSample: exports_external.array(portfolioOptimizerCandidateSummarySchema).default([]).optional(),
|
|
18756
|
+
selectedCandidate: exports_external.union([portfolioOptimizerCandidateSchema, portfolioOptimizerCandidateSummarySchema]).nullable().optional(),
|
|
18757
|
+
optimizerDisclosures: exports_external.array(exports_external.string()).default([]).optional(),
|
|
18004
18758
|
summaryMd: exports_external.string(),
|
|
18005
18759
|
...investorMetadataShape
|
|
18006
18760
|
});
|
|
18007
|
-
var
|
|
18008
|
-
object: exports_external.literal("
|
|
18761
|
+
var portfolioFactorAttributionSchema = exports_external.object({
|
|
18762
|
+
object: exports_external.literal("portfolio_factor_attribution"),
|
|
18763
|
+
rank: exports_external.number().int().positive(),
|
|
18764
|
+
factorKey: exports_external.string(),
|
|
18765
|
+
factorName: exports_external.string(),
|
|
18766
|
+
factorCategory: exports_external.string(),
|
|
18767
|
+
contributionPercent: exports_external.number(),
|
|
18768
|
+
contributionPct: exports_external.number().nullable(),
|
|
18769
|
+
beta: exports_external.number(),
|
|
18770
|
+
factorReturn: exports_external.number(),
|
|
18771
|
+
rawReturn: exports_external.number().nullable().optional(),
|
|
18772
|
+
pureReturn: exports_external.number().nullable().optional(),
|
|
18773
|
+
scaledReturn: exports_external.number().nullable().optional(),
|
|
18774
|
+
zScore: exports_external.number().nullable().optional(),
|
|
18775
|
+
leverage: exports_external.number().nullable().optional(),
|
|
18776
|
+
modelName: exports_external.string().nullable().optional(),
|
|
18777
|
+
explanation: exports_external.string(),
|
|
18778
|
+
trace: traceReferenceSchema.nullable().optional()
|
|
18779
|
+
});
|
|
18780
|
+
var portfolioReturnPointSchema = exports_external.object({
|
|
18781
|
+
object: exports_external.literal("portfolio_return_point"),
|
|
18782
|
+
period: exports_external.string(),
|
|
18783
|
+
periodEnd: exports_external.string(),
|
|
18784
|
+
frequency: exports_external.enum(["daily", "weekly", "monthly", "quarterly", "annual"]),
|
|
18785
|
+
periodReturn: exports_external.number(),
|
|
18786
|
+
cumulativeReturn: exports_external.number(),
|
|
18787
|
+
coverageWeight: exports_external.number().min(0),
|
|
18788
|
+
missingSymbols: exports_external.array(exports_external.string()).default([])
|
|
18789
|
+
});
|
|
18790
|
+
var portfolioRollingBetaSchema = exports_external.object({
|
|
18791
|
+
object: exports_external.literal("portfolio_rolling_beta"),
|
|
18792
|
+
factorKey: exports_external.string(),
|
|
18793
|
+
factorName: exports_external.string(),
|
|
18794
|
+
factorCategory: exports_external.string(),
|
|
18795
|
+
beta: exports_external.number(),
|
|
18796
|
+
lookback: exports_external.string(),
|
|
18797
|
+
windowStart: exports_external.string().nullable(),
|
|
18798
|
+
windowEnd: exports_external.string(),
|
|
18799
|
+
rSquared: exports_external.number().nullable(),
|
|
18800
|
+
adjustedRSquared: exports_external.number().nullable(),
|
|
18801
|
+
observationCount: exports_external.number().int().nonnegative().nullable(),
|
|
18802
|
+
method: exports_external.literal("materialized_factor_exposure_regression_beta")
|
|
18803
|
+
});
|
|
18804
|
+
var portfolioAttributionExportFileSchema = exports_external.object({
|
|
18805
|
+
name: exports_external.string(),
|
|
18806
|
+
kind: exports_external.enum(["contributions", "return_stream", "rolling_betas"]),
|
|
18807
|
+
format: exports_external.literal("csv"),
|
|
18808
|
+
columns: exports_external.array(exports_external.string()).default([]),
|
|
18809
|
+
csv: exports_external.string()
|
|
18810
|
+
});
|
|
18811
|
+
var portfolioAttributionExportSchema = exports_external.object({
|
|
18812
|
+
object: exports_external.literal("portfolio_attribution_export"),
|
|
18813
|
+
requestedFormat: exports_external.enum(["json", "csv", "both"]),
|
|
18814
|
+
formats: exports_external.array(exports_external.enum(["json", "csv"])).default(["json"]),
|
|
18815
|
+
fileName: exports_external.string(),
|
|
18816
|
+
columns: exports_external.array(exports_external.string()).default([]),
|
|
18817
|
+
csv: exports_external.string().nullable().default(null),
|
|
18818
|
+
files: exports_external.array(portfolioAttributionExportFileSchema).default([])
|
|
18819
|
+
});
|
|
18820
|
+
var portfolioAttributionSchema = exports_external.object({
|
|
18821
|
+
object: exports_external.literal("portfolio_attribution"),
|
|
18009
18822
|
id: exports_external.string(),
|
|
18823
|
+
analysisId: exports_external.string(),
|
|
18010
18824
|
asOf: exports_external.string(),
|
|
18011
|
-
|
|
18012
|
-
|
|
18013
|
-
|
|
18014
|
-
|
|
18015
|
-
|
|
18016
|
-
|
|
18017
|
-
|
|
18825
|
+
country: exports_external.string(),
|
|
18826
|
+
window: exports_external.string(),
|
|
18827
|
+
lookback: exports_external.string(),
|
|
18828
|
+
frequency: exports_external.enum(["daily", "weekly", "monthly", "quarterly", "annual"]),
|
|
18829
|
+
holdings: exports_external.array(portfolioHoldingInputSchema),
|
|
18830
|
+
portfolioReturn: exports_external.number().nullable(),
|
|
18831
|
+
totalExplained: exports_external.number(),
|
|
18832
|
+
alpha: exports_external.number().nullable(),
|
|
18833
|
+
rSquared: exports_external.number().nullable(),
|
|
18834
|
+
contributions: exports_external.array(portfolioFactorAttributionSchema).default([]),
|
|
18835
|
+
returnStream: exports_external.array(portfolioReturnPointSchema).default([]),
|
|
18836
|
+
returnPointCount: exports_external.number().int().nonnegative().optional(),
|
|
18837
|
+
returnStreamSample: exports_external.array(portfolioReturnPointSchema).default([]).optional(),
|
|
18838
|
+
rollingBetas: exports_external.array(portfolioRollingBetaSchema).default([]),
|
|
18839
|
+
rollingBetaCount: exports_external.number().int().nonnegative().optional(),
|
|
18840
|
+
rollingBetasUnavailableReason: exports_external.string().nullable().default(null),
|
|
18841
|
+
exposures: exports_external.array(factorExposureSchema).default([]),
|
|
18842
|
+
export: portfolioAttributionExportSchema,
|
|
18018
18843
|
summaryMd: exports_external.string(),
|
|
18019
18844
|
...investorMetadataShape
|
|
18020
18845
|
});
|
|
18021
|
-
var
|
|
18022
|
-
|
|
18023
|
-
|
|
18024
|
-
|
|
18025
|
-
|
|
18026
|
-
|
|
18027
|
-
|
|
18846
|
+
var portfolioHedgeTargetExposureSchema = exports_external.object({
|
|
18847
|
+
object: exports_external.literal("portfolio_hedge_target_exposure"),
|
|
18848
|
+
factorKey: exports_external.string(),
|
|
18849
|
+
factorName: exports_external.string(),
|
|
18850
|
+
factorCategory: exports_external.string(),
|
|
18851
|
+
beta: exports_external.number(),
|
|
18852
|
+
targetExposureDelta: exports_external.number(),
|
|
18853
|
+
proposedExposureDelta: exports_external.number(),
|
|
18854
|
+
residualBeta: exports_external.number(),
|
|
18855
|
+
hedged: exports_external.boolean(),
|
|
18856
|
+
skipReason: exports_external.string().nullable()
|
|
18857
|
+
});
|
|
18858
|
+
var portfolioHedgeCandidateSchema = exports_external.object({
|
|
18859
|
+
object: exports_external.literal("portfolio_hedge_candidate"),
|
|
18860
|
+
rank: exports_external.number().int().positive(),
|
|
18861
|
+
factorKey: exports_external.string(),
|
|
18862
|
+
factorName: exports_external.string(),
|
|
18863
|
+
factorCategory: exports_external.string(),
|
|
18864
|
+
symbol: symbolSchema,
|
|
18865
|
+
instrumentType: portfolioHedgeInstrumentTypeSchema,
|
|
18866
|
+
action: exports_external.enum(["long", "short"]),
|
|
18867
|
+
recommendedWeight: exports_external.number(),
|
|
18868
|
+
targetExposureDelta: exports_external.number(),
|
|
18869
|
+
expectedExposureDelta: exports_external.record(exports_external.string(), exports_external.number()).default({}),
|
|
18870
|
+
residualBeta: exports_external.number(),
|
|
18871
|
+
constraintStatus: exports_external.enum(["ok", "capped"]),
|
|
18872
|
+
constraintsApplied: exports_external.array(exports_external.string()).default([]),
|
|
18873
|
+
liquidityUsd: exports_external.number().nullable(),
|
|
18874
|
+
estimatedCostBps: exports_external.number().nullable(),
|
|
18875
|
+
sectorKey: exports_external.string().nullable(),
|
|
18876
|
+
rationale: exports_external.string(),
|
|
18877
|
+
confidence: exports_external.enum(["high", "medium", "low"])
|
|
18878
|
+
});
|
|
18879
|
+
var portfolioHedgeSchema = exports_external.object({
|
|
18880
|
+
object: exports_external.literal("portfolio_hedge"),
|
|
18881
|
+
id: exports_external.string(),
|
|
18882
|
+
analysisId: exports_external.string().nullable(),
|
|
18883
|
+
asOf: exports_external.string(),
|
|
18884
|
+
country: exports_external.string(),
|
|
18885
|
+
lookback: exports_external.string(),
|
|
18886
|
+
objective: exports_external.enum(["factor_neutral", "min_drawdown", "regime_aware"]),
|
|
18887
|
+
mode: exports_external.enum(["compact", "standard"]),
|
|
18888
|
+
constraints: portfolioHedgeConstraintsSchema,
|
|
18889
|
+
holdings: exports_external.array(portfolioHoldingInputSchema),
|
|
18890
|
+
targetExposures: exports_external.array(portfolioHedgeTargetExposureSchema).default([]),
|
|
18891
|
+
hedges: exports_external.array(portfolioHedgeCandidateSchema).default([]),
|
|
18892
|
+
residualExposure: exports_external.record(exports_external.string(), exports_external.number()).default({}),
|
|
18893
|
+
exposures: exports_external.array(factorExposureSchema).default([]),
|
|
18894
|
+
optimizationNotes: exports_external.array(exports_external.string()).default([]),
|
|
18895
|
+
factorNeutralPlan: exports_external.array(exports_external.string()).default([]),
|
|
18896
|
+
summaryMd: exports_external.string(),
|
|
18897
|
+
...investorMetadataShape
|
|
18898
|
+
});
|
|
18899
|
+
var portfolioStressTestSchema = exports_external.object({
|
|
18900
|
+
object: exports_external.literal("portfolio_stress_test"),
|
|
18901
|
+
id: exports_external.string(),
|
|
18902
|
+
asOf: exports_external.string(),
|
|
18903
|
+
scenarioKey: exports_external.string(),
|
|
18904
|
+
scenarioLabel: exports_external.string(),
|
|
18905
|
+
estimatedDrawdownPercent: exports_external.number(),
|
|
18906
|
+
factorShocks: exports_external.record(exports_external.string(), exports_external.number()).default({}),
|
|
18907
|
+
macroShocks: exports_external.record(exports_external.string(), exports_external.number()).default({}),
|
|
18908
|
+
regime: macroRegimeSchema.nullable().optional(),
|
|
18909
|
+
conditioningNotes: exports_external.array(exports_external.string()).default([]),
|
|
18910
|
+
summaryMd: exports_external.string(),
|
|
18911
|
+
...investorMetadataShape
|
|
18912
|
+
});
|
|
18913
|
+
var factorDrillTargetSchema = exports_external.object({
|
|
18914
|
+
label: exports_external.string(),
|
|
18915
|
+
method: exports_external.literal("GET"),
|
|
18916
|
+
path: exports_external.string()
|
|
18917
|
+
});
|
|
18918
|
+
var portfolioPositionFactorViewSchema = exports_external.object({
|
|
18919
|
+
object: exports_external.literal("portfolio_position_factor_view"),
|
|
18028
18920
|
symbol: symbolSchema,
|
|
18029
18921
|
holding: portfolioHoldingInputSchema,
|
|
18030
18922
|
activeFactorCount: exports_external.number().int().nonnegative(),
|
|
@@ -18045,7 +18937,41 @@ var modelPortfolioFactorViewSchema = exports_external.object({
|
|
|
18045
18937
|
holdings: exports_external.array(portfolioHoldingInputSchema),
|
|
18046
18938
|
analysis: portfolioAnalysisSchema,
|
|
18047
18939
|
positionViews: exports_external.array(portfolioPositionFactorViewSchema).default([]),
|
|
18048
|
-
positionExposures: exports_external.array(factorExposureSchema).default([])
|
|
18940
|
+
positionExposures: exports_external.array(factorExposureSchema).default([]),
|
|
18941
|
+
...investorMetadataShape
|
|
18942
|
+
});
|
|
18943
|
+
var modelFactorAnalysisSchema = exports_external.object({
|
|
18944
|
+
object: exports_external.literal("model_factor_analysis"),
|
|
18945
|
+
id: exports_external.string(),
|
|
18946
|
+
asOf: exports_external.string(),
|
|
18947
|
+
model: exports_external.object({
|
|
18948
|
+
id: exports_external.string(),
|
|
18949
|
+
label: exports_external.string(),
|
|
18950
|
+
description: exports_external.string(),
|
|
18951
|
+
tags: exports_external.array(exports_external.string()).default([]),
|
|
18952
|
+
source: exports_external.enum(["turos", "client", "model_builder"])
|
|
18953
|
+
}),
|
|
18954
|
+
country: exports_external.string(),
|
|
18955
|
+
lookback: exports_external.string(),
|
|
18956
|
+
window: exports_external.string(),
|
|
18957
|
+
category: exports_external.string(),
|
|
18958
|
+
holdings: exports_external.array(portfolioHoldingInputSchema),
|
|
18959
|
+
include: modelFactorAnalysisIncludeSchema,
|
|
18960
|
+
analysis: portfolioAnalysisSchema,
|
|
18961
|
+
attribution: portfolioAttributionSchema.nullable(),
|
|
18962
|
+
hedge: portfolioHedgeSchema.nullable(),
|
|
18963
|
+
optimizerObjective: exports_external.enum(["factor_neutral", "min_drawdown", "regime_aware"]).optional(),
|
|
18964
|
+
optimizerConstraints: portfolioOptimizerConstraintsSchema.optional(),
|
|
18965
|
+
optimizerRuntime: portfolioOptimizerRuntimeSchema.optional(),
|
|
18966
|
+
optimizerCandidates: exports_external.array(portfolioOptimizerCandidateSchema).default([]).optional(),
|
|
18967
|
+
optimizerCandidateCount: exports_external.number().int().nonnegative().optional(),
|
|
18968
|
+
optimizerCandidateSample: exports_external.array(portfolioOptimizerCandidateSummarySchema).default([]).optional(),
|
|
18969
|
+
selectedCandidate: exports_external.union([portfolioOptimizerCandidateSchema, portfolioOptimizerCandidateSummarySchema]).nullable().optional(),
|
|
18970
|
+
optimizerDisclosures: exports_external.array(exports_external.string()).default([]).optional(),
|
|
18971
|
+
positionViews: exports_external.array(portfolioPositionFactorViewSchema).default([]),
|
|
18972
|
+
positionExposures: exports_external.array(factorExposureSchema).default([]),
|
|
18973
|
+
summaryMd: exports_external.string(),
|
|
18974
|
+
...investorMetadataShape
|
|
18049
18975
|
});
|
|
18050
18976
|
var factorRotationStrategySchema = exports_external.object({
|
|
18051
18977
|
object: exports_external.literal("factor_rotation_strategy"),
|
|
@@ -18756,11 +19682,1197 @@ var dilutionVerificationSummarySchema = exports_external.object({
|
|
|
18756
19682
|
modelVersion: exports_external.string().nullable()
|
|
18757
19683
|
});
|
|
18758
19684
|
var schemaRef = (name) => ({ $ref: `#/components/schemas/${name}` });
|
|
19685
|
+
var objectExampleBySchema = {
|
|
19686
|
+
FactorRegimeScreen: "regime_screen"
|
|
19687
|
+
};
|
|
19688
|
+
var exampleAsOf = "2026-06-09T22:15:00.000Z";
|
|
19689
|
+
var exampleSnapshotAt = "2026-06-09T19:45:00.000Z";
|
|
19690
|
+
var exampleDataDate = "2026-06-09";
|
|
19691
|
+
var exampleTrustMetadata = {
|
|
19692
|
+
dataAsOf: exampleDataDate,
|
|
19693
|
+
freshnessStatus: "fresh",
|
|
19694
|
+
methodologyVersion: "secapi_factor_returns_v1",
|
|
19695
|
+
materializationVersion: "2026-06-09",
|
|
19696
|
+
provenance: {
|
|
19697
|
+
source: "secapi_factor_pipeline",
|
|
19698
|
+
sourceLabel: "SecAPI factor pipeline",
|
|
19699
|
+
accessionNumber: null,
|
|
19700
|
+
filingUrl: "https://docs.secapi.ai/factors/methodology",
|
|
19701
|
+
acceptedAt: null,
|
|
19702
|
+
retrievedAt: exampleAsOf,
|
|
19703
|
+
parserVersion: "secapi-factor-pipeline"
|
|
19704
|
+
},
|
|
19705
|
+
freshness: {
|
|
19706
|
+
status: "fresh",
|
|
19707
|
+
asOf: exampleAsOf,
|
|
19708
|
+
sourcePublishedAt: "2026-06-09T21:30:00.000Z",
|
|
19709
|
+
lagMs: 2700000
|
|
19710
|
+
},
|
|
19711
|
+
materialization: {
|
|
19712
|
+
parserVersion: "secapi-factor-pipeline",
|
|
19713
|
+
materializationVersion: "2026-06-09"
|
|
19714
|
+
},
|
|
19715
|
+
sourceRights: {
|
|
19716
|
+
source: "secapi_owned_factor_pipeline",
|
|
19717
|
+
sourceLabel: "SecAPI factor pipeline",
|
|
19718
|
+
posture: "public_safe",
|
|
19719
|
+
publicAvailability: "public",
|
|
19720
|
+
contractStatus: "approved",
|
|
19721
|
+
restrictions: [],
|
|
19722
|
+
notes: "SecAPI-owned derived factor data."
|
|
19723
|
+
},
|
|
19724
|
+
methodology: {
|
|
19725
|
+
id: "secapi_factor_returns",
|
|
19726
|
+
version: "v1",
|
|
19727
|
+
summary: "SecAPI-owned daily factor returns, exposures, and portfolio analytics built for agent and API workflows.",
|
|
19728
|
+
confidence: "high",
|
|
19729
|
+
launchState: "beta",
|
|
19730
|
+
inputs: ["secapi_factor_returns", "secapi_factor_exposures", "market_calendar"],
|
|
19731
|
+
validation: { launchHistoryFloor: "2015-01-01", marketCalendarAware: true }
|
|
19732
|
+
},
|
|
19733
|
+
revision: {
|
|
19734
|
+
sourcePublishedAt: "2026-06-09T21:30:00.000Z",
|
|
19735
|
+
retrievedAt: exampleAsOf,
|
|
19736
|
+
vintageId: "2026-06-09",
|
|
19737
|
+
revisedFrom: null
|
|
19738
|
+
},
|
|
19739
|
+
degradedState: null
|
|
19740
|
+
};
|
|
19741
|
+
var exampleLaunchReadiness = {
|
|
19742
|
+
object: "factor_launch_readiness",
|
|
19743
|
+
status: "launch_ready",
|
|
19744
|
+
proofGated: true,
|
|
19745
|
+
proofReady: true,
|
|
19746
|
+
observedProofStatus: "ready",
|
|
19747
|
+
proofObservedAt: exampleAsOf,
|
|
19748
|
+
requiredProofArtifact: "factor_quality_daily_proof",
|
|
19749
|
+
requiredProofStatus: "ready",
|
|
19750
|
+
targetHistoryStartDate: "2015-01-01",
|
|
19751
|
+
historyStartDateClaim: "2015-01-01",
|
|
19752
|
+
betaReason: null,
|
|
19753
|
+
exclusionReason: null,
|
|
19754
|
+
claimPrerequisites: ["2015+ launch history", "latest complete market day", "row-level quality proof"]
|
|
19755
|
+
};
|
|
19756
|
+
var exampleQualityProof = {
|
|
19757
|
+
object: "factor_quality_proof",
|
|
19758
|
+
status: "ready",
|
|
19759
|
+
proofSource: "secapi_factor_pipeline",
|
|
19760
|
+
proofObservedAt: exampleAsOf,
|
|
19761
|
+
rowLevelProofAvailable: true,
|
|
19762
|
+
proofReady: true,
|
|
19763
|
+
firstDate: "2015-01-02",
|
|
19764
|
+
lastDate: "2026-06-09",
|
|
19765
|
+
firstRequiredMarketDate: "2015-01-02",
|
|
19766
|
+
latestMarketDay: "2026-06-09",
|
|
19767
|
+
targetHistoryStartDate: "2015-01-01",
|
|
19768
|
+
requiredHistoryStartDate: "2015-01-01",
|
|
19769
|
+
shortHistoryExempt: false,
|
|
19770
|
+
historyStartMarketDayLag: 0,
|
|
19771
|
+
latestMarketDayLag: 0,
|
|
19772
|
+
rowCount: 2882,
|
|
19773
|
+
distinctFactorDateCount: 2882,
|
|
19774
|
+
coveredMarketDateCount: 2882,
|
|
19775
|
+
expectedMarketDateCount: 2882,
|
|
19776
|
+
missingSessionCount: 0,
|
|
19777
|
+
coveragePct: 1,
|
|
19778
|
+
methodologyVersion: "secapi_factor_returns_v1",
|
|
19779
|
+
modelName: "secapi_stock_basket_factor_model_v1",
|
|
19780
|
+
methodologyUrl: "https://docs.secapi.ai/factors/methodology",
|
|
19781
|
+
sourceMetadata: {
|
|
19782
|
+
latestAsOf: "2026-06-09",
|
|
19783
|
+
latestSourcePublishedAt: "2026-06-09T21:30:00.000Z",
|
|
19784
|
+
observedModelNameCount: 1,
|
|
19785
|
+
observedModelNamesSample: ["secapi_stock_basket_factor_model_v1"],
|
|
19786
|
+
nonStockBasketRowCount: 0,
|
|
19787
|
+
metadataModelNames: ["secapi_stock_basket_factor_model_v1"],
|
|
19788
|
+
metadataModelVersions: ["2026-06-09"],
|
|
19789
|
+
metadataMethodologyUrls: ["https://docs.secapi.ai/factors/methodology"]
|
|
19790
|
+
},
|
|
19791
|
+
degradedReasons: []
|
|
19792
|
+
};
|
|
19793
|
+
var exampleHoldings = [
|
|
19794
|
+
{ symbol: "AAPL", weight: 0.35 },
|
|
19795
|
+
{ symbol: "MSFT", weight: 0.3 },
|
|
19796
|
+
{ symbol: "NVDA", weight: 0.2 },
|
|
19797
|
+
{ symbol: "JPM", weight: 0.15 }
|
|
19798
|
+
];
|
|
19799
|
+
var exampleHedgeConstraints = {
|
|
19800
|
+
maxHedges: 3,
|
|
19801
|
+
maxPositionWeight: 0.08,
|
|
19802
|
+
maxTotalHedgeWeight: 0.2,
|
|
19803
|
+
maxSectorWeight: 0.35,
|
|
19804
|
+
hedgeIntensity: 0.75,
|
|
19805
|
+
longOnly: false,
|
|
19806
|
+
allowedInstrumentTypes: ["etf"],
|
|
19807
|
+
customUniverse: ["QUAL", "MTUM", "VLUE", "USMV"],
|
|
19808
|
+
targetExposures: { VALUE: 0, MOMENTUM: 0.1 },
|
|
19809
|
+
minConfidence: "medium",
|
|
19810
|
+
minLiquidityUsd: 1e7,
|
|
19811
|
+
excludedSectors: []
|
|
19812
|
+
};
|
|
19813
|
+
var exampleOptimizerConstraints = {
|
|
19814
|
+
maxCandidates: 3,
|
|
19815
|
+
maxIterations: 50,
|
|
19816
|
+
maxRuntimeMs: 750,
|
|
19817
|
+
maxPositionWeight: 0.4,
|
|
19818
|
+
minPositionWeight: 0.02,
|
|
19819
|
+
longOnly: true,
|
|
19820
|
+
turnoverLimit: 0.25,
|
|
19821
|
+
riskFreeRate: 0.04
|
|
19822
|
+
};
|
|
19823
|
+
var exampleExposure = {
|
|
19824
|
+
object: "factor_exposure",
|
|
19825
|
+
id: "factor_exposure:AAPL:VALUE:2026-06-09",
|
|
19826
|
+
subjectType: "security",
|
|
19827
|
+
subjectKey: "AAPL",
|
|
19828
|
+
factorKey: "VALUE",
|
|
19829
|
+
beta: -0.42,
|
|
19830
|
+
intercept: 0.001,
|
|
19831
|
+
rSquared: 0.31,
|
|
19832
|
+
adjustedRSquared: 0.29,
|
|
19833
|
+
tStat: -4.8,
|
|
19834
|
+
observationCount: 126,
|
|
19835
|
+
nActiveFactors: 7,
|
|
19836
|
+
percentile: 18.2,
|
|
19837
|
+
confidence: "high",
|
|
19838
|
+
modelName: "secapi_stock_basket_factor_model_v1",
|
|
19839
|
+
asOf: exampleAsOf,
|
|
19840
|
+
responseMode: "compact",
|
|
19841
|
+
...exampleTrustMetadata,
|
|
19842
|
+
methodologyVersion: "secapi_factor_exposures_v1"
|
|
19843
|
+
};
|
|
19844
|
+
var exampleFactorReturn = {
|
|
19845
|
+
object: "factor_return",
|
|
19846
|
+
id: "factor_return:VALUE:1m:2026-06-09",
|
|
19847
|
+
factorKey: "VALUE",
|
|
19848
|
+
factorName: "Value",
|
|
19849
|
+
category: "style",
|
|
19850
|
+
asOf: exampleAsOf,
|
|
19851
|
+
window: "1m",
|
|
19852
|
+
modelName: "secapi_stock_basket_factor_model_v1",
|
|
19853
|
+
rawReturn: 0.018,
|
|
19854
|
+
pureReturn: 0.014,
|
|
19855
|
+
scaledReturn: 0.021,
|
|
19856
|
+
zScore: 1.42,
|
|
19857
|
+
leverage: 1,
|
|
19858
|
+
qualityProof: exampleQualityProof,
|
|
19859
|
+
responseMode: "compact",
|
|
19860
|
+
...exampleTrustMetadata
|
|
19861
|
+
};
|
|
19862
|
+
var exampleRegime = {
|
|
19863
|
+
key: "soft_landing",
|
|
19864
|
+
label: "Soft Landing",
|
|
19865
|
+
country: "US",
|
|
19866
|
+
confidence: "medium",
|
|
19867
|
+
drivers: [],
|
|
19868
|
+
factorImpacts: []
|
|
19869
|
+
};
|
|
19870
|
+
var exampleRegimePerformance = {
|
|
19871
|
+
object: "factor_regime_performance",
|
|
19872
|
+
id: "factor_regime_performance:US:VALUE:soft_landing:2026-06-09",
|
|
19873
|
+
country: "US",
|
|
19874
|
+
regimeKey: "soft_landing",
|
|
19875
|
+
regimeLabel: "Soft Landing",
|
|
19876
|
+
factorKey: "VALUE",
|
|
19877
|
+
factorName: "Value",
|
|
19878
|
+
factorCategory: "style",
|
|
19879
|
+
window: "1m",
|
|
19880
|
+
lookback: "6m",
|
|
19881
|
+
rank: 1,
|
|
19882
|
+
regimeScore: 0.68,
|
|
19883
|
+
combinedScore: 0.74,
|
|
19884
|
+
direction: "tailwind",
|
|
19885
|
+
rationale: "Value has positive recent return and historically improves in this regime.",
|
|
19886
|
+
rawReturn: 0.018,
|
|
19887
|
+
pureReturn: 0.014,
|
|
19888
|
+
scaledReturn: 0.021,
|
|
19889
|
+
zScore: 1.42,
|
|
19890
|
+
leverage: 1,
|
|
19891
|
+
asOf: exampleAsOf,
|
|
19892
|
+
responseMode: "compact",
|
|
19893
|
+
...exampleTrustMetadata
|
|
19894
|
+
};
|
|
19895
|
+
var examplePortfolioAnalysis = {
|
|
19896
|
+
object: "portfolio_analysis",
|
|
19897
|
+
id: "portfolio_analysis:example:2026-06-09",
|
|
19898
|
+
asOf: exampleAsOf,
|
|
19899
|
+
holdings: exampleHoldings,
|
|
19900
|
+
exposures: [exampleExposure],
|
|
19901
|
+
fit: null,
|
|
19902
|
+
benchmarkLabel: "NASDAQ 100",
|
|
19903
|
+
benchmarkTilts: [],
|
|
19904
|
+
whatIfComparison: null,
|
|
19905
|
+
positionViews: [],
|
|
19906
|
+
positionExposures: [exampleExposure],
|
|
19907
|
+
attribution: [
|
|
19908
|
+
{
|
|
19909
|
+
key: "VALUE",
|
|
19910
|
+
label: "Value",
|
|
19911
|
+
category: "factor",
|
|
19912
|
+
contributionPercent: -0.48,
|
|
19913
|
+
explanation: "Negative value beta detracted as value lagged over the selected window."
|
|
19914
|
+
}
|
|
19915
|
+
],
|
|
19916
|
+
hedgeSuggestions: [
|
|
19917
|
+
{
|
|
19918
|
+
symbol: "VLUE",
|
|
19919
|
+
instrumentType: "etf",
|
|
19920
|
+
rationale: "Offsets the portfolio's negative value exposure with a liquid value ETF sleeve.",
|
|
19921
|
+
expectedExposureDelta: { VALUE: 0.18 },
|
|
19922
|
+
confidence: "medium"
|
|
19923
|
+
}
|
|
19924
|
+
],
|
|
19925
|
+
optimizationNotes: ["Candidate search respected max position and turnover constraints."],
|
|
19926
|
+
factorNeutralPlan: ["Reduce negative VALUE exposure before increasing MOMENTUM exposure."],
|
|
19927
|
+
optimizerObjective: "factor_neutral",
|
|
19928
|
+
optimizerConstraints: exampleOptimizerConstraints,
|
|
19929
|
+
optimizerRuntime: {
|
|
19930
|
+
object: "portfolio_optimizer_runtime",
|
|
19931
|
+
method: "bounded_deterministic_candidate_search",
|
|
19932
|
+
candidateCount: 3,
|
|
19933
|
+
iterationBudget: 50,
|
|
19934
|
+
iterationsRun: 38,
|
|
19935
|
+
runtimeMs: 118,
|
|
19936
|
+
maxRuntimeMs: 750,
|
|
19937
|
+
timeout: false
|
|
19938
|
+
},
|
|
19939
|
+
optimizerCandidateCount: 1,
|
|
19940
|
+
optimizerCandidateSample: [
|
|
19941
|
+
{
|
|
19942
|
+
object: "portfolio_optimizer_candidate",
|
|
19943
|
+
rank: 1,
|
|
19944
|
+
name: "Factor-neutral tilt",
|
|
19945
|
+
objective: "factor_neutral",
|
|
19946
|
+
expectedReturn: 0.087,
|
|
19947
|
+
expectedVolatility: 0.164,
|
|
19948
|
+
expectedSharpe: 0.53,
|
|
19949
|
+
maxDrawdownProxy: -0.18,
|
|
19950
|
+
factorExposureScore: 0.21,
|
|
19951
|
+
turnover: 0.12,
|
|
19952
|
+
score: 0.81,
|
|
19953
|
+
constraintStatus: "ok",
|
|
19954
|
+
constraintsApplied: ["turnoverLimit"],
|
|
19955
|
+
rationale: "Improves factor balance without breaching turnover or concentration limits."
|
|
19956
|
+
}
|
|
19957
|
+
],
|
|
19958
|
+
selectedCandidate: null,
|
|
19959
|
+
optimizerDisclosures: ["Optimizer output is a deterministic scenario, not investment advice."],
|
|
19960
|
+
summaryMd: "Portfolio is growth and quality tilted with a moderate negative value exposure.",
|
|
19961
|
+
responseMode: "compact",
|
|
19962
|
+
...exampleTrustMetadata,
|
|
19963
|
+
methodologyVersion: "secapi_portfolio_factor_v1"
|
|
19964
|
+
};
|
|
19965
|
+
var examplePortfolioAttribution = {
|
|
19966
|
+
object: "portfolio_attribution",
|
|
19967
|
+
id: "portfolio_attribution:example:2026-06-09",
|
|
19968
|
+
analysisId: "portfolio_analysis:example:2026-06-09",
|
|
19969
|
+
asOf: exampleAsOf,
|
|
19970
|
+
country: "US",
|
|
19971
|
+
window: "3m",
|
|
19972
|
+
lookback: "12m",
|
|
19973
|
+
frequency: "weekly",
|
|
19974
|
+
holdings: exampleHoldings,
|
|
19975
|
+
portfolioReturn: 0.082,
|
|
19976
|
+
totalExplained: 0.061,
|
|
19977
|
+
alpha: 0.021,
|
|
19978
|
+
rSquared: 0.74,
|
|
19979
|
+
contributions: [
|
|
19980
|
+
{
|
|
19981
|
+
object: "portfolio_factor_attribution",
|
|
19982
|
+
rank: 1,
|
|
19983
|
+
factorKey: "MOMENTUM",
|
|
19984
|
+
factorName: "Momentum",
|
|
19985
|
+
factorCategory: "style",
|
|
19986
|
+
contributionPercent: 2.4,
|
|
19987
|
+
contributionPct: 0.024,
|
|
19988
|
+
beta: 0.37,
|
|
19989
|
+
factorReturn: 0.065,
|
|
19990
|
+
rawReturn: 0.058,
|
|
19991
|
+
pureReturn: 0.052,
|
|
19992
|
+
scaledReturn: 0.065,
|
|
19993
|
+
zScore: 1.7,
|
|
19994
|
+
leverage: 1,
|
|
19995
|
+
modelName: "secapi_stock_basket_factor_model_v1",
|
|
19996
|
+
explanation: "Positive momentum exposure explained 240 bps of the portfolio return."
|
|
19997
|
+
}
|
|
19998
|
+
],
|
|
19999
|
+
returnStream: [],
|
|
20000
|
+
returnPointCount: 12,
|
|
20001
|
+
returnStreamSample: [
|
|
20002
|
+
{
|
|
20003
|
+
object: "portfolio_return_point",
|
|
20004
|
+
period: "2026-W22",
|
|
20005
|
+
periodEnd: "2026-05-29",
|
|
20006
|
+
frequency: "weekly",
|
|
20007
|
+
periodReturn: 0.011,
|
|
20008
|
+
cumulativeReturn: 0.064,
|
|
20009
|
+
coverageWeight: 1,
|
|
20010
|
+
missingSymbols: []
|
|
20011
|
+
}
|
|
20012
|
+
],
|
|
20013
|
+
rollingBetas: [],
|
|
20014
|
+
rollingBetaCount: 4,
|
|
20015
|
+
rollingBetasUnavailableReason: null,
|
|
20016
|
+
exposures: [exampleExposure],
|
|
20017
|
+
export: {
|
|
20018
|
+
object: "portfolio_attribution_export",
|
|
20019
|
+
requestedFormat: "json",
|
|
20020
|
+
formats: ["json"],
|
|
20021
|
+
fileName: "secapi-portfolio-attribution-2026-06-09",
|
|
20022
|
+
columns: ["factorKey", "contributionPercent", "beta", "factorReturn"],
|
|
20023
|
+
csv: null,
|
|
20024
|
+
files: []
|
|
20025
|
+
},
|
|
20026
|
+
summaryMd: "Momentum and quality explained most of the recent return while value detracted.",
|
|
20027
|
+
responseMode: "compact",
|
|
20028
|
+
...exampleTrustMetadata,
|
|
20029
|
+
methodologyVersion: "secapi_portfolio_attribution_v1"
|
|
20030
|
+
};
|
|
20031
|
+
var examplePortfolioHedge = {
|
|
20032
|
+
object: "portfolio_hedge",
|
|
20033
|
+
id: "portfolio_hedge:example:2026-06-09",
|
|
20034
|
+
analysisId: "portfolio_analysis:example:2026-06-09",
|
|
20035
|
+
asOf: exampleAsOf,
|
|
20036
|
+
country: "US",
|
|
20037
|
+
lookback: "12m",
|
|
20038
|
+
objective: "factor_neutral",
|
|
20039
|
+
mode: "compact",
|
|
20040
|
+
constraints: exampleHedgeConstraints,
|
|
20041
|
+
holdings: exampleHoldings,
|
|
20042
|
+
targetExposures: [
|
|
20043
|
+
{
|
|
20044
|
+
object: "portfolio_hedge_target_exposure",
|
|
20045
|
+
factorKey: "VALUE",
|
|
20046
|
+
factorName: "Value",
|
|
20047
|
+
factorCategory: "style",
|
|
20048
|
+
beta: -0.42,
|
|
20049
|
+
targetExposureDelta: 0.42,
|
|
20050
|
+
proposedExposureDelta: 0.18,
|
|
20051
|
+
residualBeta: -0.24,
|
|
20052
|
+
hedged: true,
|
|
20053
|
+
skipReason: null
|
|
20054
|
+
}
|
|
20055
|
+
],
|
|
20056
|
+
hedges: [
|
|
20057
|
+
{
|
|
20058
|
+
object: "portfolio_hedge_candidate",
|
|
20059
|
+
rank: 1,
|
|
20060
|
+
factorKey: "VALUE",
|
|
20061
|
+
factorName: "Value",
|
|
20062
|
+
factorCategory: "style",
|
|
20063
|
+
symbol: "VLUE",
|
|
20064
|
+
instrumentType: "etf",
|
|
20065
|
+
action: "long",
|
|
20066
|
+
recommendedWeight: 0.08,
|
|
20067
|
+
targetExposureDelta: 0.42,
|
|
20068
|
+
expectedExposureDelta: { VALUE: 0.18 },
|
|
20069
|
+
residualBeta: -0.24,
|
|
20070
|
+
constraintStatus: "ok",
|
|
20071
|
+
constraintsApplied: ["maxPositionWeight"],
|
|
20072
|
+
liquidityUsd: 145000000,
|
|
20073
|
+
estimatedCostBps: 4,
|
|
20074
|
+
sectorKey: null,
|
|
20075
|
+
rationale: "Adds liquid value exposure without increasing single-name concentration.",
|
|
20076
|
+
confidence: "medium"
|
|
20077
|
+
}
|
|
20078
|
+
],
|
|
20079
|
+
residualExposure: { VALUE: -0.24, MOMENTUM: 0.37 },
|
|
20080
|
+
exposures: [exampleExposure],
|
|
20081
|
+
optimizationNotes: ["Hedge candidates are bounded by liquidity and max total hedge weight."],
|
|
20082
|
+
factorNeutralPlan: ["Add VLUE at 8% funded pro rata from overweight growth names."],
|
|
20083
|
+
summaryMd: "The suggested hedge reduces negative VALUE beta while keeping total hedge weight under 20%.",
|
|
20084
|
+
responseMode: "compact",
|
|
20085
|
+
...exampleTrustMetadata,
|
|
20086
|
+
methodologyVersion: "secapi_portfolio_hedge_v1"
|
|
20087
|
+
};
|
|
20088
|
+
var responseExampleBySchema = {
|
|
20089
|
+
FactorCatalog: {
|
|
20090
|
+
object: "list",
|
|
20091
|
+
data: [
|
|
20092
|
+
{
|
|
20093
|
+
object: "factor_definition",
|
|
20094
|
+
id: "factor:VALUE",
|
|
20095
|
+
key: "VALUE",
|
|
20096
|
+
name: "Value",
|
|
20097
|
+
category: "style",
|
|
20098
|
+
description: "Long cheaper stocks and short expensive stocks using SecAPI-owned factor construction.",
|
|
20099
|
+
benchmarkSymbol: "VLUE",
|
|
20100
|
+
equation: { long_leg: 1, short_leg: -1 },
|
|
20101
|
+
orthogonalizedAgainst: ["MARKET"],
|
|
20102
|
+
catalogStatus: "launch_ready",
|
|
20103
|
+
sourceAvailabilityStatus: "implemented",
|
|
20104
|
+
launchUniverseStatus: "launch_candidate",
|
|
20105
|
+
launchClaimStatus: "candidate_pending_history_freshness_proof",
|
|
20106
|
+
launchParityCategory: "style",
|
|
20107
|
+
launchReadiness: exampleLaunchReadiness,
|
|
20108
|
+
qualityProof: exampleQualityProof,
|
|
20109
|
+
responseMode: "compact",
|
|
20110
|
+
...exampleTrustMetadata
|
|
20111
|
+
}
|
|
20112
|
+
],
|
|
20113
|
+
hasMore: false,
|
|
20114
|
+
nextCursor: null,
|
|
20115
|
+
categories: ["market", "style", "sector", "industry"],
|
|
20116
|
+
requestId: "req_example"
|
|
20117
|
+
},
|
|
20118
|
+
FactorReturnList: {
|
|
20119
|
+
object: "list",
|
|
20120
|
+
data: [exampleFactorReturn],
|
|
20121
|
+
hasMore: false,
|
|
20122
|
+
nextCursor: null,
|
|
20123
|
+
responseMode: "compact",
|
|
20124
|
+
requestId: "req_example"
|
|
20125
|
+
},
|
|
20126
|
+
FactorHistory: {
|
|
20127
|
+
object: "factor_history",
|
|
20128
|
+
id: "factor_history:VALUE:1y:2026-06-09",
|
|
20129
|
+
factorKey: "VALUE",
|
|
20130
|
+
factorName: "Value",
|
|
20131
|
+
category: "style",
|
|
20132
|
+
range: "1y",
|
|
20133
|
+
dateFrom: "2025-06-10",
|
|
20134
|
+
dateTo: "2026-06-09",
|
|
20135
|
+
historyStartDate: "2015-01-02",
|
|
20136
|
+
historyEndDate: "2026-06-09",
|
|
20137
|
+
observationCount: 252,
|
|
20138
|
+
asOf: exampleAsOf,
|
|
20139
|
+
series: [],
|
|
20140
|
+
seriesCount: 252,
|
|
20141
|
+
seriesSample: [
|
|
20142
|
+
{ date: "2025-06-10", rawReturn: 0.0012, pureReturn: 0.0009, scaledReturn: 0.0011, zScore: 0.18, leverage: 1 },
|
|
20143
|
+
{ date: "2026-06-09", rawReturn: 0.0038, pureReturn: 0.0031, scaledReturn: 0.0042, zScore: 1.42, leverage: 1 }
|
|
20144
|
+
],
|
|
20145
|
+
expansionHints: ["Use include=series for full daily observations in compact mode."],
|
|
20146
|
+
summaryWindows: [
|
|
20147
|
+
{ window: "1d", rawReturn: 0.0038, pureReturn: 0.0031, scaledReturn: 0.0042, observationCount: 1, startDate: "2026-06-09", endDate: "2026-06-09" },
|
|
20148
|
+
{ window: "1m", rawReturn: 0.018, pureReturn: 0.014, scaledReturn: 0.021, observationCount: 21, startDate: "2026-05-11", endDate: "2026-06-09" },
|
|
20149
|
+
{ window: "max", rawReturn: 1.46, pureReturn: 1.12, scaledReturn: 1.31, observationCount: 2882, startDate: "2015-01-02", endDate: "2026-06-09" }
|
|
20150
|
+
],
|
|
20151
|
+
qualityProof: exampleQualityProof,
|
|
20152
|
+
responseMode: "compact",
|
|
20153
|
+
...exampleTrustMetadata,
|
|
20154
|
+
methodologyVersion: "secapi_factor_returns_v1"
|
|
20155
|
+
},
|
|
20156
|
+
FactorSparklineList: {
|
|
20157
|
+
object: "list",
|
|
20158
|
+
data: [
|
|
20159
|
+
{
|
|
20160
|
+
object: "factor_sparkline",
|
|
20161
|
+
id: "factor_sparkline:VALUE:1y:scaled_return",
|
|
20162
|
+
factorKey: "VALUE",
|
|
20163
|
+
factorName: "Value",
|
|
20164
|
+
category: "style",
|
|
20165
|
+
range: "1y",
|
|
20166
|
+
metric: "scaled_return",
|
|
20167
|
+
dateFrom: "2025-06-10",
|
|
20168
|
+
dateTo: "2026-06-09",
|
|
20169
|
+
historyStartDate: "2015-01-02",
|
|
20170
|
+
historyEndDate: "2026-06-09",
|
|
20171
|
+
observationCount: 252,
|
|
20172
|
+
pointCount: 120,
|
|
20173
|
+
asOf: exampleAsOf,
|
|
20174
|
+
latestValue: 0.131,
|
|
20175
|
+
latestRawReturn: 0.0038,
|
|
20176
|
+
latestPureReturn: 0.0031,
|
|
20177
|
+
latestScaledReturn: 0.0042,
|
|
20178
|
+
latestZScore: 1.42,
|
|
20179
|
+
latestLeverage: 1,
|
|
20180
|
+
summaryWindows: [
|
|
20181
|
+
{ window: "1m", rawReturn: 0.018, pureReturn: 0.014, scaledReturn: 0.021, observationCount: 21, startDate: "2026-05-11", endDate: "2026-06-09" }
|
|
20182
|
+
],
|
|
20183
|
+
points: [
|
|
20184
|
+
{ date: "2025-06-10", value: 0 },
|
|
20185
|
+
{ date: "2026-06-09", value: 0.131 }
|
|
20186
|
+
],
|
|
20187
|
+
qualityProof: exampleQualityProof,
|
|
20188
|
+
responseMode: "compact",
|
|
20189
|
+
...exampleTrustMetadata
|
|
20190
|
+
}
|
|
20191
|
+
],
|
|
20192
|
+
hasMore: false,
|
|
20193
|
+
nextCursor: null,
|
|
20194
|
+
responseMode: "compact",
|
|
20195
|
+
requestId: "req_example"
|
|
20196
|
+
},
|
|
20197
|
+
FactorDashboard: {
|
|
20198
|
+
object: "factor_dashboard",
|
|
20199
|
+
id: "factor_dashboard:US:style:2026-06-09",
|
|
20200
|
+
asOf: exampleAsOf,
|
|
20201
|
+
country: "US",
|
|
20202
|
+
category: "style",
|
|
20203
|
+
window: "1m",
|
|
20204
|
+
lookback: "6m",
|
|
20205
|
+
intraday: [],
|
|
20206
|
+
regimePerformance: [],
|
|
20207
|
+
rotation: null,
|
|
20208
|
+
spotlightSymbol: "AAPL",
|
|
20209
|
+
spotlightExposures: [exampleExposure],
|
|
20210
|
+
modelPortfolio: null,
|
|
20211
|
+
summaryMd: "Value is a tailwind, momentum remains extended, and the portfolio spotlight shows negative value exposure.",
|
|
20212
|
+
responseMode: "compact",
|
|
20213
|
+
...exampleTrustMetadata,
|
|
20214
|
+
methodologyVersion: "secapi_factor_dashboard_v1"
|
|
20215
|
+
},
|
|
20216
|
+
FactorIntradaySnapshotList: {
|
|
20217
|
+
object: "list",
|
|
20218
|
+
data: [
|
|
20219
|
+
{
|
|
20220
|
+
object: "factor_intraday_snapshot",
|
|
20221
|
+
id: "factor_intraday_snapshot:VALUE:1d:2026-06-09T19:45:00.000Z",
|
|
20222
|
+
factorKey: "VALUE",
|
|
20223
|
+
factorName: "Value",
|
|
20224
|
+
factorCategory: "style",
|
|
20225
|
+
modelName: "secapi_stock_basket_factor_model_v1",
|
|
20226
|
+
window: "1d",
|
|
20227
|
+
snapshotAt: exampleSnapshotAt,
|
|
20228
|
+
benchmarkSymbols: ["VLUE", "IWD", "IWF"],
|
|
20229
|
+
rawReturn: 0.0038,
|
|
20230
|
+
pureReturn: 0.0031,
|
|
20231
|
+
scaledReturn: 0.0042,
|
|
20232
|
+
zScore: 1.42,
|
|
20233
|
+
leverage: 1,
|
|
20234
|
+
responseMode: "compact",
|
|
20235
|
+
...exampleTrustMetadata
|
|
20236
|
+
}
|
|
20237
|
+
],
|
|
20238
|
+
hasMore: false,
|
|
20239
|
+
nextCursor: null,
|
|
20240
|
+
responseMode: "compact",
|
|
20241
|
+
requestId: "req_example"
|
|
20242
|
+
},
|
|
20243
|
+
FactorRegimePerformanceList: {
|
|
20244
|
+
object: "list",
|
|
20245
|
+
data: [exampleRegimePerformance],
|
|
20246
|
+
hasMore: false,
|
|
20247
|
+
nextCursor: null,
|
|
20248
|
+
responseMode: "compact",
|
|
20249
|
+
requestId: "req_example"
|
|
20250
|
+
},
|
|
20251
|
+
FactorExtremeMoveList: {
|
|
20252
|
+
object: "list",
|
|
20253
|
+
data: [
|
|
20254
|
+
{
|
|
20255
|
+
object: "factor_extreme_move",
|
|
20256
|
+
id: "factor_extreme_move:MOMENTUM:1m:2026-06-09",
|
|
20257
|
+
rank: 1,
|
|
20258
|
+
factorKey: "MOMENTUM",
|
|
20259
|
+
factorName: "Momentum",
|
|
20260
|
+
category: "style",
|
|
20261
|
+
window: "1m",
|
|
20262
|
+
lookback: "6m",
|
|
20263
|
+
direction: "up",
|
|
20264
|
+
sort: "abs_z_score",
|
|
20265
|
+
score: 2.61,
|
|
20266
|
+
absZScore: 2.61,
|
|
20267
|
+
absScaledReturn: 0.064,
|
|
20268
|
+
minAbsZScore: 2,
|
|
20269
|
+
isExtreme: true,
|
|
20270
|
+
asOf: exampleAsOf,
|
|
20271
|
+
rawReturn: 0.057,
|
|
20272
|
+
pureReturn: 0.049,
|
|
20273
|
+
scaledReturn: 0.064,
|
|
20274
|
+
zScore: 2.61,
|
|
20275
|
+
leverage: 1,
|
|
20276
|
+
responseMode: "compact",
|
|
20277
|
+
...exampleTrustMetadata
|
|
20278
|
+
}
|
|
20279
|
+
],
|
|
20280
|
+
hasMore: false,
|
|
20281
|
+
nextCursor: null,
|
|
20282
|
+
responseMode: "compact",
|
|
20283
|
+
requestId: "req_example"
|
|
20284
|
+
},
|
|
20285
|
+
FactorExtremePairList: {
|
|
20286
|
+
object: "list",
|
|
20287
|
+
data: [
|
|
20288
|
+
{
|
|
20289
|
+
object: "factor_extreme_pair",
|
|
20290
|
+
id: "factor_extreme_pair:MOMENTUM:VALUE:21d:2026-06-09",
|
|
20291
|
+
rank: 1,
|
|
20292
|
+
factor1: "MOMENTUM",
|
|
20293
|
+
factor2: "VALUE",
|
|
20294
|
+
factor1Name: "Momentum",
|
|
20295
|
+
factor2Name: "Value",
|
|
20296
|
+
category1: "style",
|
|
20297
|
+
category2: "style",
|
|
20298
|
+
window: "21d",
|
|
20299
|
+
lookback: "6m",
|
|
20300
|
+
direction: "factor1",
|
|
20301
|
+
sort: "abs_z_score",
|
|
20302
|
+
score: 2.18,
|
|
20303
|
+
absZScore: 2.18,
|
|
20304
|
+
absSpreadReturn: 0.043,
|
|
20305
|
+
minAbsZScore: 2,
|
|
20306
|
+
isExtreme: true,
|
|
20307
|
+
spreadReturn: 0.043,
|
|
20308
|
+
factor1Return: 0.064,
|
|
20309
|
+
factor2Return: 0.021,
|
|
20310
|
+
averageSpreadReturn: 0.006,
|
|
20311
|
+
spreadVolatility: 0.017,
|
|
20312
|
+
zScore: 2.18,
|
|
20313
|
+
spreadZScore: 2.18,
|
|
20314
|
+
meanReversionSignal: "factor1_overextended",
|
|
20315
|
+
meanReversionSummary: "Momentum has outperformed value unusually over the latest 21 trading days.",
|
|
20316
|
+
windowStartDate: "2026-05-11",
|
|
20317
|
+
windowEndDate: "2026-06-09",
|
|
20318
|
+
pairHistory: { endpoint: "/v1/factors/pair-history/MOMENTUM/VALUE?window=1m&lookback=6m" },
|
|
20319
|
+
observationCount: 126,
|
|
20320
|
+
rollingObservationCount: 106,
|
|
20321
|
+
asOf: exampleAsOf,
|
|
20322
|
+
responseMode: "compact",
|
|
20323
|
+
...exampleTrustMetadata
|
|
20324
|
+
}
|
|
20325
|
+
],
|
|
20326
|
+
hasMore: false,
|
|
20327
|
+
nextCursor: null,
|
|
20328
|
+
responseMode: "compact",
|
|
20329
|
+
requestId: "req_example"
|
|
20330
|
+
},
|
|
20331
|
+
FactorValuationList: {
|
|
20332
|
+
object: "list",
|
|
20333
|
+
data: [
|
|
20334
|
+
{
|
|
20335
|
+
object: "factor_valuation",
|
|
20336
|
+
id: "factor_valuation:VALUE:2026-06-09",
|
|
20337
|
+
rank: 1,
|
|
20338
|
+
factorKey: "VALUE",
|
|
20339
|
+
factorName: "Value",
|
|
20340
|
+
category: "style",
|
|
20341
|
+
valuationMetric: "earnings_yield",
|
|
20342
|
+
longLeg: "cheap",
|
|
20343
|
+
shortLeg: "expensive",
|
|
20344
|
+
window: "1m",
|
|
20345
|
+
lookback: "6m",
|
|
20346
|
+
signal: "tailwind",
|
|
20347
|
+
signalDirection: "tailwind",
|
|
20348
|
+
weightingMode: "long_short_equal",
|
|
20349
|
+
legWeights: { long: 1, short: -1 },
|
|
20350
|
+
rawFactorZScore: 1.42,
|
|
20351
|
+
weightedZScore: 1.42,
|
|
20352
|
+
sort: "opportunity_score",
|
|
20353
|
+
score: 0.71,
|
|
20354
|
+
opportunityScore: 0.71,
|
|
20355
|
+
zScore: 1.42,
|
|
20356
|
+
absZScore: 1.42,
|
|
20357
|
+
scaledReturn: 0.021,
|
|
20358
|
+
pureReturn: 0.014,
|
|
20359
|
+
rawReturn: 0.018,
|
|
20360
|
+
asOf: exampleAsOf,
|
|
20361
|
+
signalSource: "materialized_factor_return_z_score",
|
|
20362
|
+
stockDrilldown: { endpoint: "/v1/factors/valuations/stocks?factor=VALUE&signal=tailwind" },
|
|
20363
|
+
opportunitySummary: "Value is above trend and inexpensive names have a current factor tailwind.",
|
|
20364
|
+
responseMode: "compact",
|
|
20365
|
+
...exampleTrustMetadata
|
|
20366
|
+
}
|
|
20367
|
+
],
|
|
20368
|
+
hasMore: false,
|
|
20369
|
+
nextCursor: null,
|
|
20370
|
+
responseMode: "compact",
|
|
20371
|
+
requestId: "req_example"
|
|
20372
|
+
},
|
|
20373
|
+
FactorValuationStockList: {
|
|
20374
|
+
object: "list",
|
|
20375
|
+
data: [
|
|
20376
|
+
{
|
|
20377
|
+
object: "factor_valuation_stock",
|
|
20378
|
+
id: "factor_valuation_stock:VALUE:JPM:2026-06-09",
|
|
20379
|
+
rank: 1,
|
|
20380
|
+
symbol: "JPM",
|
|
20381
|
+
factorKey: "VALUE",
|
|
20382
|
+
factorName: "Value",
|
|
20383
|
+
category: "style",
|
|
20384
|
+
valuationMetric: "earnings_yield",
|
|
20385
|
+
valuationSignal: "tailwind",
|
|
20386
|
+
signalDirection: "tailwind",
|
|
20387
|
+
weightingMode: "long_short_equal",
|
|
20388
|
+
legWeights: { long: 1, short: -1 },
|
|
20389
|
+
stance: "beneficiaries",
|
|
20390
|
+
impact: "beneficiary",
|
|
20391
|
+
sort: "score",
|
|
20392
|
+
score: 0.84,
|
|
20393
|
+
expectedFactorImpactScore: 0.62,
|
|
20394
|
+
factorZScore: 1.42,
|
|
20395
|
+
rawFactorZScore: 1.42,
|
|
20396
|
+
weightedFactorZScore: 1.42,
|
|
20397
|
+
exposureAdjustedFactorZScore: 0.62,
|
|
20398
|
+
exposureBeta: 0.44,
|
|
20399
|
+
absExposureBeta: 0.44,
|
|
20400
|
+
exposurePercentile: 88.4,
|
|
20401
|
+
exposureConfidence: "high",
|
|
20402
|
+
nActiveFactors: 7,
|
|
20403
|
+
window: "1m",
|
|
20404
|
+
lookback: "6m",
|
|
20405
|
+
modelName: "secapi_stock_basket_factor_model_v1",
|
|
20406
|
+
asOf: exampleAsOf,
|
|
20407
|
+
factorAsOf: exampleAsOf,
|
|
20408
|
+
signalSource: "materialized_factor_return_z_score_plus_latest_factor_exposure",
|
|
20409
|
+
rankingRationale: "JPM has positive value beta while VALUE has a current tailwind.",
|
|
20410
|
+
opportunitySummary: "Potential beneficiary of a continuing value tailwind.",
|
|
20411
|
+
responseMode: "compact",
|
|
20412
|
+
...exampleTrustMetadata
|
|
20413
|
+
}
|
|
20414
|
+
],
|
|
20415
|
+
hasMore: false,
|
|
20416
|
+
nextCursor: null,
|
|
20417
|
+
responseMode: "compact",
|
|
20418
|
+
requestId: "req_example"
|
|
20419
|
+
},
|
|
20420
|
+
FactorSimilarityPack: {
|
|
20421
|
+
object: "factor_similarity_pack",
|
|
20422
|
+
id: "factor_similarity_pack:NVDA:2026-06-09",
|
|
20423
|
+
symbol: "NVDA",
|
|
20424
|
+
asOf: exampleAsOf,
|
|
20425
|
+
anchorTheme: "accelerated compute",
|
|
20426
|
+
themeLabels: ["AI infrastructure", "semiconductors"],
|
|
20427
|
+
factorKeySuggestion: "AI_INFRASTRUCTURE",
|
|
20428
|
+
discoveryMode: "factor_overlap_plus_filing_news_signature",
|
|
20429
|
+
semanticSignature: {
|
|
20430
|
+
algorithm: "secapi_filing_news_signature_v1",
|
|
20431
|
+
dimensions: 384,
|
|
20432
|
+
topTerms: ["accelerated computing", "data center", "gpu"],
|
|
20433
|
+
sourceKinds: ["filing_title", "news_headline"],
|
|
20434
|
+
sourceCount: 18
|
|
20435
|
+
},
|
|
20436
|
+
namingWorkflow: {
|
|
20437
|
+
workflowVersion: "2026-06-09",
|
|
20438
|
+
selectedLabel: "AI Infrastructure",
|
|
20439
|
+
factorKeySuggestion: "AI_INFRASTRUCTURE",
|
|
20440
|
+
confidence: "high",
|
|
20441
|
+
labelCandidates: [
|
|
20442
|
+
{ label: "AI Infrastructure", score: 0.91, kind: "phrase", evidenceTerms: ["data center", "gpu"], sourceCount: 18 }
|
|
20443
|
+
],
|
|
20444
|
+
rationale: "Peers cluster around data-center accelerator demand and AI infrastructure filings."
|
|
20445
|
+
},
|
|
20446
|
+
evidence: [],
|
|
20447
|
+
peers: [],
|
|
20448
|
+
summaryMd: "NVDA peers share semiconductor and AI infrastructure signatures plus similar factor exposure.",
|
|
20449
|
+
responseMode: "compact",
|
|
20450
|
+
...exampleTrustMetadata
|
|
20451
|
+
},
|
|
20452
|
+
FactorExposureList: {
|
|
20453
|
+
object: "list",
|
|
20454
|
+
data: [exampleExposure],
|
|
20455
|
+
hasMore: false,
|
|
20456
|
+
nextCursor: null,
|
|
20457
|
+
responseMode: "compact",
|
|
20458
|
+
requestId: "req_example"
|
|
20459
|
+
},
|
|
20460
|
+
FactorCorrelationList: {
|
|
20461
|
+
object: "list",
|
|
20462
|
+
data: [
|
|
20463
|
+
{
|
|
20464
|
+
object: "factor_correlation",
|
|
20465
|
+
id: "factor_correlation:VALUE:MOMENTUM:6m",
|
|
20466
|
+
leftFactorKey: "VALUE",
|
|
20467
|
+
rightFactorKey: "MOMENTUM",
|
|
20468
|
+
lookback: "6m",
|
|
20469
|
+
correlation: -0.34,
|
|
20470
|
+
observationCount: 126,
|
|
20471
|
+
responseMode: "compact",
|
|
20472
|
+
...exampleTrustMetadata
|
|
20473
|
+
}
|
|
20474
|
+
],
|
|
20475
|
+
hasMore: false,
|
|
20476
|
+
nextCursor: null,
|
|
20477
|
+
responseMode: "compact",
|
|
20478
|
+
requestId: "req_example"
|
|
20479
|
+
},
|
|
20480
|
+
FactorDecomposition: {
|
|
20481
|
+
object: "factor_decomposition",
|
|
20482
|
+
id: "factor_decomposition:AAPL:3m:2026-06-09",
|
|
20483
|
+
symbol: "AAPL",
|
|
20484
|
+
factorCategory: "style",
|
|
20485
|
+
window: "3m",
|
|
20486
|
+
asOf: exampleAsOf,
|
|
20487
|
+
exposures: [exampleExposure],
|
|
20488
|
+
contributions: [
|
|
20489
|
+
{
|
|
20490
|
+
factorKey: "MOMENTUM",
|
|
20491
|
+
contributionPercent: 1.8,
|
|
20492
|
+
explanation: "Momentum beta explained 180 bps of AAPL's selected-window return."
|
|
20493
|
+
}
|
|
20494
|
+
],
|
|
20495
|
+
summaryMd: "AAPL's selected-window return was mostly explained by momentum and quality exposure.",
|
|
20496
|
+
stockReturn: 0.072,
|
|
20497
|
+
totalExplained: 0.049,
|
|
20498
|
+
alpha: 0.023,
|
|
20499
|
+
rSquared: 0.68,
|
|
20500
|
+
modelName: "secapi_stock_basket_factor_model_v1",
|
|
20501
|
+
date: exampleDataDate,
|
|
20502
|
+
responseMode: "compact",
|
|
20503
|
+
...exampleTrustMetadata
|
|
20504
|
+
},
|
|
20505
|
+
RelatedSecurityList: {
|
|
20506
|
+
object: "list",
|
|
20507
|
+
data: [
|
|
20508
|
+
{
|
|
20509
|
+
object: "related_security",
|
|
20510
|
+
id: "related_security:NVDA:AMD",
|
|
20511
|
+
symbol: "AMD",
|
|
20512
|
+
similarity: 0.86,
|
|
20513
|
+
score: 0.84,
|
|
20514
|
+
factorSimilarity: 0.79,
|
|
20515
|
+
thematicSimilarity: 0.91,
|
|
20516
|
+
factorOverlap: ["MOMENTUM", "QUALITY", "AI_INFRASTRUCTURE"],
|
|
20517
|
+
explanation: "AMD shares semiconductor, AI infrastructure, and momentum exposure with NVDA.",
|
|
20518
|
+
themeLabels: ["AI infrastructure", "semiconductors"],
|
|
20519
|
+
evidence: [],
|
|
20520
|
+
responseMode: "compact",
|
|
20521
|
+
...exampleTrustMetadata
|
|
20522
|
+
}
|
|
20523
|
+
],
|
|
20524
|
+
hasMore: false,
|
|
20525
|
+
nextCursor: null,
|
|
20526
|
+
responseMode: "compact",
|
|
20527
|
+
requestId: "req_example"
|
|
20528
|
+
},
|
|
20529
|
+
FactorPairSpreadList: {
|
|
20530
|
+
object: "list",
|
|
20531
|
+
data: [
|
|
20532
|
+
{
|
|
20533
|
+
object: "factor_pair_spread",
|
|
20534
|
+
id: "factor_pair_spread:MOMENTUM:VALUE:21d:2026-06-09",
|
|
20535
|
+
factor1: "MOMENTUM",
|
|
20536
|
+
factor2: "VALUE",
|
|
20537
|
+
factor1Name: "Momentum",
|
|
20538
|
+
factor2Name: "Value",
|
|
20539
|
+
category1: "style",
|
|
20540
|
+
category2: "style",
|
|
20541
|
+
window: "21d",
|
|
20542
|
+
lookback: "6m",
|
|
20543
|
+
spreadReturn: 0.043,
|
|
20544
|
+
factor1Return: 0.064,
|
|
20545
|
+
factor2Return: 0.021,
|
|
20546
|
+
averageSpread: 0.006,
|
|
20547
|
+
averageSpreadReturn: 0.006,
|
|
20548
|
+
spreadVolatility: 0.017,
|
|
20549
|
+
rollingSpreadVolatility: 0.017,
|
|
20550
|
+
zScore: 2.18,
|
|
20551
|
+
spreadZScore: 2.18,
|
|
20552
|
+
absZScore: 2.18,
|
|
20553
|
+
direction: "factor1",
|
|
20554
|
+
meanReversionSignal: "factor1_overextended",
|
|
20555
|
+
meanReversionSummary: "Momentum has outperformed value unusually over the latest 21 trading days.",
|
|
20556
|
+
windowStartDate: "2026-05-11",
|
|
20557
|
+
windowEndDate: "2026-06-09",
|
|
20558
|
+
rollingObservationCount: 106,
|
|
20559
|
+
observationCount: 126,
|
|
20560
|
+
seriesCount: 106,
|
|
20561
|
+
seriesSample: [
|
|
20562
|
+
{ date: "2026-05-11", spread: 0.004, f1Return: 0.006, f2Return: 0.002 },
|
|
20563
|
+
{ date: "2026-06-09", spread: 0.043, f1Return: 0.064, f2Return: 0.021 }
|
|
20564
|
+
],
|
|
20565
|
+
expansionHints: ["Use response_mode=standard for full pair-history series."],
|
|
20566
|
+
asOf: exampleAsOf,
|
|
20567
|
+
responseMode: "compact",
|
|
20568
|
+
...exampleTrustMetadata
|
|
20569
|
+
}
|
|
20570
|
+
],
|
|
20571
|
+
hasMore: false,
|
|
20572
|
+
nextCursor: null,
|
|
20573
|
+
responseMode: "compact",
|
|
20574
|
+
requestId: "req_example"
|
|
20575
|
+
},
|
|
20576
|
+
FactorBulkReturnList: {
|
|
20577
|
+
object: "list",
|
|
20578
|
+
data: [
|
|
20579
|
+
{
|
|
20580
|
+
object: "factor_bulk_return",
|
|
20581
|
+
id: "factor_bulk_return:VALUE:12m:2026-06-09",
|
|
20582
|
+
factorKey: "VALUE",
|
|
20583
|
+
factorName: "Value",
|
|
20584
|
+
category: "style",
|
|
20585
|
+
asOf: exampleAsOf,
|
|
20586
|
+
window: "1m",
|
|
20587
|
+
lookback: "12m",
|
|
20588
|
+
rawReturn: 0.018,
|
|
20589
|
+
pureReturn: 0.014,
|
|
20590
|
+
scaledReturn: 0.021,
|
|
20591
|
+
zScore: 1.42,
|
|
20592
|
+
leverage: 1,
|
|
20593
|
+
seriesCount: 252,
|
|
20594
|
+
seriesSample: [
|
|
20595
|
+
{ date: "2025-06-10", rawReturn: 0.0012, pureReturn: 0.0009, scaledReturn: 0.0011, zScore: 0.18 },
|
|
20596
|
+
{ date: "2026-06-09", rawReturn: 0.0038, pureReturn: 0.0031, scaledReturn: 0.0042, zScore: 1.42 }
|
|
20597
|
+
],
|
|
20598
|
+
expansionHints: ["Use response_mode=standard for full daily series."],
|
|
20599
|
+
responseMode: "compact",
|
|
20600
|
+
...exampleTrustMetadata
|
|
20601
|
+
}
|
|
20602
|
+
],
|
|
20603
|
+
hasMore: false,
|
|
20604
|
+
nextCursor: null,
|
|
20605
|
+
responseMode: "compact",
|
|
20606
|
+
requestId: "req_example"
|
|
20607
|
+
},
|
|
20608
|
+
PortfolioAnalysis: examplePortfolioAnalysis,
|
|
20609
|
+
PortfolioAttribution: examplePortfolioAttribution,
|
|
20610
|
+
PortfolioHedge: examplePortfolioHedge,
|
|
20611
|
+
ModelFactorAnalysis: {
|
|
20612
|
+
object: "model_factor_analysis",
|
|
20613
|
+
id: "model_factor_analysis:example:2026-06-09",
|
|
20614
|
+
asOf: exampleAsOf,
|
|
20615
|
+
model: {
|
|
20616
|
+
id: "growth-quality-core",
|
|
20617
|
+
label: "Growth Quality Core",
|
|
20618
|
+
description: "Model Builder portfolio submitted for factor analysis.",
|
|
20619
|
+
tags: ["model-builder", "growth"],
|
|
20620
|
+
source: "model_builder"
|
|
20621
|
+
},
|
|
20622
|
+
country: "US",
|
|
20623
|
+
lookback: "12m",
|
|
20624
|
+
window: "3m",
|
|
20625
|
+
category: "style",
|
|
20626
|
+
holdings: exampleHoldings,
|
|
20627
|
+
include: { attribution: true, hedge: true, optimizer: true, positionViews: true },
|
|
20628
|
+
analysis: examplePortfolioAnalysis,
|
|
20629
|
+
attribution: examplePortfolioAttribution,
|
|
20630
|
+
hedge: examplePortfolioHedge,
|
|
20631
|
+
optimizerObjective: "factor_neutral",
|
|
20632
|
+
optimizerConstraints: exampleOptimizerConstraints,
|
|
20633
|
+
optimizerRuntime: examplePortfolioAnalysis.optimizerRuntime,
|
|
20634
|
+
optimizerCandidates: [],
|
|
20635
|
+
optimizerCandidateCount: 1,
|
|
20636
|
+
optimizerCandidateSample: examplePortfolioAnalysis.optimizerCandidateSample,
|
|
20637
|
+
selectedCandidate: null,
|
|
20638
|
+
optimizerDisclosures: examplePortfolioAnalysis.optimizerDisclosures,
|
|
20639
|
+
positionViews: [],
|
|
20640
|
+
positionExposures: [exampleExposure],
|
|
20641
|
+
summaryMd: "Model is growth-quality tilted; hedge and optimizer sections show bounded factor-neutral alternatives.",
|
|
20642
|
+
responseMode: "compact",
|
|
20643
|
+
...exampleTrustMetadata,
|
|
20644
|
+
methodologyVersion: "secapi_model_factor_analysis_v1"
|
|
20645
|
+
},
|
|
20646
|
+
ModelPortfolioFactorView: {
|
|
20647
|
+
object: "model_portfolio_factor_view",
|
|
20648
|
+
id: "model_portfolio_factor_view:growth-quality-core:2026-06-09",
|
|
20649
|
+
portfolioId: "growth-quality-core",
|
|
20650
|
+
label: "Growth Quality Core",
|
|
20651
|
+
description: "Saved Turos model portfolio factor view.",
|
|
20652
|
+
tags: ["model-builder", "growth"],
|
|
20653
|
+
holdings: exampleHoldings,
|
|
20654
|
+
analysis: examplePortfolioAnalysis,
|
|
20655
|
+
positionViews: [],
|
|
20656
|
+
positionExposures: [exampleExposure],
|
|
20657
|
+
responseMode: "compact",
|
|
20658
|
+
...exampleTrustMetadata
|
|
20659
|
+
},
|
|
20660
|
+
FactorRotationStrategy: {
|
|
20661
|
+
object: "factor_rotation_strategy",
|
|
20662
|
+
id: "factor_rotation_strategy:US:soft_landing:2026-06-09",
|
|
20663
|
+
asOf: exampleAsOf,
|
|
20664
|
+
country: "US",
|
|
20665
|
+
regime: exampleRegime,
|
|
20666
|
+
leaders: [exampleRegimePerformance],
|
|
20667
|
+
laggards: [
|
|
20668
|
+
{
|
|
20669
|
+
...exampleRegimePerformance,
|
|
20670
|
+
id: "factor_regime_performance:US:LOW_VOL:soft_landing:2026-06-09",
|
|
20671
|
+
factorKey: "LOW_VOL",
|
|
20672
|
+
factorName: "Low Volatility",
|
|
20673
|
+
rank: 2,
|
|
20674
|
+
direction: "headwind",
|
|
20675
|
+
combinedScore: -0.41,
|
|
20676
|
+
rationale: "Low volatility trails in the current risk-on regime."
|
|
20677
|
+
}
|
|
20678
|
+
],
|
|
20679
|
+
summaryMd: "Rotate toward value and momentum while low volatility trails in the current regime.",
|
|
20680
|
+
responseMode: "compact",
|
|
20681
|
+
...exampleTrustMetadata
|
|
20682
|
+
},
|
|
20683
|
+
FactorRegimeScreen: {
|
|
20684
|
+
object: "regime_screen",
|
|
20685
|
+
id: "regime_screen:US:soft_landing:2026-06-09",
|
|
20686
|
+
asOf: exampleAsOf,
|
|
20687
|
+
country: "US",
|
|
20688
|
+
regime: exampleRegime,
|
|
20689
|
+
matches: [exampleFactorReturn],
|
|
20690
|
+
summaryMd: "Value and momentum are the highest-ranked style factors for the current regime screen.",
|
|
20691
|
+
responseMode: "compact",
|
|
20692
|
+
...exampleTrustMetadata
|
|
20693
|
+
},
|
|
20694
|
+
PortfolioStressTest: {
|
|
20695
|
+
object: "portfolio_stress_test",
|
|
20696
|
+
id: "portfolio_stress_test:higher_for_longer:2026-06-09",
|
|
20697
|
+
asOf: exampleAsOf,
|
|
20698
|
+
scenarioKey: "higher_for_longer",
|
|
20699
|
+
scenarioLabel: "Higher for Longer",
|
|
20700
|
+
estimatedDrawdownPercent: -7.4,
|
|
20701
|
+
factorShocks: { VALUE: 0.02, MOMENTUM: -0.04, QUALITY: 0.01 },
|
|
20702
|
+
macroShocks: { rates: 0.75, credit_spreads: 0.35 },
|
|
20703
|
+
regime: null,
|
|
20704
|
+
conditioningNotes: ["Uses bounded factor shocks from historical higher-rate episodes."],
|
|
20705
|
+
summaryMd: "Portfolio drawdown proxy is driven mainly by momentum and duration-sensitive exposures.",
|
|
20706
|
+
responseMode: "compact",
|
|
20707
|
+
...exampleTrustMetadata
|
|
20708
|
+
}
|
|
20709
|
+
};
|
|
20710
|
+
var requestExampleBySchema = {
|
|
20711
|
+
FactorCustomDiscoveryRequest: {
|
|
20712
|
+
symbol: "NVDA",
|
|
20713
|
+
candidates: ["AMD", "AVGO", "TSM", "ASML"],
|
|
20714
|
+
lookback: "6m",
|
|
20715
|
+
limit: 5
|
|
20716
|
+
},
|
|
20717
|
+
PortfolioIntelligenceRequest: {
|
|
20718
|
+
country: "US",
|
|
20719
|
+
lookback: "12m",
|
|
20720
|
+
category: "style",
|
|
20721
|
+
keys: ["VALUE", "MOMENTUM", "QUALITY"],
|
|
20722
|
+
holdings: exampleHoldings,
|
|
20723
|
+
benchmarkLabel: "NASDAQ 100",
|
|
20724
|
+
benchmarkHoldings: [
|
|
20725
|
+
{ symbol: "QQQ", weight: 1 }
|
|
20726
|
+
]
|
|
20727
|
+
},
|
|
20728
|
+
PortfolioAttributionRequest: {
|
|
20729
|
+
country: "US",
|
|
20730
|
+
lookback: "12m",
|
|
20731
|
+
window: "3m",
|
|
20732
|
+
frequency: "weekly",
|
|
20733
|
+
exportFormat: "json",
|
|
20734
|
+
category: "style",
|
|
20735
|
+
keys: ["VALUE", "MOMENTUM", "QUALITY"],
|
|
20736
|
+
holdings: exampleHoldings
|
|
20737
|
+
},
|
|
20738
|
+
PortfolioHedgeRequest: {
|
|
20739
|
+
country: "US",
|
|
20740
|
+
lookback: "12m",
|
|
20741
|
+
category: "style",
|
|
20742
|
+
keys: ["VALUE", "MOMENTUM", "QUALITY"],
|
|
20743
|
+
objective: "factor_neutral",
|
|
20744
|
+
mode: "compact",
|
|
20745
|
+
constraints: exampleHedgeConstraints,
|
|
20746
|
+
holdings: exampleHoldings
|
|
20747
|
+
},
|
|
20748
|
+
PortfolioOptimizeRequest: {
|
|
20749
|
+
country: "US",
|
|
20750
|
+
lookback: "12m",
|
|
20751
|
+
category: "style",
|
|
20752
|
+
keys: ["VALUE", "MOMENTUM", "QUALITY"],
|
|
20753
|
+
objective: "factor_neutral",
|
|
20754
|
+
constraints: exampleOptimizerConstraints,
|
|
20755
|
+
holdings: exampleHoldings
|
|
20756
|
+
},
|
|
20757
|
+
PortfolioStressTestRequest: {
|
|
20758
|
+
country: "US",
|
|
20759
|
+
lookback: "12m",
|
|
20760
|
+
category: "style",
|
|
20761
|
+
keys: ["VALUE", "MOMENTUM", "QUALITY"],
|
|
20762
|
+
scenarioKey: "higher_for_longer",
|
|
20763
|
+
holdings: exampleHoldings
|
|
20764
|
+
},
|
|
20765
|
+
ModelFactorAnalysisRequest: {
|
|
20766
|
+
model: {
|
|
20767
|
+
id: "growth-quality-core",
|
|
20768
|
+
label: "Growth Quality Core",
|
|
20769
|
+
description: "Model Builder portfolio submitted for factor analysis.",
|
|
20770
|
+
tags: ["model-builder", "growth"],
|
|
20771
|
+
source: "model_builder"
|
|
20772
|
+
},
|
|
20773
|
+
country: "US",
|
|
20774
|
+
lookback: "12m",
|
|
20775
|
+
window: "3m",
|
|
20776
|
+
category: "style",
|
|
20777
|
+
keys: ["VALUE", "MOMENTUM", "QUALITY"],
|
|
20778
|
+
include: { attribution: true, hedge: true, optimizer: true, positionViews: true },
|
|
20779
|
+
hedge: {
|
|
20780
|
+
objective: "factor_neutral",
|
|
20781
|
+
mode: "compact",
|
|
20782
|
+
constraints: exampleHedgeConstraints
|
|
20783
|
+
},
|
|
20784
|
+
optimizer: {
|
|
20785
|
+
objective: "factor_neutral",
|
|
20786
|
+
constraints: exampleOptimizerConstraints
|
|
20787
|
+
},
|
|
20788
|
+
holdings: exampleHoldings
|
|
20789
|
+
},
|
|
20790
|
+
FactorStrategyRequest: {
|
|
20791
|
+
country: "US",
|
|
20792
|
+
category: "style",
|
|
20793
|
+
window: "1m",
|
|
20794
|
+
lookback: "6m",
|
|
20795
|
+
limit: 5
|
|
20796
|
+
}
|
|
20797
|
+
};
|
|
20798
|
+
var launchResponseSchemasRequiringExplicitExamples = new Set([
|
|
20799
|
+
"FactorCatalog",
|
|
20800
|
+
"FactorReturnList",
|
|
20801
|
+
"FactorHistory",
|
|
20802
|
+
"FactorSparklineList",
|
|
20803
|
+
"FactorIntradaySnapshotList",
|
|
20804
|
+
"FactorDashboard",
|
|
20805
|
+
"FactorRegimePerformanceList",
|
|
20806
|
+
"FactorExposureList",
|
|
20807
|
+
"FactorCorrelationList",
|
|
20808
|
+
"FactorDecomposition",
|
|
20809
|
+
"RelatedSecurityList",
|
|
20810
|
+
"FactorSimilarityPack",
|
|
20811
|
+
"FactorPairSpreadList",
|
|
20812
|
+
"FactorBulkReturnList",
|
|
20813
|
+
"FactorExtremeMoveList",
|
|
20814
|
+
"FactorExtremePairList",
|
|
20815
|
+
"FactorValuationList",
|
|
20816
|
+
"FactorValuationStockList",
|
|
20817
|
+
"PortfolioAnalysis",
|
|
20818
|
+
"PortfolioAttribution",
|
|
20819
|
+
"PortfolioHedge",
|
|
20820
|
+
"PortfolioStressTest",
|
|
20821
|
+
"ModelPortfolioFactorView",
|
|
20822
|
+
"ModelFactorAnalysis",
|
|
20823
|
+
"FactorRotationStrategy",
|
|
20824
|
+
"FactorRegimeScreen"
|
|
20825
|
+
]);
|
|
20826
|
+
var responseExampleForSchema = (name) => {
|
|
20827
|
+
const specificExample = responseExampleBySchema[name];
|
|
20828
|
+
if (specificExample)
|
|
20829
|
+
return specificExample;
|
|
20830
|
+
if (launchResponseSchemasRequiringExplicitExamples.has(name)) {
|
|
20831
|
+
throw new Error(`Launch OpenAPI schema ${name} requires a realistic explicit example`);
|
|
20832
|
+
}
|
|
20833
|
+
if (name === "FactorCatalog") {
|
|
20834
|
+
return {
|
|
20835
|
+
object: "list",
|
|
20836
|
+
data: [],
|
|
20837
|
+
hasMore: false,
|
|
20838
|
+
nextCursor: null,
|
|
20839
|
+
categories: ["market", "style", "sector", "industry"],
|
|
20840
|
+
requestId: "req_example"
|
|
20841
|
+
};
|
|
20842
|
+
}
|
|
20843
|
+
if (name.endsWith("List") || name === "FactorCatalog") {
|
|
20844
|
+
return {
|
|
20845
|
+
object: "list",
|
|
20846
|
+
data: [],
|
|
20847
|
+
hasMore: false,
|
|
20848
|
+
nextCursor: null,
|
|
20849
|
+
responseMode: "compact",
|
|
20850
|
+
requestId: "req_example"
|
|
20851
|
+
};
|
|
20852
|
+
}
|
|
20853
|
+
return {
|
|
20854
|
+
object: objectExampleBySchema[name] ?? name.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase(),
|
|
20855
|
+
responseMode: "compact",
|
|
20856
|
+
requestId: "req_example"
|
|
20857
|
+
};
|
|
20858
|
+
};
|
|
20859
|
+
var requestExampleForSchema = (name) => requestExampleBySchema[name];
|
|
18759
20860
|
var jsonContent = (name) => ({
|
|
18760
20861
|
"application/json": {
|
|
18761
20862
|
schema: schemaRef(name)
|
|
18762
20863
|
}
|
|
18763
20864
|
});
|
|
20865
|
+
var jsonContentWithExample = (name, summary = "Compact response") => ({
|
|
20866
|
+
"application/json": {
|
|
20867
|
+
schema: schemaRef(name),
|
|
20868
|
+
examples: {
|
|
20869
|
+
compact: {
|
|
20870
|
+
summary,
|
|
20871
|
+
value: responseExampleForSchema(name)
|
|
20872
|
+
}
|
|
20873
|
+
}
|
|
20874
|
+
}
|
|
20875
|
+
});
|
|
18764
20876
|
var jsonResponse = (name, description = "Successful response") => ({
|
|
18765
20877
|
responses: {
|
|
18766
20878
|
"200": {
|
|
@@ -18769,13 +20881,105 @@ var jsonResponse = (name, description = "Successful response") => ({
|
|
|
18769
20881
|
}
|
|
18770
20882
|
}
|
|
18771
20883
|
});
|
|
20884
|
+
var jsonStatusResponse = (status, name, description = "Successful response") => ({
|
|
20885
|
+
responses: {
|
|
20886
|
+
[status]: {
|
|
20887
|
+
description,
|
|
20888
|
+
content: jsonContent(name)
|
|
20889
|
+
}
|
|
20890
|
+
}
|
|
20891
|
+
});
|
|
20892
|
+
var jsonResponseWithExample = (name, description = "Successful response") => ({
|
|
20893
|
+
responses: {
|
|
20894
|
+
"200": {
|
|
20895
|
+
description,
|
|
20896
|
+
content: jsonContentWithExample(name)
|
|
20897
|
+
}
|
|
20898
|
+
}
|
|
20899
|
+
});
|
|
20900
|
+
var jsonFactorResponse = (name, description = "Successful response") => ({
|
|
20901
|
+
responses: {
|
|
20902
|
+
"200": {
|
|
20903
|
+
description,
|
|
20904
|
+
content: {
|
|
20905
|
+
"application/json": {
|
|
20906
|
+
schema: schemaRef(name),
|
|
20907
|
+
examples: {
|
|
20908
|
+
compact: {
|
|
20909
|
+
summary: "Token-efficient compact response",
|
|
20910
|
+
value: responseExampleForSchema(name)
|
|
20911
|
+
}
|
|
20912
|
+
}
|
|
20913
|
+
}
|
|
20914
|
+
}
|
|
20915
|
+
}
|
|
20916
|
+
}
|
|
20917
|
+
});
|
|
20918
|
+
var jsonFactorResponseWithCsv = (name, description = "Successful response") => {
|
|
20919
|
+
const response = jsonFactorResponse(name, description);
|
|
20920
|
+
return {
|
|
20921
|
+
responses: {
|
|
20922
|
+
"200": {
|
|
20923
|
+
...response.responses["200"],
|
|
20924
|
+
content: {
|
|
20925
|
+
...response.responses["200"].content,
|
|
20926
|
+
"text/csv": {
|
|
20927
|
+
schema: { type: "string" }
|
|
20928
|
+
}
|
|
20929
|
+
}
|
|
20930
|
+
}
|
|
20931
|
+
}
|
|
20932
|
+
};
|
|
20933
|
+
};
|
|
18772
20934
|
var jsonRequestBody = (name, description) => ({
|
|
18773
20935
|
requestBody: {
|
|
18774
20936
|
required: true,
|
|
18775
20937
|
...description ? { description } : {},
|
|
18776
|
-
content:
|
|
20938
|
+
content: {
|
|
20939
|
+
"application/json": {
|
|
20940
|
+
schema: schemaRef(name),
|
|
20941
|
+
...requestExampleForSchema(name) ? {
|
|
20942
|
+
examples: {
|
|
20943
|
+
default: {
|
|
20944
|
+
summary: "Copy-pasteable request",
|
|
20945
|
+
value: requestExampleForSchema(name)
|
|
20946
|
+
}
|
|
20947
|
+
}
|
|
20948
|
+
} : {}
|
|
20949
|
+
}
|
|
20950
|
+
}
|
|
18777
20951
|
}
|
|
18778
20952
|
});
|
|
20953
|
+
var factorResponseParameters = [
|
|
20954
|
+
{
|
|
20955
|
+
name: "response_mode",
|
|
20956
|
+
in: "query",
|
|
20957
|
+
required: false,
|
|
20958
|
+
schema: { type: "string", enum: ["compact", "standard", "verbose"], default: "compact" },
|
|
20959
|
+
description: "Response projection. compact is token-efficient for agents; standard returns the full operational shape; verbose preserves full trust metadata and drill-down context."
|
|
20960
|
+
},
|
|
20961
|
+
{
|
|
20962
|
+
name: "include",
|
|
20963
|
+
in: "query",
|
|
20964
|
+
required: false,
|
|
20965
|
+
schema: { type: "string" },
|
|
20966
|
+
description: "Comma-separated compact-mode expansions such as trust, metadata, series, exposures, position_views, position_exposures, optimizer_candidates, or drilldown. Use trust when an agent or report needs provenance, freshness, source-rights, methodology, revision, and degraded-state metadata."
|
|
20967
|
+
}
|
|
20968
|
+
];
|
|
20969
|
+
var factorResponseParams = (parameters = [], options = {}) => [
|
|
20970
|
+
...parameters,
|
|
20971
|
+
...factorResponseParameters.map((parameter) => {
|
|
20972
|
+
if (parameter.name !== "response_mode" || !options.responseModeDefault)
|
|
20973
|
+
return parameter;
|
|
20974
|
+
return {
|
|
20975
|
+
...parameter,
|
|
20976
|
+
schema: {
|
|
20977
|
+
...parameter.schema,
|
|
20978
|
+
default: options.responseModeDefault
|
|
20979
|
+
}
|
|
20980
|
+
};
|
|
20981
|
+
})
|
|
20982
|
+
];
|
|
18779
20983
|
var openApiDocument = {
|
|
18780
20984
|
openapi: "3.1.0",
|
|
18781
20985
|
info: {
|
|
@@ -18876,7 +21080,84 @@ var openApiDocument = {
|
|
|
18876
21080
|
post: { summary: "Exchange a sponsor token for the first org-scoped API key, billing snapshot, limits, and MCP install metadata" }
|
|
18877
21081
|
},
|
|
18878
21082
|
"/v1/dashboard/overview": {
|
|
18879
|
-
get: {
|
|
21083
|
+
get: {
|
|
21084
|
+
summary: "Return the logged-in dashboard overview with principal, org, enriched billing, usage, and API key context",
|
|
21085
|
+
...jsonResponse("DashboardOverview")
|
|
21086
|
+
}
|
|
21087
|
+
},
|
|
21088
|
+
"/v1/dashboard/settings": {
|
|
21089
|
+
get: {
|
|
21090
|
+
summary: "Return profile, organization, appearance, security, and account-deletion settings for the dashboard",
|
|
21091
|
+
...jsonResponse("DashboardAccountSettings")
|
|
21092
|
+
}
|
|
21093
|
+
},
|
|
21094
|
+
"/v1/dashboard/settings/profile": {
|
|
21095
|
+
patch: {
|
|
21096
|
+
summary: "Update local dashboard profile preferences for the current WorkOS user",
|
|
21097
|
+
...jsonRequestBody("AccountUpdateDashboardProfileBody"),
|
|
21098
|
+
...jsonResponse("DashboardAccountSettings")
|
|
21099
|
+
}
|
|
21100
|
+
},
|
|
21101
|
+
"/v1/dashboard/settings/organization": {
|
|
21102
|
+
patch: {
|
|
21103
|
+
summary: "Update locally owned organization profile settings",
|
|
21104
|
+
...jsonRequestBody("AccountUpdateDashboardOrganizationBody"),
|
|
21105
|
+
...jsonResponse("DashboardAccountSettings")
|
|
21106
|
+
}
|
|
21107
|
+
},
|
|
21108
|
+
"/v1/dashboard/settings/appearance": {
|
|
21109
|
+
put: {
|
|
21110
|
+
summary: "Update dashboard appearance preferences for the current organization",
|
|
21111
|
+
...jsonRequestBody("AccountUpdateDashboardAppearanceBody"),
|
|
21112
|
+
...jsonResponse("DashboardAccountSettings")
|
|
21113
|
+
}
|
|
21114
|
+
},
|
|
21115
|
+
"/v1/dashboard/settings/account-deletion-request": {
|
|
21116
|
+
post: {
|
|
21117
|
+
summary: "Record an account-deletion request for the current organization without deleting data inline",
|
|
21118
|
+
...jsonRequestBody("AccountRequestDeletionBody"),
|
|
21119
|
+
...jsonStatusResponse("202", "DashboardAccountSettings", "Account-deletion request recorded")
|
|
21120
|
+
}
|
|
21121
|
+
},
|
|
21122
|
+
"/v1/dashboard/usage/series": {
|
|
21123
|
+
get: {
|
|
21124
|
+
summary: "Return dashboard usage counts over time for the current organization",
|
|
21125
|
+
...jsonResponse("DashboardUsageSeries")
|
|
21126
|
+
}
|
|
21127
|
+
},
|
|
21128
|
+
"/v1/dashboard/usage/endpoints": {
|
|
21129
|
+
get: {
|
|
21130
|
+
summary: "Return dashboard endpoint-level usage breakdown for the current organization",
|
|
21131
|
+
...jsonResponse("DashboardEndpointBreakdown")
|
|
21132
|
+
}
|
|
21133
|
+
},
|
|
21134
|
+
"/v1/dashboard/usage/requests": {
|
|
21135
|
+
get: {
|
|
21136
|
+
summary: "Return recent dashboard request log rows for the current organization",
|
|
21137
|
+
...jsonResponse("DashboardUsageRequestLog")
|
|
21138
|
+
}
|
|
21139
|
+
},
|
|
21140
|
+
"/v1/dashboard/usage/export": {
|
|
21141
|
+
get: {
|
|
21142
|
+
summary: "Export dashboard usage request log rows as JSON or CSV",
|
|
21143
|
+
responses: {
|
|
21144
|
+
"200": {
|
|
21145
|
+
description: "Dashboard usage export as JSON or CSV",
|
|
21146
|
+
content: {
|
|
21147
|
+
...jsonContent("DashboardUsageExport"),
|
|
21148
|
+
"text/csv": {
|
|
21149
|
+
schema: { type: "string" }
|
|
21150
|
+
}
|
|
21151
|
+
}
|
|
21152
|
+
}
|
|
21153
|
+
}
|
|
21154
|
+
}
|
|
21155
|
+
},
|
|
21156
|
+
"/v1/dashboard/activity": {
|
|
21157
|
+
get: {
|
|
21158
|
+
summary: "Return dashboard activity totals and recent request rows for the current organization",
|
|
21159
|
+
...jsonResponse("DashboardUsageActivity")
|
|
21160
|
+
}
|
|
18880
21161
|
},
|
|
18881
21162
|
"/v1/events": {
|
|
18882
21163
|
get: { summary: "List canonical event, webhook delivery, and stream records for the current organization" }
|
|
@@ -19171,104 +21452,422 @@ var openApiDocument = {
|
|
|
19171
21452
|
}
|
|
19172
21453
|
},
|
|
19173
21454
|
"/v1/factors/catalog": {
|
|
19174
|
-
get: {
|
|
21455
|
+
get: {
|
|
21456
|
+
summary: "Return the SEC API factor catalog with methodology, proxy, and orthogonalization metadata",
|
|
21457
|
+
parameters: factorResponseParams(),
|
|
21458
|
+
...jsonResponseWithExample("FactorCatalog")
|
|
21459
|
+
}
|
|
19175
21460
|
},
|
|
19176
21461
|
"/v1/factors/returns": {
|
|
19177
|
-
get: {
|
|
21462
|
+
get: {
|
|
21463
|
+
summary: "Return factor return history, z-scores, and volatility-scaled series for supported factor families",
|
|
21464
|
+
parameters: factorResponseParams(),
|
|
21465
|
+
...jsonFactorResponse("FactorReturnList")
|
|
21466
|
+
}
|
|
21467
|
+
},
|
|
21468
|
+
"/v1/factors/history/{factorKey}": {
|
|
21469
|
+
get: {
|
|
21470
|
+
summary: "Return a single factor's daily return history with 1D through MAX summary windows for chart and table workflows",
|
|
21471
|
+
parameters: factorResponseParams([
|
|
21472
|
+
{
|
|
21473
|
+
name: "factorKey",
|
|
21474
|
+
in: "path",
|
|
21475
|
+
required: true,
|
|
21476
|
+
schema: { type: "string" },
|
|
21477
|
+
description: "Canonical factor key or supported public alias such as VALUE_V2. Explicit keys do not broaden to other factors."
|
|
21478
|
+
},
|
|
21479
|
+
{
|
|
21480
|
+
name: "range",
|
|
21481
|
+
in: "query",
|
|
21482
|
+
required: false,
|
|
21483
|
+
schema: { type: "string", enum: ["1d", "5d", "10d", "1m", "3m", "6m", "1y", "max"], default: "1y" },
|
|
21484
|
+
description: "Trailing observation window for the returned chart series. Defaults to 1y for token-efficient agent and dashboard workflows. MAX requests the public launch-history floor, 2015-01-01, through the latest complete market date when row-level coverage exists for the factor."
|
|
21485
|
+
},
|
|
21486
|
+
{
|
|
21487
|
+
name: "date_from",
|
|
21488
|
+
in: "query",
|
|
21489
|
+
required: false,
|
|
21490
|
+
schema: { type: "string", format: "date", minimum: "2015-01-01" },
|
|
21491
|
+
description: "Optional inclusive ISO start date. Must be on or after 2015-01-01. When supplied, it overrides range for the returned series bounds."
|
|
21492
|
+
},
|
|
21493
|
+
{
|
|
21494
|
+
name: "date_to",
|
|
21495
|
+
in: "query",
|
|
21496
|
+
required: false,
|
|
21497
|
+
schema: { type: "string", format: "date", minimum: "2015-01-01" },
|
|
21498
|
+
description: "Optional inclusive ISO end date. Must be on or after 2015-01-01 and on or before the latest complete XNYS market date."
|
|
21499
|
+
},
|
|
21500
|
+
{ name: "format", in: "query", schema: { type: "string", enum: ["json", "csv"], default: "json" }, description: "Return JSON by default or a table-ready CSV export with one row per factor/date." }
|
|
21501
|
+
]),
|
|
21502
|
+
...jsonFactorResponseWithCsv("FactorHistory")
|
|
21503
|
+
}
|
|
21504
|
+
},
|
|
21505
|
+
"/v1/factors/sparklines": {
|
|
21506
|
+
get: {
|
|
21507
|
+
summary: "Return compact multi-factor sparkline series with 1D through MAX summary windows for dashboard, sector, index, and model UIs",
|
|
21508
|
+
parameters: factorResponseParams([
|
|
21509
|
+
{
|
|
21510
|
+
name: "factors",
|
|
21511
|
+
in: "query",
|
|
21512
|
+
required: false,
|
|
21513
|
+
schema: { type: "string" },
|
|
21514
|
+
description: "Comma-separated canonical factor keys or supported public aliases. Alias normalization is explicit and does not broaden the selection."
|
|
21515
|
+
},
|
|
21516
|
+
{
|
|
21517
|
+
name: "keys",
|
|
21518
|
+
in: "query",
|
|
21519
|
+
required: false,
|
|
21520
|
+
schema: { type: "string" },
|
|
21521
|
+
description: "Alias for factors."
|
|
21522
|
+
},
|
|
21523
|
+
{
|
|
21524
|
+
name: "category",
|
|
21525
|
+
in: "query",
|
|
21526
|
+
required: false,
|
|
21527
|
+
schema: { type: "string" },
|
|
21528
|
+
description: "Optional launch factor category filter such as style, sector, or industry."
|
|
21529
|
+
},
|
|
21530
|
+
{
|
|
21531
|
+
name: "range",
|
|
21532
|
+
in: "query",
|
|
21533
|
+
required: false,
|
|
21534
|
+
schema: { type: "string", enum: ["1d", "5d", "10d", "1m", "3m", "6m", "1y", "max"], default: "1y" },
|
|
21535
|
+
description: "Trailing observation window for the returned sparkline points. Defaults to 1y for token-efficient dashboard and agent workflows. MAX requests the public launch-history floor, 2015-01-01, through the latest complete market date when row-level coverage exists for each factor."
|
|
21536
|
+
},
|
|
21537
|
+
{
|
|
21538
|
+
name: "metric",
|
|
21539
|
+
in: "query",
|
|
21540
|
+
required: false,
|
|
21541
|
+
schema: { type: "string", enum: ["scaled_return", "pure_return", "raw_return", "z_score"], default: "scaled_return" },
|
|
21542
|
+
description: "Metric used for sparkline point values. Return metrics are cumulative over the selected range; z_score returns point-in-time z-scores."
|
|
21543
|
+
},
|
|
21544
|
+
{
|
|
21545
|
+
name: "points",
|
|
21546
|
+
in: "query",
|
|
21547
|
+
required: false,
|
|
21548
|
+
schema: { type: "integer", minimum: 2, maximum: 500, default: 120 },
|
|
21549
|
+
description: "Maximum chart points per factor. The first and last observations are preserved when downsampling."
|
|
21550
|
+
},
|
|
21551
|
+
{
|
|
21552
|
+
name: "date_from",
|
|
21553
|
+
in: "query",
|
|
21554
|
+
required: false,
|
|
21555
|
+
schema: { type: "string", format: "date", minimum: "2015-01-01" },
|
|
21556
|
+
description: "Optional inclusive ISO start date. Must be on or after 2015-01-01 and overrides range for returned sparkline bounds."
|
|
21557
|
+
},
|
|
21558
|
+
{
|
|
21559
|
+
name: "date_to",
|
|
21560
|
+
in: "query",
|
|
21561
|
+
required: false,
|
|
21562
|
+
schema: { type: "string", format: "date", minimum: "2015-01-01" },
|
|
21563
|
+
description: "Optional inclusive ISO end date. Must be on or after 2015-01-01 and on or before the latest complete XNYS market date."
|
|
21564
|
+
},
|
|
21565
|
+
{ name: "format", in: "query", schema: { type: "string", enum: ["json", "csv"], default: "json" }, description: "Return JSON by default or a table-ready CSV export with one row per factor/date sparkline point." }
|
|
21566
|
+
]),
|
|
21567
|
+
...jsonFactorResponseWithCsv("FactorSparklineList")
|
|
21568
|
+
}
|
|
19178
21569
|
},
|
|
19179
21570
|
"/v1/factors/returns/intraday": {
|
|
19180
21571
|
get: {
|
|
19181
|
-
summary: "Return intraday factor snapshots for
|
|
19182
|
-
|
|
21572
|
+
summary: "Return intraday factor snapshots for dashboards using the current benchmark proxy surface and freshness metadata",
|
|
21573
|
+
parameters: factorResponseParams(),
|
|
21574
|
+
...jsonFactorResponse("FactorIntradaySnapshotList")
|
|
19183
21575
|
}
|
|
19184
21576
|
},
|
|
19185
21577
|
"/v1/factors/dashboard": {
|
|
19186
21578
|
get: {
|
|
19187
|
-
summary: "Return a one-call
|
|
19188
|
-
|
|
21579
|
+
summary: "Return a one-call factor dashboard with intraday, regime, rotation, spotlight-security, and optional model-portfolio drill-down sections",
|
|
21580
|
+
parameters: factorResponseParams(),
|
|
21581
|
+
...jsonFactorResponse("FactorDashboard")
|
|
19189
21582
|
}
|
|
19190
21583
|
},
|
|
19191
21584
|
"/v1/factors/regime-performance": {
|
|
19192
21585
|
get: {
|
|
19193
21586
|
summary: "Return regime-conditioned factor rankings that blend the active macro backdrop with current factor state",
|
|
19194
|
-
|
|
21587
|
+
parameters: factorResponseParams(),
|
|
21588
|
+
...jsonFactorResponse("FactorRegimePerformanceList")
|
|
19195
21589
|
}
|
|
19196
21590
|
},
|
|
19197
21591
|
"/v1/factors/exposures": {
|
|
19198
|
-
get: {
|
|
21592
|
+
get: {
|
|
21593
|
+
summary: "Return security, portfolio, or watchlist factor exposures with model metadata and provenance",
|
|
21594
|
+
parameters: factorResponseParams([
|
|
21595
|
+
{ name: "symbols", in: "query", required: true, schema: { type: "string" }, description: "Comma-separated symbols to load exposures for. `tickers` is accepted as an alias." },
|
|
21596
|
+
{ name: "factors", in: "query", schema: { type: "string" }, description: "Comma-separated factor keys or aliases." },
|
|
21597
|
+
{ name: "keys", in: "query", schema: { type: "string" }, description: "Alias for factors." },
|
|
21598
|
+
{ name: "category", in: "query", schema: { type: "string" }, description: "Optional launch factor category filter." },
|
|
21599
|
+
{ name: "lookback", in: "query", schema: { type: "string", default: "6m" }, description: "Exposure lookback window." },
|
|
21600
|
+
{ name: "model", in: "query", schema: { type: "string" }, description: "Optional factor exposure model selector." }
|
|
21601
|
+
]),
|
|
21602
|
+
...jsonFactorResponse("FactorExposureList")
|
|
21603
|
+
}
|
|
19199
21604
|
},
|
|
19200
21605
|
"/v1/stocks/{ticker}/loadings": {
|
|
19201
21606
|
get: {
|
|
19202
21607
|
summary: "Return stock-level factor loadings for a single ticker using the latest stored exposure model",
|
|
19203
|
-
|
|
21608
|
+
parameters: factorResponseParams([
|
|
21609
|
+
{ name: "ticker", in: "path", required: true, schema: { type: "string" }, description: "Ticker symbol." }
|
|
21610
|
+
]),
|
|
21611
|
+
...jsonFactorResponse("FactorExposureList")
|
|
19204
21612
|
}
|
|
19205
21613
|
},
|
|
19206
21614
|
"/v1/factors/correlations": {
|
|
19207
|
-
get: {
|
|
21615
|
+
get: {
|
|
21616
|
+
summary: "Return factor-to-factor and factor-to-security correlation surfaces for strategy and risk workflows",
|
|
21617
|
+
parameters: factorResponseParams(),
|
|
21618
|
+
...jsonFactorResponse("FactorCorrelationList")
|
|
21619
|
+
}
|
|
19208
21620
|
},
|
|
19209
21621
|
"/v1/factors/screen": {
|
|
19210
|
-
get: {
|
|
21622
|
+
get: {
|
|
21623
|
+
summary: "Return factor screens ranked by recent strength so agents can run factor-rotation and cross-factor ranking workflows",
|
|
21624
|
+
parameters: factorResponseParams(),
|
|
21625
|
+
...jsonFactorResponse("FactorReturnList")
|
|
21626
|
+
}
|
|
21627
|
+
},
|
|
21628
|
+
"/v1/factors/extreme-moves": {
|
|
21629
|
+
get: {
|
|
21630
|
+
summary: "Return factor moves ranked by unusual z-score or absolute return with direction, threshold, and trust metadata",
|
|
21631
|
+
parameters: factorResponseParams([
|
|
21632
|
+
{ name: "factors", in: "query", schema: { type: "string" }, description: "Comma-separated canonical factor keys or supported public aliases." },
|
|
21633
|
+
{ name: "keys", in: "query", schema: { type: "string" }, description: "Alias for factors." },
|
|
21634
|
+
{ name: "category", in: "query", schema: { type: "string" }, description: "Optional launch factor category filter such as style, sector, or industry." },
|
|
21635
|
+
{ name: "window", in: "query", schema: { type: "string", enum: ["1d", "5d", "10d", "1m", "3m", "6m", "1y"], default: "1m" }, description: "Return window used to score the move." },
|
|
21636
|
+
{ name: "lookback", in: "query", schema: { type: "string", default: "6m" }, description: "History lookback used to compute z-scores. Automatically widens when shorter than window." },
|
|
21637
|
+
{ name: "side", in: "query", schema: { type: "string", enum: ["both", "up", "down", "flat"], default: "both" }, description: "Filter by move direction." },
|
|
21638
|
+
{ name: "direction", in: "query", schema: { type: "string", enum: ["both", "up", "down", "flat"] }, description: "Alias for side, useful for dashboard filters that label move direction directly." },
|
|
21639
|
+
{ name: "sort", in: "query", schema: { type: "string", enum: ["abs_z_score", "abs_scaled_return"], default: "abs_z_score" }, description: "Ranking metric for unusual moves." },
|
|
21640
|
+
{ name: "min_z_score", in: "query", schema: { type: "number", minimum: 0, default: 0 }, description: "Optional absolute z-score floor. Defaults to 0 so the endpoint always returns the top ranked moves." },
|
|
21641
|
+
{ name: "limit", in: "query", schema: { type: "integer", minimum: 1, maximum: 100, default: 25 }, description: "Maximum number of ranked factor moves." }
|
|
21642
|
+
]),
|
|
21643
|
+
...jsonFactorResponse("FactorExtremeMoveList")
|
|
21644
|
+
}
|
|
21645
|
+
},
|
|
21646
|
+
"/v1/factors/extreme-pairs": {
|
|
21647
|
+
get: {
|
|
21648
|
+
summary: "Return factor pairs ranked by unusual rolling spread divergence with direction, threshold, and trust metadata",
|
|
21649
|
+
parameters: factorResponseParams([
|
|
21650
|
+
{ name: "factors", in: "query", schema: { type: "string" }, description: "Comma-separated canonical factor keys or supported public aliases used to generate pair combinations." },
|
|
21651
|
+
{ name: "keys", in: "query", schema: { type: "string" }, description: "Alias for factors." },
|
|
21652
|
+
{ name: "category", in: "query", schema: { type: "string" }, description: "Optional launch factor category filter such as style, sector, or industry." },
|
|
21653
|
+
{ name: "window", in: "query", schema: { type: "string", enum: ["1d", "5d", "10d", "21d", "63d", "126d", "252d", "1m", "3m", "6m", "1y"], default: "21d" }, description: "Rolling spread window. Calendar aliases map to trading-day pair windows." },
|
|
21654
|
+
{ name: "lookback", in: "query", schema: { type: "string", default: "6m" }, description: "History lookback used to score rolling spread z-scores. Automatically widens when shorter than window." },
|
|
21655
|
+
{ name: "side", in: "query", schema: { type: "string", enum: ["both", "factor1", "factor2", "flat"], default: "both" }, description: "Filter by which side of the pair outperformed over the latest window." },
|
|
21656
|
+
{ name: "direction", in: "query", schema: { type: "string", enum: ["both", "factor1", "factor2", "flat"] }, description: "Alias for side." },
|
|
21657
|
+
{ name: "sort", in: "query", schema: { type: "string", enum: ["abs_z_score", "abs_spread_return"], default: "abs_z_score" }, description: "Ranking metric for pair divergence." },
|
|
21658
|
+
{ name: "min_z_score", in: "query", schema: { type: "number", minimum: 0, default: 0 }, description: "Optional absolute z-score floor. Defaults to 0 so the endpoint always returns the top ranked pairs." },
|
|
21659
|
+
{ name: "limit", in: "query", schema: { type: "integer", minimum: 1, maximum: 100, default: 25 }, description: "Maximum number of ranked factor pairs." }
|
|
21660
|
+
]),
|
|
21661
|
+
...jsonFactorResponse("FactorExtremePairList")
|
|
21662
|
+
}
|
|
21663
|
+
},
|
|
21664
|
+
"/v1/factors/valuations": {
|
|
21665
|
+
get: {
|
|
21666
|
+
summary: "Return valuation-factor opportunity signals ranked from SecAPI-owned factor return state with trust metadata",
|
|
21667
|
+
parameters: factorResponseParams([
|
|
21668
|
+
{ name: "factors", in: "query", schema: { type: "string" }, description: "Comma-separated valuation factor keys or supported public aliases. Defaults to launch valuation factors." },
|
|
21669
|
+
{ name: "keys", in: "query", schema: { type: "string" }, description: "Alias for factors." },
|
|
21670
|
+
{ name: "category", in: "query", schema: { type: "string" }, description: "Optional category filter. Valuation defaults are style factors." },
|
|
21671
|
+
{ name: "window", in: "query", schema: { type: "string", enum: ["1d", "5d", "10d", "1m", "3m", "6m", "1y"], default: "1m" }, description: "Return window used to score the valuation-factor signal." },
|
|
21672
|
+
{ name: "lookback", in: "query", schema: { type: "string", default: "6m" }, description: "History lookback used to compute factor z-scores. Automatically widens when shorter than window." },
|
|
21673
|
+
{ name: "side", in: "query", schema: { type: "string", enum: ["all", "tailwind", "headwind", "neutral"], default: "all" }, description: "Filter by valuation-factor signal direction." },
|
|
21674
|
+
{ name: "signal", in: "query", schema: { type: "string", enum: ["all", "tailwind", "headwind", "neutral"] }, description: "Alias for side." },
|
|
21675
|
+
{ name: "weighting_mode", in: "query", schema: { type: "string", enum: ["long_short_equal", "long_leg_focus", "short_leg_focus"], default: "long_short_equal" }, description: "Valuation lens used to transform the factor z-score. The default uses the native long-high-metric / short-low-metric factor; short_leg_focus flips the signal lens for the short leg." },
|
|
21676
|
+
{ name: "weighting", in: "query", schema: { type: "string", enum: ["long_short_equal", "long_leg_focus", "short_leg_focus"] }, description: "Alias for weighting_mode." },
|
|
21677
|
+
{ name: "sort", in: "query", schema: { type: "string", enum: ["opportunity_score", "abs_z_score", "factor_key"], default: "opportunity_score" }, description: "Ranking metric for valuation-factor opportunities. With side=headwind, opportunity_score ranks the strongest headwinds first while opportunityScore remains signed." },
|
|
21678
|
+
{ name: "limit", in: "query", schema: { type: "integer", minimum: 1, maximum: 100, default: 25 }, description: "Maximum number of valuation factor rows." },
|
|
21679
|
+
{ name: "format", in: "query", schema: { type: "string", enum: ["json", "csv"], default: "json" }, description: "Return JSON by default or a CSV export for spreadsheet workflows." }
|
|
21680
|
+
]),
|
|
21681
|
+
...jsonFactorResponseWithCsv("FactorValuationList")
|
|
21682
|
+
}
|
|
21683
|
+
},
|
|
21684
|
+
"/v1/factors/valuations/stocks": {
|
|
21685
|
+
get: {
|
|
21686
|
+
summary: "Return stock candidates exposed to a valuation-factor signal using latest materialized factor exposures",
|
|
21687
|
+
parameters: factorResponseParams([
|
|
21688
|
+
{ name: "factor", in: "query", schema: { type: "string" }, description: "Valuation factor key or alias to drill into. If omitted, the top valuation factor is selected." },
|
|
21689
|
+
{ name: "factorKey", in: "query", schema: { type: "string" }, description: "Alias for factor." },
|
|
21690
|
+
{ name: "key", in: "query", schema: { type: "string" }, description: "Alias for factor." },
|
|
21691
|
+
{ name: "factors", in: "query", schema: { type: "string" }, description: "Comma-separated valuation factor keys used when factor is omitted; the top valuation row is selected." },
|
|
21692
|
+
{ name: "keys", in: "query", schema: { type: "string" }, description: "Alias for factors." },
|
|
21693
|
+
{ name: "category", in: "query", schema: { type: "string" }, description: "Optional valuation factor category filter." },
|
|
21694
|
+
{ name: "window", in: "query", schema: { type: "string", enum: ["1d", "5d", "10d", "1m", "3m", "6m", "1y"], default: "1m" }, description: "Return window used for the factor valuation signal." },
|
|
21695
|
+
{ name: "lookback", in: "query", schema: { type: "string", default: "6m" }, description: "Exposure lookback and valuation z-score lookback." },
|
|
21696
|
+
{ name: "signal", in: "query", schema: { type: "string", enum: ["all", "tailwind", "headwind", "neutral"] }, description: "Optional factor-level valuation signal filter when selecting the top factor." },
|
|
21697
|
+
{ name: "stance", in: "query", schema: { type: "string", enum: ["beneficiaries", "at_risk", "both"] }, description: "Stock view: beneficiaries of the factor signal, stocks at risk from it, or both. When omitted, SEC API chooses beneficiaries for tailwind/neutral factors and at_risk for headwind factors." },
|
|
21698
|
+
{ name: "side", in: "query", schema: { type: "string" }, description: "Alias for stance; also accepts long, short, all." },
|
|
21699
|
+
{ name: "direction", in: "query", schema: { type: "string" }, description: "Alias for stance." },
|
|
21700
|
+
{ name: "weighting_mode", in: "query", schema: { type: "string", enum: ["long_short_equal", "long_leg_focus", "short_leg_focus"], default: "long_short_equal" }, description: "Valuation lens used before ranking exposed stocks. Must match the factor-valuation workflow for consistent drilldowns." },
|
|
21701
|
+
{ name: "weighting", in: "query", schema: { type: "string", enum: ["long_short_equal", "long_leg_focus", "short_leg_focus"] }, description: "Alias for weighting_mode." },
|
|
21702
|
+
{ name: "sort", in: "query", schema: { type: "string", enum: ["score", "abs_beta", "symbol"], default: "score" }, description: "Ranking metric for stock candidates." },
|
|
21703
|
+
{ name: "limit", in: "query", schema: { type: "integer", minimum: 1, maximum: 100, default: 25 }, description: "Maximum number of stock candidates." },
|
|
21704
|
+
{ name: "format", in: "query", schema: { type: "string", enum: ["json", "csv"], default: "json" }, description: "Return JSON by default or a CSV export for spreadsheet workflows." }
|
|
21705
|
+
]),
|
|
21706
|
+
...jsonFactorResponseWithCsv("FactorValuationStockList")
|
|
21707
|
+
}
|
|
19211
21708
|
},
|
|
19212
21709
|
"/v1/factors/decomposition": {
|
|
19213
|
-
get: {
|
|
21710
|
+
get: {
|
|
21711
|
+
summary: "Return factor-attribution decomposition for a security over a bounded lookback window with explained return, alpha, and methodology metadata",
|
|
21712
|
+
parameters: factorResponseParams([
|
|
21713
|
+
{ name: "symbol", in: "query", required: true, schema: { type: "string" }, description: "Ticker symbol to decompose. `ticker` is accepted as an alias." },
|
|
21714
|
+
{ name: "factors", in: "query", schema: { type: "string" }, description: "Comma-separated factor keys or aliases." },
|
|
21715
|
+
{ name: "keys", in: "query", schema: { type: "string" }, description: "Alias for factors." },
|
|
21716
|
+
{ name: "category", in: "query", schema: { type: "string" }, description: "Optional launch factor category filter." },
|
|
21717
|
+
{ name: "window", in: "query", schema: { type: "string", default: "1m" }, description: "Return window used for decomposition." },
|
|
21718
|
+
{ name: "lookback", in: "query", schema: { type: "string", default: "6m" }, description: "History lookback used for exposures and factor returns." }
|
|
21719
|
+
]),
|
|
21720
|
+
...jsonFactorResponse("FactorDecomposition")
|
|
21721
|
+
}
|
|
19214
21722
|
},
|
|
19215
21723
|
"/v1/factors/related-stocks": {
|
|
19216
|
-
get: {
|
|
21724
|
+
get: {
|
|
21725
|
+
summary: "Return related stocks ranked by factor-overlap similarity for peer discovery and hedge ideation",
|
|
21726
|
+
parameters: factorResponseParams([
|
|
21727
|
+
{ name: "symbol", in: "query", required: true, schema: { type: "string" }, description: "Ticker symbol to find related stocks for. `ticker` is accepted as an alias." },
|
|
21728
|
+
{ name: "candidates", in: "query", schema: { type: "string" }, description: "Optional comma-separated candidate universe." },
|
|
21729
|
+
{ name: "factors", in: "query", schema: { type: "string" }, description: "Comma-separated factor keys or aliases." },
|
|
21730
|
+
{ name: "keys", in: "query", schema: { type: "string" }, description: "Alias for factors." },
|
|
21731
|
+
{ name: "category", in: "query", schema: { type: "string" }, description: "Optional launch factor category filter." },
|
|
21732
|
+
{ name: "lookback", in: "query", schema: { type: "string", default: "6m" }, description: "Exposure lookback window." },
|
|
21733
|
+
{ name: "limit", in: "query", schema: { type: "integer", minimum: 1, maximum: 25, default: 5 }, description: "Maximum related securities to return." }
|
|
21734
|
+
]),
|
|
21735
|
+
...jsonFactorResponse("RelatedSecurityList")
|
|
21736
|
+
}
|
|
19217
21737
|
},
|
|
19218
21738
|
"/v1/factors/similarity-pack": {
|
|
19219
21739
|
get: {
|
|
19220
21740
|
summary: "Return a custom thematic similarity pack that combines factor-overlap peers with deterministic filing/news signatures and naming workflow metadata",
|
|
19221
|
-
|
|
21741
|
+
parameters: factorResponseParams([
|
|
21742
|
+
{ name: "symbol", in: "query", required: true, schema: { type: "string" }, description: "Anchor ticker symbol. `ticker` is accepted as an alias; `symbols` can also provide the anchor as its first item." },
|
|
21743
|
+
{ name: "symbols", in: "query", schema: { type: "string" }, description: "Comma-separated anchor and optional candidate symbols. The first symbol is used as the anchor when symbol is omitted." },
|
|
21744
|
+
{ name: "candidates", in: "query", schema: { type: "string" }, description: "Optional comma-separated candidate universe." },
|
|
21745
|
+
{ name: "lookback", in: "query", schema: { type: "string", default: "6m" }, description: "Exposure and context lookback window." },
|
|
21746
|
+
{ name: "limit", in: "query", schema: { type: "integer", minimum: 1, maximum: 25, default: 5 }, description: "Maximum peers to return." }
|
|
21747
|
+
]),
|
|
21748
|
+
...jsonFactorResponse("FactorSimilarityPack")
|
|
19222
21749
|
}
|
|
19223
21750
|
},
|
|
19224
21751
|
"/v1/factors/pairs": {
|
|
19225
|
-
get: {
|
|
21752
|
+
get: {
|
|
21753
|
+
summary: "Return pairwise factor spread data including cumulative spread, average, volatility, and daily series for two specified factors",
|
|
21754
|
+
parameters: factorResponseParams([
|
|
21755
|
+
{ name: "factor1", in: "query", required: true, schema: { type: "string" }, description: "First factor key. The shorter f1 alias is also accepted at runtime." },
|
|
21756
|
+
{ name: "factor2", in: "query", required: true, schema: { type: "string" }, description: "Second factor key. The shorter f2 alias is also accepted at runtime." },
|
|
21757
|
+
{ name: "f1", in: "query", schema: { type: "string" }, description: "Runtime alias for factor1." },
|
|
21758
|
+
{ name: "f2", in: "query", schema: { type: "string" }, description: "Runtime alias for factor2." },
|
|
21759
|
+
{ name: "window", in: "query", schema: { type: "string", default: "1m" }, description: "Rolling spread window." },
|
|
21760
|
+
{ name: "lookback", in: "query", schema: { type: "string", default: "6m" }, description: "History lookback used to compute the spread." }
|
|
21761
|
+
]),
|
|
21762
|
+
...jsonFactorResponse("FactorPairSpreadList")
|
|
21763
|
+
}
|
|
19226
21764
|
},
|
|
19227
21765
|
"/v1/factors/pair-history/{f1}/{f2}": {
|
|
19228
|
-
get: {
|
|
21766
|
+
get: {
|
|
21767
|
+
summary: "Return historical spread between two specific factors identified by path parameters with windowed series data",
|
|
21768
|
+
parameters: factorResponseParams([
|
|
21769
|
+
{ name: "f1", in: "path", required: true, schema: { type: "string" }, description: "First factor key." },
|
|
21770
|
+
{ name: "f2", in: "path", required: true, schema: { type: "string" }, description: "Second factor key." },
|
|
21771
|
+
{ name: "window", in: "query", schema: { type: "string", default: "1m" }, description: "Rolling spread window." },
|
|
21772
|
+
{ name: "lookback", in: "query", schema: { type: "string", default: "6m" }, description: "History lookback used to compute the spread." }
|
|
21773
|
+
]),
|
|
21774
|
+
...jsonFactorResponse("FactorPairSpreadList")
|
|
21775
|
+
}
|
|
19229
21776
|
},
|
|
19230
21777
|
"/v1/factors/bulk-download": {
|
|
19231
|
-
get: {
|
|
21778
|
+
get: {
|
|
21779
|
+
summary: "Return available factor returns data in bulk with daily series for commercial plan bulk-download workflows",
|
|
21780
|
+
parameters: factorResponseParams([
|
|
21781
|
+
{ name: "factors", in: "query", schema: { type: "string" }, description: "Required unless category is provided. Comma-separated factor keys or aliases." },
|
|
21782
|
+
{ name: "keys", in: "query", schema: { type: "string" }, description: "Alias for factors. Required unless category is provided." },
|
|
21783
|
+
{ name: "category", in: "query", schema: { type: "string" }, description: "Required unless factors or keys is provided. Optional launch factor category filter." },
|
|
21784
|
+
{ name: "window", in: "query", schema: { type: "string", default: "1m" }, description: "Return window for summary fields." },
|
|
21785
|
+
{ name: "lookback", in: "query", schema: { type: "string", default: "12m" }, description: "History lookback for returned series." },
|
|
21786
|
+
{ name: "format", in: "query", schema: { type: "string", enum: ["json", "csv"], default: "json" }, description: "Return JSON by default or a long-table CSV export with one row per factor/date." }
|
|
21787
|
+
], { responseModeDefault: "standard" }),
|
|
21788
|
+
...jsonFactorResponseWithCsv("FactorBulkReturnList")
|
|
21789
|
+
}
|
|
19232
21790
|
},
|
|
19233
21791
|
"/v1/factors/custom": {
|
|
19234
21792
|
post: {
|
|
19235
21793
|
summary: "Discover a custom thematic factor pack from factor-overlap peers plus deterministic filing/news signatures",
|
|
21794
|
+
parameters: factorResponseParams(),
|
|
19236
21795
|
...jsonRequestBody("FactorCustomDiscoveryRequest"),
|
|
19237
|
-
...
|
|
21796
|
+
...jsonFactorResponse("FactorSimilarityPack")
|
|
19238
21797
|
}
|
|
19239
21798
|
},
|
|
19240
21799
|
"/v1/portfolio/analyze": {
|
|
19241
21800
|
post: {
|
|
19242
21801
|
summary: "Return factor exposures, attribution, and hedge suggestions for a portfolio in one deterministic response",
|
|
21802
|
+
parameters: factorResponseParams(),
|
|
19243
21803
|
...jsonRequestBody("PortfolioIntelligenceRequest"),
|
|
19244
|
-
...
|
|
21804
|
+
...jsonFactorResponse("PortfolioAnalysis")
|
|
21805
|
+
}
|
|
21806
|
+
},
|
|
21807
|
+
"/v1/portfolio/attribution": {
|
|
21808
|
+
post: {
|
|
21809
|
+
summary: "Return factor return attribution for a portfolio with explained return, alpha, and compact contribution rows",
|
|
21810
|
+
parameters: factorResponseParams(),
|
|
21811
|
+
...jsonRequestBody("PortfolioAttributionRequest"),
|
|
21812
|
+
...jsonFactorResponse("PortfolioAttribution")
|
|
19245
21813
|
}
|
|
19246
21814
|
},
|
|
19247
21815
|
"/v1/model-portfolios/{portfolioId}/factor-view": {
|
|
19248
21816
|
get: {
|
|
19249
21817
|
summary: "Return a model-portfolio factor view with aggregate analysis and per-position exposures for drill-down workflows",
|
|
19250
|
-
|
|
21818
|
+
parameters: factorResponseParams([
|
|
21819
|
+
{ name: "portfolioId", in: "path", required: true, schema: { type: "string" }, description: "Saved model portfolio identifier." }
|
|
21820
|
+
]),
|
|
21821
|
+
...jsonFactorResponse("ModelPortfolioFactorView")
|
|
21822
|
+
}
|
|
21823
|
+
},
|
|
21824
|
+
"/v1/models/factor-analysis": {
|
|
21825
|
+
post: {
|
|
21826
|
+
summary: "Return model factor analysis for submitted Model Builder or saved-model holdings with optional attribution, hedge, and optimizer sections",
|
|
21827
|
+
parameters: factorResponseParams(),
|
|
21828
|
+
...jsonRequestBody("ModelFactorAnalysisRequest"),
|
|
21829
|
+
...jsonFactorResponse("ModelFactorAnalysis")
|
|
19251
21830
|
}
|
|
19252
21831
|
},
|
|
19253
21832
|
"/v1/portfolio/stress-test": {
|
|
19254
21833
|
post: {
|
|
19255
21834
|
summary: "Run portfolio stress scenarios across factor and macro shock definitions with compact traceable outputs",
|
|
21835
|
+
parameters: factorResponseParams(),
|
|
19256
21836
|
...jsonRequestBody("PortfolioStressTestRequest"),
|
|
19257
|
-
...
|
|
21837
|
+
...jsonFactorResponse("PortfolioStressTest")
|
|
21838
|
+
}
|
|
21839
|
+
},
|
|
21840
|
+
"/v1/portfolio/hedge": {
|
|
21841
|
+
post: {
|
|
21842
|
+
summary: "Return bounded benchmark-instrument factor hedge candidates for a portfolio with compact residual exposure and trust metadata",
|
|
21843
|
+
parameters: factorResponseParams(),
|
|
21844
|
+
...jsonRequestBody("PortfolioHedgeRequest"),
|
|
21845
|
+
...jsonFactorResponse("PortfolioHedge")
|
|
19258
21846
|
}
|
|
19259
21847
|
},
|
|
19260
21848
|
"/v1/portfolio/optimize": {
|
|
19261
21849
|
post: {
|
|
19262
|
-
summary: "Return
|
|
19263
|
-
|
|
19264
|
-
...
|
|
21850
|
+
summary: "Return bounded factor-aware optimizer scenario candidates for factor-neutral, min-drawdown, or regime-aware objectives",
|
|
21851
|
+
parameters: factorResponseParams(),
|
|
21852
|
+
...jsonRequestBody("PortfolioOptimizeRequest"),
|
|
21853
|
+
...jsonFactorResponse("PortfolioAnalysis")
|
|
19265
21854
|
}
|
|
19266
21855
|
},
|
|
19267
21856
|
"/v1/strategies/factor-rotation": {
|
|
19268
|
-
post: {
|
|
21857
|
+
post: {
|
|
21858
|
+
summary: "Return factor-rotation recommendations informed by macro regime context and factor state",
|
|
21859
|
+
parameters: factorResponseParams(),
|
|
21860
|
+
...jsonRequestBody("FactorStrategyRequest"),
|
|
21861
|
+
...jsonFactorResponse("FactorRotationStrategy")
|
|
21862
|
+
}
|
|
19269
21863
|
},
|
|
19270
21864
|
"/v1/strategies/regime-screen": {
|
|
19271
|
-
post: {
|
|
21865
|
+
post: {
|
|
21866
|
+
summary: "Return regime-aware security screens with factor, macro, and filing-aware filters",
|
|
21867
|
+
parameters: factorResponseParams(),
|
|
21868
|
+
...jsonRequestBody("FactorStrategyRequest"),
|
|
21869
|
+
...jsonFactorResponse("FactorRegimeScreen")
|
|
21870
|
+
}
|
|
19272
21871
|
},
|
|
19273
21872
|
"/v1/intelligence/query": {
|
|
19274
21873
|
post: {
|
|
@@ -19323,7 +21922,7 @@ var openApiDocument = {
|
|
|
19323
21922
|
post: {
|
|
19324
21923
|
summary: "Return a one-call portfolio intelligence bundle with exposures, stress scenarios, events, and hedge ideas",
|
|
19325
21924
|
...jsonRequestBody("PortfolioIntelligenceRequest"),
|
|
19326
|
-
...
|
|
21925
|
+
...jsonFactorResponse("PortfolioAnalysis")
|
|
19327
21926
|
}
|
|
19328
21927
|
},
|
|
19329
21928
|
"/v1/intelligence/watchlist": {
|
|
@@ -19377,30 +21976,116 @@ var openApiDocument = {
|
|
|
19377
21976
|
get: { summary: "Return normalized SEC company facts for an issuer, concept, and optional form or unit" }
|
|
19378
21977
|
},
|
|
19379
21978
|
"/v1/statements": {
|
|
19380
|
-
get: {
|
|
21979
|
+
get: {
|
|
21980
|
+
summary: "Return a normalized statement backed by SEC company facts",
|
|
21981
|
+
parameters: [
|
|
21982
|
+
{ name: "ticker", in: "query", required: false, schema: { type: "string" }, description: "Issuer ticker. Either ticker or cik is required." },
|
|
21983
|
+
{ name: "cik", in: "query", required: false, schema: { type: "string" }, description: "Issuer CIK. Either ticker or cik is required." },
|
|
21984
|
+
{ name: "statement", in: "query", required: false, schema: { type: "string" }, description: "Statement key such as income_statement, balance_sheet, or cash_flow_statement." },
|
|
21985
|
+
{ name: "period", in: "query", required: false, schema: { type: "string", enum: ["annual", "quarterly"] } },
|
|
21986
|
+
{ name: "limit", in: "query", required: false, schema: { type: "integer", minimum: 1, maximum: 40 } },
|
|
21987
|
+
{ name: "view", in: "query", required: false, schema: { type: "string", enum: ["default", "compact", "agent"] }, description: "Use compact for period-indexed row arrays. Default and agent preserve statement value provenance." }
|
|
21988
|
+
],
|
|
21989
|
+
responses: {
|
|
21990
|
+
"200": {
|
|
21991
|
+
description: "Successful response. view=compact returns CompactStatement; view=agent returns StatementAgentRecord; default returns Statement.",
|
|
21992
|
+
content: {
|
|
21993
|
+
"application/json": {
|
|
21994
|
+
schema: {
|
|
21995
|
+
oneOf: [schemaRef("Statement"), schemaRef("CompactStatement"), schemaRef("StatementAgentRecord")]
|
|
21996
|
+
}
|
|
21997
|
+
}
|
|
21998
|
+
}
|
|
21999
|
+
}
|
|
22000
|
+
}
|
|
22001
|
+
}
|
|
19381
22002
|
},
|
|
19382
22003
|
"/v1/statements/all": {
|
|
19383
|
-
get: {
|
|
22004
|
+
get: {
|
|
22005
|
+
summary: "Return the balance sheet, income statement, and cash flow statement as one normalized bundle",
|
|
22006
|
+
parameters: [
|
|
22007
|
+
{ name: "ticker", in: "query", required: false, schema: { type: "string" }, description: "Issuer ticker. Either ticker or cik is required." },
|
|
22008
|
+
{ name: "cik", in: "query", required: false, schema: { type: "string" }, description: "Issuer CIK. Either ticker or cik is required." },
|
|
22009
|
+
{ name: "period", in: "query", required: false, schema: { type: "string", enum: ["annual", "quarterly"] } },
|
|
22010
|
+
{ name: "limit", in: "query", required: false, schema: { type: "integer", minimum: 1, maximum: 40 } }
|
|
22011
|
+
],
|
|
22012
|
+
...jsonResponse("StatementBundle")
|
|
22013
|
+
}
|
|
19384
22014
|
},
|
|
19385
22015
|
"/v1/statements/{statement_key}": {
|
|
19386
|
-
get: {
|
|
22016
|
+
get: {
|
|
22017
|
+
summary: "Return a specific normalized statement keyed by statement type",
|
|
22018
|
+
parameters: [
|
|
22019
|
+
{ name: "statement_key", in: "path", required: true, schema: { type: "string" }, description: "Statement key such as income_statement, balance_sheet, or cash_flow_statement." },
|
|
22020
|
+
{ name: "ticker", in: "query", required: false, schema: { type: "string" }, description: "Issuer ticker. Either ticker or cik is required." },
|
|
22021
|
+
{ name: "cik", in: "query", required: false, schema: { type: "string" }, description: "Issuer CIK. Either ticker or cik is required." },
|
|
22022
|
+
{ name: "period", in: "query", required: false, schema: { type: "string", enum: ["annual", "quarterly"] } },
|
|
22023
|
+
{ name: "limit", in: "query", required: false, schema: { type: "integer", minimum: 1, maximum: 40 } },
|
|
22024
|
+
{ name: "view", in: "query", required: false, schema: { type: "string", enum: ["default", "compact", "agent"] }, description: "Use compact for period-indexed row arrays. Default and agent preserve statement value provenance." }
|
|
22025
|
+
],
|
|
22026
|
+
responses: {
|
|
22027
|
+
"200": {
|
|
22028
|
+
description: "Successful response. view=compact returns CompactStatement; view=agent returns StatementAgentRecord; default returns Statement.",
|
|
22029
|
+
content: {
|
|
22030
|
+
"application/json": {
|
|
22031
|
+
schema: {
|
|
22032
|
+
oneOf: [schemaRef("Statement"), schemaRef("CompactStatement"), schemaRef("StatementAgentRecord")]
|
|
22033
|
+
}
|
|
22034
|
+
}
|
|
22035
|
+
}
|
|
22036
|
+
}
|
|
22037
|
+
}
|
|
22038
|
+
}
|
|
19387
22039
|
},
|
|
19388
22040
|
"/v1/companies/income-statements": {
|
|
19389
22041
|
get: {
|
|
19390
22042
|
summary: "Return SEC XBRL-derived income statements for a ticker with EBITDA and share-count enrichment",
|
|
19391
|
-
|
|
22043
|
+
parameters: [
|
|
22044
|
+
{ name: "ticker", in: "query", required: true, schema: { type: "string" } },
|
|
22045
|
+
{ name: "period", in: "query", required: false, schema: { type: "string", enum: ["annual", "quarterly"] } },
|
|
22046
|
+
{ name: "limit", in: "query", required: false, schema: { type: "integer", minimum: 1, maximum: 40 } },
|
|
22047
|
+
{ name: "view", in: "query", required: false, schema: { type: "string", enum: ["compact"] }, description: "Use compact for period-indexed row arrays. Omit for the enriched company income-statement envelope." }
|
|
22048
|
+
],
|
|
22049
|
+
responses: {
|
|
22050
|
+
"200": {
|
|
22051
|
+
description: "Successful response. view=compact returns CompactStatement; default returns CompanyIncomeStatements.",
|
|
22052
|
+
content: { "application/json": { schema: { oneOf: [schemaRef("CompanyIncomeStatements"), schemaRef("CompactStatement")] } } }
|
|
22053
|
+
}
|
|
22054
|
+
}
|
|
19392
22055
|
}
|
|
19393
22056
|
},
|
|
19394
22057
|
"/v1/companies/balance-sheets": {
|
|
19395
22058
|
get: {
|
|
19396
22059
|
summary: "Return SEC XBRL-derived balance sheets for a ticker with normalized debt, equity, and cash fields",
|
|
19397
|
-
|
|
22060
|
+
parameters: [
|
|
22061
|
+
{ name: "ticker", in: "query", required: true, schema: { type: "string" } },
|
|
22062
|
+
{ name: "period", in: "query", required: false, schema: { type: "string", enum: ["annual", "quarterly"] } },
|
|
22063
|
+
{ name: "limit", in: "query", required: false, schema: { type: "integer", minimum: 1, maximum: 40 } },
|
|
22064
|
+
{ name: "view", in: "query", required: false, schema: { type: "string", enum: ["compact"] }, description: "Use compact for period-indexed row arrays. Omit for the enriched company balance-sheet envelope." }
|
|
22065
|
+
],
|
|
22066
|
+
responses: {
|
|
22067
|
+
"200": {
|
|
22068
|
+
description: "Successful response. view=compact returns CompactStatement; default returns CompanyBalanceSheets.",
|
|
22069
|
+
content: { "application/json": { schema: { oneOf: [schemaRef("CompanyBalanceSheets"), schemaRef("CompactStatement")] } } }
|
|
22070
|
+
}
|
|
22071
|
+
}
|
|
19398
22072
|
}
|
|
19399
22073
|
},
|
|
19400
22074
|
"/v1/companies/cash-flow-statements": {
|
|
19401
22075
|
get: {
|
|
19402
22076
|
summary: "Return SEC XBRL-derived cash flow statements for a ticker with free-cash-flow and dividend enrichment",
|
|
19403
|
-
|
|
22077
|
+
parameters: [
|
|
22078
|
+
{ name: "ticker", in: "query", required: true, schema: { type: "string" } },
|
|
22079
|
+
{ name: "period", in: "query", required: false, schema: { type: "string", enum: ["annual", "quarterly"] } },
|
|
22080
|
+
{ name: "limit", in: "query", required: false, schema: { type: "integer", minimum: 1, maximum: 40 } },
|
|
22081
|
+
{ name: "view", in: "query", required: false, schema: { type: "string", enum: ["compact"] }, description: "Use compact for period-indexed row arrays. Omit for the enriched company cash-flow envelope." }
|
|
22082
|
+
],
|
|
22083
|
+
responses: {
|
|
22084
|
+
"200": {
|
|
22085
|
+
description: "Successful response. view=compact returns CompactStatement; default returns CompanyCashFlowStatements.",
|
|
22086
|
+
content: { "application/json": { schema: { oneOf: [schemaRef("CompanyCashFlowStatements"), schemaRef("CompactStatement")] } } }
|
|
22087
|
+
}
|
|
22088
|
+
}
|
|
19404
22089
|
}
|
|
19405
22090
|
},
|
|
19406
22091
|
"/v1/companies/financials": {
|
|
@@ -19727,7 +22412,12 @@ var v1MaintenanceMaterializeInvestorDataPlaneBodySchema = exports_external.objec
|
|
|
19727
22412
|
includePortfolios: exports_external.union([exports_external.boolean(), exports_external.string()]).optional(),
|
|
19728
22413
|
includeAllFactorDecomposition: exports_external.union([exports_external.boolean(), exports_external.string()]).optional(),
|
|
19729
22414
|
precomputeRouteResponses: exports_external.union([exports_external.boolean(), exports_external.string()]).optional(),
|
|
19730
|
-
|
|
22415
|
+
materializePrerequisites: exports_external.union([exports_external.boolean(), exports_external.string()]).optional(),
|
|
22416
|
+
intradayWindows: exports_external.union([exports_external.array(exports_external.string()), exports_external.string()]).optional(),
|
|
22417
|
+
stockBasketInputPath: exports_external.string().optional(),
|
|
22418
|
+
requiredStockBasketStartDate: exports_external.string().optional(),
|
|
22419
|
+
stockBasketRequiredStartDateByFactorKey: exports_external.record(exports_external.string(), exports_external.string()).optional(),
|
|
22420
|
+
stockBasketStartToleranceDays: exports_external.union([exports_external.number(), exports_external.string()]).optional()
|
|
19731
22421
|
}).optional(),
|
|
19732
22422
|
factorIntraday: exports_external.object({
|
|
19733
22423
|
categories: exports_external.union([exports_external.array(exports_external.string()), exports_external.string()]).optional(),
|
|
@@ -19850,6 +22540,19 @@ var accountCreateApiKeyBodySchema = exports_external.object({
|
|
|
19850
22540
|
livemode: exports_external.boolean().nullish(),
|
|
19851
22541
|
label: exports_external.string().nullish()
|
|
19852
22542
|
}).passthrough();
|
|
22543
|
+
var accountUpdateDashboardProfileBodySchema = exports_external.object({
|
|
22544
|
+
displayName: exports_external.string().trim().min(1).max(120).nullable()
|
|
22545
|
+
}).strict();
|
|
22546
|
+
var accountUpdateDashboardOrganizationBodySchema = exports_external.object({
|
|
22547
|
+
name: exports_external.string().trim().min(1).max(120)
|
|
22548
|
+
}).strict();
|
|
22549
|
+
var accountUpdateDashboardAppearanceBodySchema = exports_external.object({
|
|
22550
|
+
theme: exports_external.enum(["dark", "system"]).optional(),
|
|
22551
|
+
density: exports_external.enum(["comfortable", "compact"]).optional()
|
|
22552
|
+
}).strict();
|
|
22553
|
+
var accountRequestDeletionBodySchema = exports_external.object({
|
|
22554
|
+
reason: exports_external.string().trim().max(500).nullable().optional()
|
|
22555
|
+
}).strict();
|
|
19853
22556
|
var AGENT_CHAT_TICKET_VERSION = 1;
|
|
19854
22557
|
var AGENT_CHAT_TICKET_SERVICE_PRINCIPALS = ["browser", "eval"];
|
|
19855
22558
|
var agentChatTicketEnvelopeSchema = exports_external.object({
|
|
@@ -19954,7 +22657,7 @@ var APP_ONLY_DATABASE_URL_PARAMS = new Set([
|
|
|
19954
22657
|
]);
|
|
19955
22658
|
var DEFAULT_BASE_URL = "https://api.secapi.ai";
|
|
19956
22659
|
var DEFAULT_API_VERSION = "2026-03-19";
|
|
19957
|
-
var SDK_VERSION = "0.
|
|
22660
|
+
var SDK_VERSION = "0.5.0";
|
|
19958
22661
|
var POSTHOG_CAPTURE_HOST = "https://us.i.posthog.com";
|
|
19959
22662
|
var SAFE_RETRY_METHODS = new Set(["GET", "HEAD", "OPTIONS"]);
|
|
19960
22663
|
var RETRYABLE_STATUSES = new Set([408, 429, 502, 503, 504]);
|
|
@@ -20097,6 +22800,14 @@ function buildUrl(path, params) {
|
|
|
20097
22800
|
const search = buildSearchParams(params);
|
|
20098
22801
|
return search.size > 0 ? `${url2.pathname}?${search.toString()}` : url2.pathname;
|
|
20099
22802
|
}
|
|
22803
|
+
function withRequiredInclude(params, required2) {
|
|
22804
|
+
const existing = params.include;
|
|
22805
|
+
const includes = Array.isArray(existing) ? existing.map(String) : typeof existing === "string" ? existing.split(",") : [];
|
|
22806
|
+
const normalized = new Set(includes.map((entry) => entry.trim().toLowerCase()).filter(Boolean));
|
|
22807
|
+
if (!normalized.has(required2))
|
|
22808
|
+
includes.push(required2);
|
|
22809
|
+
return { ...params, include: includes.join(",") };
|
|
22810
|
+
}
|
|
20100
22811
|
function methodOf(init) {
|
|
20101
22812
|
return (init.method ?? "GET").toUpperCase();
|
|
20102
22813
|
}
|
|
@@ -20573,6 +23284,32 @@ class SecApiClient {
|
|
|
20573
23284
|
body: JSON.stringify(body)
|
|
20574
23285
|
}, undefined, options);
|
|
20575
23286
|
}
|
|
23287
|
+
async createMonitor(body, options) {
|
|
23288
|
+
return this.request("/v1/monitors", {
|
|
23289
|
+
method: "POST",
|
|
23290
|
+
headers: { "content-type": "application/json" },
|
|
23291
|
+
body: JSON.stringify(body)
|
|
23292
|
+
}, undefined, options);
|
|
23293
|
+
}
|
|
23294
|
+
async monitorMatches(monitorId, params = {}) {
|
|
23295
|
+
return this.get(`/v1/monitors/${encodeURIComponent(monitorId)}/matches`, params);
|
|
23296
|
+
}
|
|
23297
|
+
async callMcpTool(toolName, args = {}, options = {}) {
|
|
23298
|
+
const { id, ...requestOptions } = options;
|
|
23299
|
+
return this.request("/mcp", {
|
|
23300
|
+
method: "POST",
|
|
23301
|
+
headers: { "content-type": "application/json" },
|
|
23302
|
+
body: JSON.stringify({
|
|
23303
|
+
jsonrpc: "2.0",
|
|
23304
|
+
id: id ?? randomId(),
|
|
23305
|
+
method: "tools/call",
|
|
23306
|
+
params: {
|
|
23307
|
+
name: toolName,
|
|
23308
|
+
arguments: args
|
|
23309
|
+
}
|
|
23310
|
+
})
|
|
23311
|
+
}, undefined, requestOptions);
|
|
23312
|
+
}
|
|
20576
23313
|
async rotateWebhookEndpointSecret(webhookId, options) {
|
|
20577
23314
|
return this.request(`/v1/webhook_endpoints/${webhookId}/rotate_secret`, {
|
|
20578
23315
|
method: "POST"
|
|
@@ -20628,6 +23365,9 @@ class SecApiClient {
|
|
|
20628
23365
|
async latestFiling(params) {
|
|
20629
23366
|
return this.get("/v1/filings/latest", params);
|
|
20630
23367
|
}
|
|
23368
|
+
async agentLatestFiling(params) {
|
|
23369
|
+
return this.latestFiling({ ...params, view: "agent" });
|
|
23370
|
+
}
|
|
20631
23371
|
async renderLatestFiling(params) {
|
|
20632
23372
|
return this.get("/v1/filings/latest/render", params);
|
|
20633
23373
|
}
|
|
@@ -20635,6 +23375,9 @@ class SecApiClient {
|
|
|
20635
23375
|
const { sectionKey, ...rest } = params;
|
|
20636
23376
|
return this.get(`/v1/filings/latest/sections/${sectionKey}`, rest);
|
|
20637
23377
|
}
|
|
23378
|
+
async agentSection(params) {
|
|
23379
|
+
return this.latestSection({ ...params, mode: "compact" });
|
|
23380
|
+
}
|
|
20638
23381
|
async latestRiskCategories(params = {}) {
|
|
20639
23382
|
return this.get("/v1/filings/latest/risk-categories", params);
|
|
20640
23383
|
}
|
|
@@ -20651,6 +23394,12 @@ class SecApiClient {
|
|
|
20651
23394
|
async searchSections(params) {
|
|
20652
23395
|
return this.get("/v1/sections/search", params);
|
|
20653
23396
|
}
|
|
23397
|
+
async semanticSearch(params) {
|
|
23398
|
+
return this.get("/v1/search/semantic", params);
|
|
23399
|
+
}
|
|
23400
|
+
async searchFulltext(params) {
|
|
23401
|
+
return this.get("/v1/search/fulltext", params);
|
|
23402
|
+
}
|
|
20654
23403
|
async segmentedRevenues(params = {}) {
|
|
20655
23404
|
return this.get("/v1/statements/segmented-revenues", params);
|
|
20656
23405
|
}
|
|
@@ -20720,6 +23469,9 @@ class SecApiClient {
|
|
|
20720
23469
|
async form144Filings(params = {}) {
|
|
20721
23470
|
return this.get("/v1/forms/144", params);
|
|
20722
23471
|
}
|
|
23472
|
+
async agentForm144(params = {}) {
|
|
23473
|
+
return this.form144Filings({ ...params, view: "agent" });
|
|
23474
|
+
}
|
|
20723
23475
|
async companySubsidiaries(params = {}) {
|
|
20724
23476
|
return this.get("/v1/companies/subsidiaries", params);
|
|
20725
23477
|
}
|
|
@@ -20729,6 +23481,9 @@ class SecApiClient {
|
|
|
20729
23481
|
async marketCalendar(params = {}) {
|
|
20730
23482
|
return this.get("/v1/market/calendar", params);
|
|
20731
23483
|
}
|
|
23484
|
+
async marketEarningsCalendar(params = {}) {
|
|
23485
|
+
return this.get("/v1/market/earnings-calendar", params);
|
|
23486
|
+
}
|
|
20732
23487
|
async marketSnapshots(params) {
|
|
20733
23488
|
return this.get("/v1/market/snapshots", params);
|
|
20734
23489
|
}
|
|
@@ -20774,9 +23529,15 @@ class SecApiClient {
|
|
|
20774
23529
|
async factorHistory(factorKey, params = {}) {
|
|
20775
23530
|
return this.get(`/v1/factors/history/${encodeURIComponent(factorKey)}`, params);
|
|
20776
23531
|
}
|
|
23532
|
+
async factorHistoryCsv(factorKey, params = {}) {
|
|
23533
|
+
return this.get(`/v1/factors/history/${encodeURIComponent(factorKey)}`, { ...params, format: "csv" });
|
|
23534
|
+
}
|
|
20777
23535
|
async factorSparklines(params = {}) {
|
|
20778
23536
|
return this.get("/v1/factors/sparklines", params);
|
|
20779
23537
|
}
|
|
23538
|
+
async factorSparklinesCsv(params = {}) {
|
|
23539
|
+
return this.get("/v1/factors/sparklines", { ...params, format: "csv" });
|
|
23540
|
+
}
|
|
20780
23541
|
async factorReturnsIntraday(params = {}) {
|
|
20781
23542
|
return this.get("/v1/factors/returns/intraday", params);
|
|
20782
23543
|
}
|
|
@@ -20801,9 +23562,15 @@ class SecApiClient {
|
|
|
20801
23562
|
async factorValuations(params = {}) {
|
|
20802
23563
|
return this.get("/v1/factors/valuations", params);
|
|
20803
23564
|
}
|
|
23565
|
+
async factorValuationsCsv(params = {}) {
|
|
23566
|
+
return this.get("/v1/factors/valuations", { ...params, format: "csv" });
|
|
23567
|
+
}
|
|
20804
23568
|
async factorValuationStocks(params = {}) {
|
|
20805
23569
|
return this.get("/v1/factors/valuations/stocks", params);
|
|
20806
23570
|
}
|
|
23571
|
+
async factorValuationStocksCsv(params = {}) {
|
|
23572
|
+
return this.get("/v1/factors/valuations/stocks", { ...params, format: "csv" });
|
|
23573
|
+
}
|
|
20807
23574
|
async factorExposures(params) {
|
|
20808
23575
|
return this.get("/v1/factors/exposures", params);
|
|
20809
23576
|
}
|
|
@@ -20828,6 +23595,9 @@ class SecApiClient {
|
|
|
20828
23595
|
async factorBulkDownload(params = {}) {
|
|
20829
23596
|
return this.get("/v1/factors/bulk-download", params);
|
|
20830
23597
|
}
|
|
23598
|
+
async factorBulkDownloadCsv(params = {}) {
|
|
23599
|
+
return this.get("/v1/factors/bulk-download", { ...params, format: "csv" });
|
|
23600
|
+
}
|
|
20831
23601
|
async factorCustom(body, params = {}, options) {
|
|
20832
23602
|
return this.request(buildUrl("/v1/factors/custom", params), {
|
|
20833
23603
|
method: "POST",
|
|
@@ -20853,11 +23623,12 @@ class SecApiClient {
|
|
|
20853
23623
|
return this.get(`/v1/model-portfolios/${encodeURIComponent(portfolioId)}/factor-view`, params);
|
|
20854
23624
|
}
|
|
20855
23625
|
async modelFactorAnalysis(body, params = {}, options) {
|
|
20856
|
-
|
|
23626
|
+
const urlParams = withRequiredInclude(params, "trust");
|
|
23627
|
+
return this.request(buildUrl("/v1/models/factor-analysis", urlParams), {
|
|
20857
23628
|
method: "POST",
|
|
20858
23629
|
headers: { "content-type": "application/json" },
|
|
20859
23630
|
body: JSON.stringify(body)
|
|
20860
|
-
},
|
|
23631
|
+
}, modelFactorAnalysisSchema, mergeRequestOptions(requestOptionsFromParams(params), options));
|
|
20861
23632
|
}
|
|
20862
23633
|
async portfolioOptimize(body, params = {}, options) {
|
|
20863
23634
|
return this.request(buildUrl("/v1/portfolio/optimize", params), {
|
|
@@ -20871,7 +23642,7 @@ class SecApiClient {
|
|
|
20871
23642
|
method: "POST",
|
|
20872
23643
|
headers: { "content-type": "application/json" },
|
|
20873
23644
|
body: JSON.stringify(body)
|
|
20874
|
-
},
|
|
23645
|
+
}, portfolioHedgeSchema, mergeRequestOptions(requestOptionsFromParams(params), options));
|
|
20875
23646
|
}
|
|
20876
23647
|
async portfolioStressTest(body, params = {}, options) {
|
|
20877
23648
|
return this.request(buildUrl("/v1/portfolio/stress-test", params), {
|
|
@@ -20959,6 +23730,9 @@ class SecApiClient {
|
|
|
20959
23730
|
async statementByKey(statementKey, params) {
|
|
20960
23731
|
return this.get(`/v1/statements/${statementKey}`, params);
|
|
20961
23732
|
}
|
|
23733
|
+
async agentStatement(statementKey, params) {
|
|
23734
|
+
return this.statementByKey(statementKey, { ...params, view: "agent" });
|
|
23735
|
+
}
|
|
20962
23736
|
async companyIncomeStatements(params) {
|
|
20963
23737
|
return this.get("/v1/companies/income-statements", params);
|
|
20964
23738
|
}
|
|
@@ -20983,6 +23757,12 @@ class SecApiClient {
|
|
|
20983
23757
|
async latest13F(params) {
|
|
20984
23758
|
return this.get("/v1/owners/13f", params);
|
|
20985
23759
|
}
|
|
23760
|
+
async institutionalHolders(params) {
|
|
23761
|
+
return this.get("/v1/owners/institutional/ticker", params);
|
|
23762
|
+
}
|
|
23763
|
+
async agentInstitutionalHolders(params) {
|
|
23764
|
+
return this.institutionalHolders({ ...params, view: "agent" });
|
|
23765
|
+
}
|
|
20986
23766
|
async list13FFilings(params) {
|
|
20987
23767
|
return this.get("/v1/owners/13f/filings", params);
|
|
20988
23768
|
}
|
|
@@ -21194,7 +23974,7 @@ class SecApiFilingStream {
|
|
|
21194
23974
|
|
|
21195
23975
|
// src/index.ts
|
|
21196
23976
|
var args = process.argv.slice(2);
|
|
21197
|
-
var baseUrl = envCredential("SECAPI_BASE_URL", "SECAPI_API_BASE_URL", "OMNI_DATASTREAM_BASE_URL") ?? "https://api.secapi.ai";
|
|
23977
|
+
var baseUrl = envCredential("SECAPI_BASE_URL", "SECAPI_API_BASE_URL", "OMNI_DATASTREAM_BASE_URL", "OMNI_DATASTREAM_API_BASE_URL") ?? "https://api.secapi.ai";
|
|
21198
23978
|
var STDIN_FLAG_NAME = "--api-key-stdin";
|
|
21199
23979
|
var STDIN_BEARER_FLAG_NAME = "--bearer-token-stdin";
|
|
21200
23980
|
var REJECTED_CREDENTIAL_FLAGS = new Set(["--api-key", "--bearer-token"]);
|
|
@@ -21214,7 +23994,7 @@ function formatPersonasHuman() {
|
|
|
21214
23994
|
console.log(` ${DIM}${meta3.summary}${RESET}`);
|
|
21215
23995
|
}
|
|
21216
23996
|
console.log("");
|
|
21217
|
-
console.log(`${DIM}Run 'secapi agents prompts list --persona <slug>' to see prompts for a persona.
|
|
23997
|
+
console.log(`${DIM}Run 'secapi agents prompts list --persona <slug>' to see prompts for a persona. ${RESET}`);
|
|
21218
23998
|
}
|
|
21219
23999
|
function formatPromptsListHuman(persona, prompts, totalCount) {
|
|
21220
24000
|
if (persona) {
|
|
@@ -21298,6 +24078,11 @@ function hasFlag(name) {
|
|
|
21298
24078
|
function print(value) {
|
|
21299
24079
|
console.log(JSON.stringify(value, null, 2));
|
|
21300
24080
|
}
|
|
24081
|
+
function printRaw(value) {
|
|
24082
|
+
process.stdout.write(value.endsWith(`
|
|
24083
|
+
`) ? value : `${value}
|
|
24084
|
+
`);
|
|
24085
|
+
}
|
|
21301
24086
|
function getNumberFlag(name) {
|
|
21302
24087
|
const raw = getFlag(name);
|
|
21303
24088
|
if (raw === undefined)
|
|
@@ -21323,6 +24108,85 @@ function getNullableIntegerFlag(name) {
|
|
|
21323
24108
|
function getListFlag(name) {
|
|
21324
24109
|
return getFlag(name)?.split(",").map((value) => value.trim()).filter(Boolean);
|
|
21325
24110
|
}
|
|
24111
|
+
function getBooleanFlag(name) {
|
|
24112
|
+
if (!hasFlag(name))
|
|
24113
|
+
return;
|
|
24114
|
+
const raw = getFlag(name);
|
|
24115
|
+
if (raw === undefined || raw.startsWith("--"))
|
|
24116
|
+
return true;
|
|
24117
|
+
const normalized = raw.trim().toLowerCase();
|
|
24118
|
+
if (["1", "true", "yes", "on"].includes(normalized))
|
|
24119
|
+
return true;
|
|
24120
|
+
if (["0", "false", "no", "off"].includes(normalized))
|
|
24121
|
+
return false;
|
|
24122
|
+
throw new Error(`${name} must be true or false`);
|
|
24123
|
+
}
|
|
24124
|
+
function parseJsonValue(raw, label) {
|
|
24125
|
+
try {
|
|
24126
|
+
return JSON.parse(raw);
|
|
24127
|
+
} catch (error51) {
|
|
24128
|
+
throw new Error(`${label} must be valid JSON`);
|
|
24129
|
+
}
|
|
24130
|
+
}
|
|
24131
|
+
function getJsonInput(jsonFlag, fileFlag, label) {
|
|
24132
|
+
const inline = getFlag(jsonFlag);
|
|
24133
|
+
const file2 = getFlag(fileFlag);
|
|
24134
|
+
if (inline && file2)
|
|
24135
|
+
throw new Error(`Use only one of ${jsonFlag} or ${fileFlag}`);
|
|
24136
|
+
if (inline)
|
|
24137
|
+
return parseJsonValue(inline, label);
|
|
24138
|
+
if (file2)
|
|
24139
|
+
return parseJsonValue(readFileSync(file2, "utf8"), label);
|
|
24140
|
+
return;
|
|
24141
|
+
}
|
|
24142
|
+
function getObjectInput(jsonFlag, fileFlag, label) {
|
|
24143
|
+
const value = getJsonInput(jsonFlag, fileFlag, label);
|
|
24144
|
+
if (value === undefined)
|
|
24145
|
+
return;
|
|
24146
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
24147
|
+
throw new Error(`${label} must be a JSON object`);
|
|
24148
|
+
}
|
|
24149
|
+
return value;
|
|
24150
|
+
}
|
|
24151
|
+
function getArrayInput(jsonFlag, fileFlag, label) {
|
|
24152
|
+
const value = getJsonInput(jsonFlag, fileFlag, label);
|
|
24153
|
+
if (value === undefined)
|
|
24154
|
+
return;
|
|
24155
|
+
if (!Array.isArray(value)) {
|
|
24156
|
+
throw new Error(`${label} must be a JSON array`);
|
|
24157
|
+
}
|
|
24158
|
+
return value;
|
|
24159
|
+
}
|
|
24160
|
+
function getRequiredHoldings() {
|
|
24161
|
+
const holdings = getArrayInput("--holdings-json", "--holdings-file", "holdings");
|
|
24162
|
+
if (!holdings)
|
|
24163
|
+
throw new Error("--holdings-json or --holdings-file is required");
|
|
24164
|
+
return holdings;
|
|
24165
|
+
}
|
|
24166
|
+
function factorResponseParams2() {
|
|
24167
|
+
return {
|
|
24168
|
+
response_mode: getFlag("--response-mode") ?? getFlag("--view"),
|
|
24169
|
+
include: getListFlag("--include") ?? getListFlag("--expand")
|
|
24170
|
+
};
|
|
24171
|
+
}
|
|
24172
|
+
function factorKeySelectionParams() {
|
|
24173
|
+
return {
|
|
24174
|
+
keys: getListFlag("--keys") ?? getListFlag("--factors"),
|
|
24175
|
+
category: getFlag("--category"),
|
|
24176
|
+
window: getFlag("--window"),
|
|
24177
|
+
lookback: getFlag("--lookback"),
|
|
24178
|
+
...factorResponseParams2()
|
|
24179
|
+
};
|
|
24180
|
+
}
|
|
24181
|
+
function portfolioWorkflowBody() {
|
|
24182
|
+
return {
|
|
24183
|
+
country: getFlag("--country"),
|
|
24184
|
+
lookback: getFlag("--lookback"),
|
|
24185
|
+
category: getFlag("--category"),
|
|
24186
|
+
keys: getListFlag("--keys") ?? getListFlag("--factors"),
|
|
24187
|
+
holdings: getRequiredHoldings()
|
|
24188
|
+
};
|
|
24189
|
+
}
|
|
21326
24190
|
function rejectedCredentialFlag(arg) {
|
|
21327
24191
|
const flag = arg.includes("=") ? arg.slice(0, arg.indexOf("=")) : arg;
|
|
21328
24192
|
return REJECTED_CREDENTIAL_FLAGS.has(flag) ? flag : null;
|
|
@@ -21394,8 +24258,21 @@ function humanClient(credentials) {
|
|
|
21394
24258
|
baseUrl
|
|
21395
24259
|
});
|
|
21396
24260
|
}
|
|
24261
|
+
function cliVersion() {
|
|
24262
|
+
try {
|
|
24263
|
+
const pkgUrl = new URL("../package.json", import.meta.url);
|
|
24264
|
+
const pkg = JSON.parse(readFileSync(pkgUrl, "utf8"));
|
|
24265
|
+
if (typeof pkg.version === "string" && pkg.version)
|
|
24266
|
+
return pkg.version;
|
|
24267
|
+
} catch {}
|
|
24268
|
+
return "unknown";
|
|
24269
|
+
}
|
|
21397
24270
|
async function main() {
|
|
21398
24271
|
rejectCredentialArgvFlags();
|
|
24272
|
+
if (args[0] === "--version" || args[0] === "-v" || args[0] === "version") {
|
|
24273
|
+
printRaw(cliVersion());
|
|
24274
|
+
return;
|
|
24275
|
+
}
|
|
21399
24276
|
const credentials = await resolveCredentials();
|
|
21400
24277
|
const [group = "help", command = ""] = args;
|
|
21401
24278
|
const apiClient = defaultClient(credentials);
|
|
@@ -21554,7 +24431,7 @@ async function main() {
|
|
|
21554
24431
|
if (group === "agents" && command === "prompts") {
|
|
21555
24432
|
const subverb = args[2];
|
|
21556
24433
|
if (!subverb || subverb.startsWith("-")) {
|
|
21557
|
-
throw new Error("Usage: secapi agents prompts <list|read|copy> [...]
|
|
24434
|
+
throw new Error("Usage: secapi agents prompts <list|read|copy> [...]");
|
|
21558
24435
|
}
|
|
21559
24436
|
if (subverb === "list") {
|
|
21560
24437
|
const personaFlag = getFlag("--persona");
|
|
@@ -21585,7 +24462,7 @@ async function main() {
|
|
|
21585
24462
|
if (subverb === "read") {
|
|
21586
24463
|
const id = args[3];
|
|
21587
24464
|
if (!id || id.startsWith("-")) {
|
|
21588
|
-
throw new Error("Usage: secapi agents prompts read <id>. Run 'secapi agents prompts list' to see IDs.
|
|
24465
|
+
throw new Error("Usage: secapi agents prompts read <id>. Run 'secapi agents prompts list' to see IDs. ");
|
|
21589
24466
|
}
|
|
21590
24467
|
const prompt = getPrompt(id);
|
|
21591
24468
|
if (!prompt) {
|
|
@@ -21601,7 +24478,7 @@ async function main() {
|
|
|
21601
24478
|
if (subverb === "copy") {
|
|
21602
24479
|
const id = args[3];
|
|
21603
24480
|
if (!id || id.startsWith("-")) {
|
|
21604
|
-
throw new Error("Usage: secapi agents prompts copy <id>. Pipe to clipboard via | pbcopy (macOS), | xclip -selection clipboard (Linux), or | clip (Windows).
|
|
24481
|
+
throw new Error("Usage: secapi agents prompts copy <id>. Pipe to clipboard via | pbcopy (macOS), | xclip -selection clipboard (Linux), or | clip (Windows). ");
|
|
21605
24482
|
}
|
|
21606
24483
|
const prompt = getPrompt(id);
|
|
21607
24484
|
if (!prompt) {
|
|
@@ -21758,6 +24635,35 @@ async function main() {
|
|
|
21758
24635
|
}));
|
|
21759
24636
|
return;
|
|
21760
24637
|
}
|
|
24638
|
+
if (group === "search" && command === "fulltext") {
|
|
24639
|
+
const q = getFlag("--q") ?? getFlag("--query");
|
|
24640
|
+
if (!q)
|
|
24641
|
+
throw new Error("--q or --query is required");
|
|
24642
|
+
print(await apiClient.searchFulltext({
|
|
24643
|
+
q,
|
|
24644
|
+
ticker: getFlag("--ticker"),
|
|
24645
|
+
cik: getFlag("--cik"),
|
|
24646
|
+
form: getFlag("--form"),
|
|
24647
|
+
limit: getNumberFlag("--limit")
|
|
24648
|
+
}));
|
|
24649
|
+
return;
|
|
24650
|
+
}
|
|
24651
|
+
if (group === "search" && command === "semantic") {
|
|
24652
|
+
const q = getFlag("--q") ?? getFlag("--query");
|
|
24653
|
+
if (!q)
|
|
24654
|
+
throw new Error("--q or --query is required");
|
|
24655
|
+
print(await apiClient.semanticSearch({
|
|
24656
|
+
q,
|
|
24657
|
+
ticker: getFlag("--ticker"),
|
|
24658
|
+
cik: getFlag("--cik"),
|
|
24659
|
+
form: getFlag("--form"),
|
|
24660
|
+
filing_year: getNumberFlag("--filing-year"),
|
|
24661
|
+
mode: getFlag("--mode"),
|
|
24662
|
+
limit: getNumberFlag("--limit"),
|
|
24663
|
+
view: getFlag("--view")
|
|
24664
|
+
}));
|
|
24665
|
+
return;
|
|
24666
|
+
}
|
|
21761
24667
|
if (group === "sections" && command === "get") {
|
|
21762
24668
|
print(await apiClient.latestSection({
|
|
21763
24669
|
ticker: getFlag("--ticker"),
|
|
@@ -21909,7 +24815,7 @@ async function main() {
|
|
|
21909
24815
|
if (group === "dilution" && command === "event") {
|
|
21910
24816
|
const eventId = getFlag("--event-id");
|
|
21911
24817
|
if (!eventId)
|
|
21912
|
-
throw new Error("Usage: secapi dilution event --event-id <id> [--view agent]
|
|
24818
|
+
throw new Error("Usage: secapi dilution event --event-id <id> [--view agent]");
|
|
21913
24819
|
print(await apiClient.dilutionEventDetail(eventId, { view: getFlag("--view") }));
|
|
21914
24820
|
return;
|
|
21915
24821
|
}
|
|
@@ -22028,7 +24934,7 @@ async function main() {
|
|
|
22028
24934
|
if (group === "dilution" && command === "score") {
|
|
22029
24935
|
const ticker = getFlag("--ticker");
|
|
22030
24936
|
if (!ticker)
|
|
22031
|
-
throw new Error("Usage: secapi dilution score --ticker <symbol> [--view agent]
|
|
24937
|
+
throw new Error("Usage: secapi dilution score --ticker <symbol> [--view agent]");
|
|
22032
24938
|
print(await apiClient.dilutionScore({ ticker, view: getFlag("--view") }));
|
|
22033
24939
|
return;
|
|
22034
24940
|
}
|
|
@@ -22164,6 +25070,59 @@ async function main() {
|
|
|
22164
25070
|
}));
|
|
22165
25071
|
return;
|
|
22166
25072
|
}
|
|
25073
|
+
if (group === "strategies" && command === "factor-rotation") {
|
|
25074
|
+
print(await apiClient.strategyFactorRotation({
|
|
25075
|
+
country: getFlag("--country"),
|
|
25076
|
+
category: getFlag("--category"),
|
|
25077
|
+
window: getFlag("--window"),
|
|
25078
|
+
lookback: getFlag("--lookback"),
|
|
25079
|
+
limit: getNumberFlag("--limit")
|
|
25080
|
+
}));
|
|
25081
|
+
return;
|
|
25082
|
+
}
|
|
25083
|
+
if (group === "strategies" && command === "regime-screen") {
|
|
25084
|
+
print(await apiClient.strategyRegimeScreen({
|
|
25085
|
+
country: getFlag("--country"),
|
|
25086
|
+
category: getFlag("--category"),
|
|
25087
|
+
window: getFlag("--window"),
|
|
25088
|
+
lookback: getFlag("--lookback"),
|
|
25089
|
+
limit: getNumberFlag("--limit")
|
|
25090
|
+
}));
|
|
25091
|
+
return;
|
|
25092
|
+
}
|
|
25093
|
+
if (group === "factors" && command === "history") {
|
|
25094
|
+
const factorKey = getFlag("--factor") ?? getFlag("--factor-key") ?? getFlag("--key");
|
|
25095
|
+
if (!factorKey)
|
|
25096
|
+
throw new Error("--factor, --factor-key, or --key is required");
|
|
25097
|
+
const params = {
|
|
25098
|
+
range: getFlag("--range"),
|
|
25099
|
+
lookback: getFlag("--lookback"),
|
|
25100
|
+
window: getFlag("--window"),
|
|
25101
|
+
date_from: getFlag("--date-from") ?? getFlag("--date_from"),
|
|
25102
|
+
date_to: getFlag("--date-to") ?? getFlag("--date_to"),
|
|
25103
|
+
...factorResponseParams2()
|
|
25104
|
+
};
|
|
25105
|
+
if (getFlag("--format") === "csv")
|
|
25106
|
+
printRaw(await apiClient.factorHistoryCsv(factorKey, params));
|
|
25107
|
+
else
|
|
25108
|
+
print(await apiClient.factorHistory(factorKey, params));
|
|
25109
|
+
return;
|
|
25110
|
+
}
|
|
25111
|
+
if (group === "factors" && command === "sparklines") {
|
|
25112
|
+
const params = {
|
|
25113
|
+
...factorKeySelectionParams(),
|
|
25114
|
+
range: getFlag("--range"),
|
|
25115
|
+
date_from: getFlag("--date-from") ?? getFlag("--date_from"),
|
|
25116
|
+
date_to: getFlag("--date-to") ?? getFlag("--date_to"),
|
|
25117
|
+
metric: getFlag("--metric"),
|
|
25118
|
+
points: getNumberFlag("--points") ?? getNumberFlag("--point-limit") ?? getNumberFlag("--pointLimit") ?? getNumberFlag("--point_limit")
|
|
25119
|
+
};
|
|
25120
|
+
if (getFlag("--format") === "csv")
|
|
25121
|
+
printRaw(await apiClient.factorSparklinesCsv(params));
|
|
25122
|
+
else
|
|
25123
|
+
print(await apiClient.factorSparklines(params));
|
|
25124
|
+
return;
|
|
25125
|
+
}
|
|
22167
25126
|
if (group === "factors" && command === "returns-intraday") {
|
|
22168
25127
|
print(await apiClient.factorReturnsIntraday({
|
|
22169
25128
|
keys: getListFlag("--keys"),
|
|
@@ -22181,7 +25140,8 @@ async function main() {
|
|
|
22181
25140
|
limit: getNumberFlag("--limit"),
|
|
22182
25141
|
ticker: getFlag("--ticker"),
|
|
22183
25142
|
portfolioId: getFlag("--portfolio-id"),
|
|
22184
|
-
keys: getListFlag("--keys")
|
|
25143
|
+
keys: getListFlag("--keys"),
|
|
25144
|
+
...factorResponseParams2()
|
|
22185
25145
|
}));
|
|
22186
25146
|
return;
|
|
22187
25147
|
}
|
|
@@ -22194,6 +25154,114 @@ async function main() {
|
|
|
22194
25154
|
}));
|
|
22195
25155
|
return;
|
|
22196
25156
|
}
|
|
25157
|
+
if (group === "factors" && command === "extreme-moves") {
|
|
25158
|
+
print(await apiClient.factorExtremeMoves({
|
|
25159
|
+
keys: getListFlag("--keys"),
|
|
25160
|
+
category: getFlag("--category"),
|
|
25161
|
+
window: getFlag("--window"),
|
|
25162
|
+
lookback: getFlag("--lookback"),
|
|
25163
|
+
side: getFlag("--side"),
|
|
25164
|
+
direction: getFlag("--direction"),
|
|
25165
|
+
sort: getFlag("--sort"),
|
|
25166
|
+
min_z_score: getNumberFlag("--min-z-score") ?? getNumberFlag("--min_z_score"),
|
|
25167
|
+
minAbsZScore: getNumberFlag("--min-abs-z-score") ?? getNumberFlag("--minAbsZScore"),
|
|
25168
|
+
limit: getNumberFlag("--limit"),
|
|
25169
|
+
response_mode: getFlag("--response-mode"),
|
|
25170
|
+
include: getListFlag("--include")
|
|
25171
|
+
}));
|
|
25172
|
+
return;
|
|
25173
|
+
}
|
|
25174
|
+
if (group === "factors" && command === "extreme-pairs") {
|
|
25175
|
+
print(await apiClient.factorExtremePairs({
|
|
25176
|
+
keys: getListFlag("--keys"),
|
|
25177
|
+
category: getFlag("--category"),
|
|
25178
|
+
window: getFlag("--window"),
|
|
25179
|
+
lookback: getFlag("--lookback"),
|
|
25180
|
+
side: getFlag("--side"),
|
|
25181
|
+
direction: getFlag("--direction"),
|
|
25182
|
+
sort: getFlag("--sort"),
|
|
25183
|
+
min_z_score: getNumberFlag("--min-z-score") ?? getNumberFlag("--min_z_score"),
|
|
25184
|
+
minAbsZScore: getNumberFlag("--min-abs-z-score") ?? getNumberFlag("--minAbsZScore"),
|
|
25185
|
+
limit: getNumberFlag("--limit"),
|
|
25186
|
+
response_mode: getFlag("--response-mode"),
|
|
25187
|
+
include: getListFlag("--include")
|
|
25188
|
+
}));
|
|
25189
|
+
return;
|
|
25190
|
+
}
|
|
25191
|
+
if (group === "factors" && command === "valuations") {
|
|
25192
|
+
const params = {
|
|
25193
|
+
keys: getListFlag("--keys") ?? getListFlag("--factors"),
|
|
25194
|
+
category: getFlag("--category"),
|
|
25195
|
+
window: getFlag("--window"),
|
|
25196
|
+
lookback: getFlag("--lookback"),
|
|
25197
|
+
side: getFlag("--side"),
|
|
25198
|
+
signal: getFlag("--signal"),
|
|
25199
|
+
sort: getFlag("--sort"),
|
|
25200
|
+
weighting_mode: getFlag("--weighting-mode"),
|
|
25201
|
+
weighting: getFlag("--weighting"),
|
|
25202
|
+
limit: getNumberFlag("--limit"),
|
|
25203
|
+
response_mode: getFlag("--response-mode") ?? getFlag("--view"),
|
|
25204
|
+
include: getListFlag("--include") ?? getListFlag("--expand")
|
|
25205
|
+
};
|
|
25206
|
+
if (getFlag("--format") === "csv")
|
|
25207
|
+
printRaw(await apiClient.factorValuationsCsv(params));
|
|
25208
|
+
else
|
|
25209
|
+
print(await apiClient.factorValuations(params));
|
|
25210
|
+
return;
|
|
25211
|
+
}
|
|
25212
|
+
if (group === "factors" && command === "valuation-stocks") {
|
|
25213
|
+
const params = {
|
|
25214
|
+
factor: getFlag("--factor"),
|
|
25215
|
+
factorKey: getFlag("--factor-key") ?? getFlag("--factorKey"),
|
|
25216
|
+
key: getFlag("--key"),
|
|
25217
|
+
keys: getListFlag("--keys") ?? getListFlag("--factors"),
|
|
25218
|
+
category: getFlag("--category"),
|
|
25219
|
+
window: getFlag("--window"),
|
|
25220
|
+
lookback: getFlag("--lookback"),
|
|
25221
|
+
signal: getFlag("--signal"),
|
|
25222
|
+
weighting_mode: getFlag("--weighting-mode"),
|
|
25223
|
+
weighting: getFlag("--weighting"),
|
|
25224
|
+
stance: getFlag("--stance"),
|
|
25225
|
+
side: getFlag("--side"),
|
|
25226
|
+
direction: getFlag("--direction"),
|
|
25227
|
+
sort: getFlag("--sort"),
|
|
25228
|
+
limit: getNumberFlag("--limit"),
|
|
25229
|
+
response_mode: getFlag("--response-mode") ?? getFlag("--view"),
|
|
25230
|
+
include: getListFlag("--include") ?? getListFlag("--expand")
|
|
25231
|
+
};
|
|
25232
|
+
if (getFlag("--format") === "csv")
|
|
25233
|
+
printRaw(await apiClient.factorValuationStocksCsv(params));
|
|
25234
|
+
else
|
|
25235
|
+
print(await apiClient.factorValuationStocks(params));
|
|
25236
|
+
return;
|
|
25237
|
+
}
|
|
25238
|
+
if (group === "factors" && command === "pairs") {
|
|
25239
|
+
print(await apiClient.factorPairs({
|
|
25240
|
+
factor1: getFlag("--factor1"),
|
|
25241
|
+
factor2: getFlag("--factor2"),
|
|
25242
|
+
f1: getFlag("--f1"),
|
|
25243
|
+
f2: getFlag("--f2"),
|
|
25244
|
+
window: getFlag("--window"),
|
|
25245
|
+
lookback: getFlag("--lookback"),
|
|
25246
|
+
response_mode: getFlag("--response-mode"),
|
|
25247
|
+
include: getListFlag("--include")
|
|
25248
|
+
}));
|
|
25249
|
+
return;
|
|
25250
|
+
}
|
|
25251
|
+
if (group === "factors" && command === "pair-history") {
|
|
25252
|
+
const f1 = getFlag("--factor1") ?? getFlag("--f1");
|
|
25253
|
+
const f2 = getFlag("--factor2") ?? getFlag("--f2");
|
|
25254
|
+
if (!f1 || !f2)
|
|
25255
|
+
throw new Error("--factor1/--f1 and --factor2/--f2 are required");
|
|
25256
|
+
print(await apiClient.factorPairHistory(f1, f2, {
|
|
25257
|
+
window: getFlag("--window"),
|
|
25258
|
+
lookback: getFlag("--lookback"),
|
|
25259
|
+
range: getFlag("--range"),
|
|
25260
|
+
response_mode: getFlag("--response-mode"),
|
|
25261
|
+
include: getListFlag("--include")
|
|
25262
|
+
}));
|
|
25263
|
+
return;
|
|
25264
|
+
}
|
|
22197
25265
|
if (group === "factors" && command === "decomposition") {
|
|
22198
25266
|
const symbol2 = getFlag("--ticker") ?? getFlag("--symbol");
|
|
22199
25267
|
if (!symbol2)
|
|
@@ -22217,9 +25285,22 @@ async function main() {
|
|
|
22217
25285
|
}));
|
|
22218
25286
|
return;
|
|
22219
25287
|
}
|
|
25288
|
+
if (group === "factors" && command === "similarity-pack") {
|
|
25289
|
+
const symbol2 = getFlag("--ticker") ?? getFlag("--symbol");
|
|
25290
|
+
if (!symbol2)
|
|
25291
|
+
throw new Error("--ticker or --symbol is required");
|
|
25292
|
+
print(await apiClient.factorSimilarityPack({
|
|
25293
|
+
symbol: symbol2,
|
|
25294
|
+
candidates: getListFlag("--candidates"),
|
|
25295
|
+
lookback: getFlag("--lookback"),
|
|
25296
|
+
limit: getNumberFlag("--limit")
|
|
25297
|
+
}));
|
|
25298
|
+
return;
|
|
25299
|
+
}
|
|
22220
25300
|
if (group === "factors" && command === "catalog") {
|
|
22221
25301
|
print(await apiClient.factorCatalog({
|
|
22222
|
-
category: getFlag("--category")
|
|
25302
|
+
category: getFlag("--category"),
|
|
25303
|
+
...factorResponseParams2()
|
|
22223
25304
|
}));
|
|
22224
25305
|
return;
|
|
22225
25306
|
}
|
|
@@ -22232,6 +25313,32 @@ async function main() {
|
|
|
22232
25313
|
}));
|
|
22233
25314
|
return;
|
|
22234
25315
|
}
|
|
25316
|
+
if (group === "factors" && command === "exposures") {
|
|
25317
|
+
const symbols = getListFlag("--symbols") ?? getListFlag("--tickers");
|
|
25318
|
+
if (!symbols?.length)
|
|
25319
|
+
throw new Error("--symbols or --tickers is required");
|
|
25320
|
+
print(await apiClient.factorExposures({
|
|
25321
|
+
symbols,
|
|
25322
|
+
...factorKeySelectionParams(),
|
|
25323
|
+
model: getFlag("--model")
|
|
25324
|
+
}));
|
|
25325
|
+
return;
|
|
25326
|
+
}
|
|
25327
|
+
if (group === "factors" && command === "bulk-download") {
|
|
25328
|
+
const params = factorKeySelectionParams();
|
|
25329
|
+
if (getFlag("--format") === "csv")
|
|
25330
|
+
printRaw(await apiClient.factorBulkDownloadCsv(params));
|
|
25331
|
+
else
|
|
25332
|
+
print(await apiClient.factorBulkDownload(params));
|
|
25333
|
+
return;
|
|
25334
|
+
}
|
|
25335
|
+
if (group === "factors" && command === "custom") {
|
|
25336
|
+
const body = getObjectInput("--body-json", "--body-file", "custom factor request") ?? getObjectInput("--query-json", "--query-file", "custom factor request");
|
|
25337
|
+
if (!body)
|
|
25338
|
+
throw new Error("--body-json, --body-file, --query-json, or --query-file is required");
|
|
25339
|
+
print(await apiClient.factorCustom(body, factorResponseParams2()));
|
|
25340
|
+
return;
|
|
25341
|
+
}
|
|
22235
25342
|
if (group === "factors" && command === "correlations") {
|
|
22236
25343
|
print(await apiClient.factorCorrelations({
|
|
22237
25344
|
keys: getListFlag("--keys"),
|
|
@@ -22250,6 +25357,50 @@ async function main() {
|
|
|
22250
25357
|
}));
|
|
22251
25358
|
return;
|
|
22252
25359
|
}
|
|
25360
|
+
if (group === "portfolio" && command === "analyze") {
|
|
25361
|
+
print(await apiClient.portfolioAnalyze({
|
|
25362
|
+
...portfolioWorkflowBody(),
|
|
25363
|
+
benchmarkLabel: getFlag("--benchmark-label"),
|
|
25364
|
+
benchmarkHoldings: getArrayInput("--benchmark-holdings-json", "--benchmark-holdings-file", "benchmark holdings"),
|
|
25365
|
+
whatIfLabel: getFlag("--what-if-label"),
|
|
25366
|
+
whatIfHoldings: getArrayInput("--what-if-holdings-json", "--what-if-holdings-file", "what-if holdings")
|
|
25367
|
+
}, factorResponseParams2()));
|
|
25368
|
+
return;
|
|
25369
|
+
}
|
|
25370
|
+
if (group === "portfolio" && command === "attribution") {
|
|
25371
|
+
print(await apiClient.portfolioAttribution({
|
|
25372
|
+
...portfolioWorkflowBody(),
|
|
25373
|
+
window: getFlag("--window"),
|
|
25374
|
+
frequency: getFlag("--frequency"),
|
|
25375
|
+
exportFormat: getFlag("--export-format")
|
|
25376
|
+
}, factorResponseParams2()));
|
|
25377
|
+
return;
|
|
25378
|
+
}
|
|
25379
|
+
if (group === "portfolio" && command === "hedge") {
|
|
25380
|
+
print(await apiClient.portfolioHedge({
|
|
25381
|
+
...portfolioWorkflowBody(),
|
|
25382
|
+
objective: getFlag("--objective"),
|
|
25383
|
+
mode: getFlag("--mode"),
|
|
25384
|
+
constraints: getObjectInput("--constraints-json", "--constraints-file", "hedge constraints")
|
|
25385
|
+
}, factorResponseParams2()));
|
|
25386
|
+
return;
|
|
25387
|
+
}
|
|
25388
|
+
if (group === "portfolio" && command === "optimize") {
|
|
25389
|
+
print(await apiClient.portfolioOptimize({
|
|
25390
|
+
...portfolioWorkflowBody(),
|
|
25391
|
+
objective: getFlag("--objective"),
|
|
25392
|
+
maxHedges: getNumberFlag("--max-hedges") ?? getNumberFlag("--maxHedges"),
|
|
25393
|
+
constraints: getObjectInput("--constraints-json", "--constraints-file", "optimizer constraints")
|
|
25394
|
+
}, factorResponseParams2()));
|
|
25395
|
+
return;
|
|
25396
|
+
}
|
|
25397
|
+
if (group === "portfolio" && command === "stress-test") {
|
|
25398
|
+
print(await apiClient.portfolioStressTest({
|
|
25399
|
+
...portfolioWorkflowBody(),
|
|
25400
|
+
scenarioKey: getFlag("--scenario-key")
|
|
25401
|
+
}, factorResponseParams2()));
|
|
25402
|
+
return;
|
|
25403
|
+
}
|
|
22253
25404
|
if (group === "stocks" && command === "loadings") {
|
|
22254
25405
|
const ticker = getFlag("--ticker");
|
|
22255
25406
|
if (!ticker)
|
|
@@ -22268,10 +25419,36 @@ async function main() {
|
|
|
22268
25419
|
print(await apiClient.modelPortfolioFactorView(portfolioId, {
|
|
22269
25420
|
keys: getListFlag("--keys"),
|
|
22270
25421
|
category: getFlag("--category"),
|
|
22271
|
-
lookback: getFlag("--lookback")
|
|
25422
|
+
lookback: getFlag("--lookback"),
|
|
25423
|
+
...factorResponseParams2()
|
|
22272
25424
|
}));
|
|
22273
25425
|
return;
|
|
22274
25426
|
}
|
|
25427
|
+
if (group === "models" && command === "factor-analysis") {
|
|
25428
|
+
const model = getObjectInput("--model-json", "--model-file", "model") ?? {
|
|
25429
|
+
id: getFlag("--model-id"),
|
|
25430
|
+
label: getFlag("--label"),
|
|
25431
|
+
source: getFlag("--source")
|
|
25432
|
+
};
|
|
25433
|
+
print(await apiClient.modelFactorAnalysis({
|
|
25434
|
+
model,
|
|
25435
|
+
country: getFlag("--country"),
|
|
25436
|
+
lookback: getFlag("--lookback"),
|
|
25437
|
+
window: getFlag("--window"),
|
|
25438
|
+
category: getFlag("--category"),
|
|
25439
|
+
keys: getListFlag("--keys") ?? getListFlag("--factors"),
|
|
25440
|
+
include: {
|
|
25441
|
+
attribution: getBooleanFlag("--include-attribution"),
|
|
25442
|
+
hedge: getBooleanFlag("--include-hedge"),
|
|
25443
|
+
optimizer: getBooleanFlag("--include-optimizer"),
|
|
25444
|
+
positionViews: getBooleanFlag("--include-position-views")
|
|
25445
|
+
},
|
|
25446
|
+
hedge: getObjectInput("--hedge-json", "--hedge-file", "hedge options"),
|
|
25447
|
+
optimizer: getObjectInput("--optimizer-json", "--optimizer-file", "optimizer options"),
|
|
25448
|
+
holdings: getRequiredHoldings()
|
|
25449
|
+
}, factorResponseParams2()));
|
|
25450
|
+
return;
|
|
25451
|
+
}
|
|
22275
25452
|
if (group === "intelligence" && command === "footnotes-query") {
|
|
22276
25453
|
print(await apiClient.intelligenceFootnotesQuery({
|
|
22277
25454
|
ticker: getFlag("--ticker"),
|
|
@@ -22383,150 +25560,315 @@ async function main() {
|
|
|
22383
25560
|
}));
|
|
22384
25561
|
return;
|
|
22385
25562
|
}
|
|
25563
|
+
if (group === "init" || group === "agents" && command === "setup") {
|
|
25564
|
+
const mcpUrl = `${baseUrl.replace(/\/+$/, "")}/mcp`;
|
|
25565
|
+
const initKeySource = hasFlag(STDIN_FLAG_NAME) ? credentials.apiKey : envCredential("SECAPI_API_KEY");
|
|
25566
|
+
const literalKey = initKeySource ?? "YOUR_API_KEY";
|
|
25567
|
+
const hasRealKey = Boolean(initKeySource);
|
|
25568
|
+
const dryRun = hasFlag("--print") || hasFlag("--dry-run");
|
|
25569
|
+
const positional = group === "init" && command && !command.startsWith("-") ? command : undefined;
|
|
25570
|
+
const clientFlag = getFlag("--client");
|
|
25571
|
+
const requested = clientFlag && !clientFlag.startsWith("-") ? clientFlag : positional;
|
|
25572
|
+
const claudeDesktopPath = () => {
|
|
25573
|
+
const home = homedir();
|
|
25574
|
+
if (process.platform === "darwin")
|
|
25575
|
+
return join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
25576
|
+
if (process.platform === "win32")
|
|
25577
|
+
return join(process.env.APPDATA ?? join(home, "AppData", "Roaming"), "Claude", "claude_desktop_config.json");
|
|
25578
|
+
return join(home, ".config", "Claude", "claude_desktop_config.json");
|
|
25579
|
+
};
|
|
25580
|
+
const clients = {
|
|
25581
|
+
"claude-code": { kind: "command" },
|
|
25582
|
+
"claude-desktop": { kind: "file", urlKey: "url", httpType: true, keyValue: literalKey, committable: false, path: claudeDesktopPath },
|
|
25583
|
+
cursor: { kind: "file", urlKey: "url", httpType: false, keyValue: "${SECAPI_API_KEY}", committable: true, path: () => join(process.cwd(), ".cursor", "mcp.json") },
|
|
25584
|
+
windsurf: { kind: "file", urlKey: "serverUrl", httpType: false, keyValue: "${env:SECAPI_API_KEY}", committable: false, path: () => join(homedir(), ".codeium", "windsurf", "mcp_config.json") },
|
|
25585
|
+
project: { kind: "file", urlKey: "url", httpType: true, keyValue: "${SECAPI_API_KEY}", committable: true, path: () => join(process.cwd(), ".mcp.json") }
|
|
25586
|
+
};
|
|
25587
|
+
const names = Object.keys(clients).join(", ");
|
|
25588
|
+
if (!requested) {
|
|
25589
|
+
process.stdout.write(`Usage: secapi init --client <${names}> [--print]
|
|
25590
|
+
|
|
25591
|
+
Writes the SEC API hosted-MCP config (${mcpUrl}, x-api-key) for your agent client.
|
|
25592
|
+
Provide your API key via SECAPI_API_KEY (or ${STDIN_FLAG_NAME}); it is never read from an argv flag.
|
|
25593
|
+
`);
|
|
25594
|
+
return;
|
|
25595
|
+
}
|
|
25596
|
+
const spec = clients[requested];
|
|
25597
|
+
if (!spec)
|
|
25598
|
+
throw new Error(`Unknown client '${requested}'. Supported: ${names}`);
|
|
25599
|
+
if (spec.kind === "command") {
|
|
25600
|
+
process.stdout.write(`Add SEC API to Claude Code:
|
|
25601
|
+
|
|
25602
|
+
claude mcp add --transport http secapi ${mcpUrl} --header "x-api-key: $SECAPI_API_KEY"
|
|
25603
|
+
`);
|
|
25604
|
+
if (!hasRealKey)
|
|
25605
|
+
process.stdout.write(`
|
|
25606
|
+
Set SECAPI_API_KEY in your environment first.
|
|
25607
|
+
`);
|
|
25608
|
+
return;
|
|
25609
|
+
}
|
|
25610
|
+
const filePath = spec.path();
|
|
25611
|
+
let config2 = {};
|
|
25612
|
+
if (existsSync(filePath)) {
|
|
25613
|
+
let parsed;
|
|
25614
|
+
try {
|
|
25615
|
+
parsed = JSON.parse(readFileSync(filePath, "utf8"));
|
|
25616
|
+
} catch {
|
|
25617
|
+
throw new Error(`Existing config at ${filePath} is not valid JSON; fix or move it before running init.`);
|
|
25618
|
+
}
|
|
25619
|
+
if (Array.isArray(parsed) || typeof parsed !== "object" || parsed === null) {
|
|
25620
|
+
throw new Error(`Existing config at ${filePath} is not a JSON object; fix or move it before running init.`);
|
|
25621
|
+
}
|
|
25622
|
+
config2 = parsed;
|
|
25623
|
+
}
|
|
25624
|
+
const existingServers = config2.mcpServers;
|
|
25625
|
+
if (existingServers !== undefined && (typeof existingServers !== "object" || existingServers === null || Array.isArray(existingServers))) {
|
|
25626
|
+
throw new Error(`Existing "mcpServers" in ${filePath} is not an object; fix or move it before running init.`);
|
|
25627
|
+
}
|
|
25628
|
+
const servers = existingServers ? existingServers : {};
|
|
25629
|
+
servers.secapi = {
|
|
25630
|
+
...spec.httpType ? { type: "http" } : {},
|
|
25631
|
+
[spec.urlKey]: mcpUrl,
|
|
25632
|
+
headers: { "x-api-key": spec.keyValue }
|
|
25633
|
+
};
|
|
25634
|
+
config2.mcpServers = servers;
|
|
25635
|
+
const rendered = `${JSON.stringify(config2, null, 2)}
|
|
25636
|
+
`;
|
|
25637
|
+
if (dryRun) {
|
|
25638
|
+
process.stdout.write(`# ${filePath}
|
|
25639
|
+
${rendered}`);
|
|
25640
|
+
return;
|
|
25641
|
+
}
|
|
25642
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
25643
|
+
writeFileSync(filePath, rendered, { mode: 384 });
|
|
25644
|
+
chmodSync(filePath, 384);
|
|
25645
|
+
process.stdout.write(`Wrote SEC API MCP config for ${requested} to ${filePath}
|
|
25646
|
+
`);
|
|
25647
|
+
if (spec.keyValue.startsWith("$")) {
|
|
25648
|
+
process.stdout.write(`Set SECAPI_API_KEY in your environment so ${requested} can resolve the key.
|
|
25649
|
+
`);
|
|
25650
|
+
} else if (!hasRealKey) {
|
|
25651
|
+
process.stdout.write(`Replace YOUR_API_KEY in that file with your key (or set SECAPI_API_KEY and re-run).
|
|
25652
|
+
`);
|
|
25653
|
+
}
|
|
25654
|
+
if (spec.committable) {
|
|
25655
|
+
process.stdout.write(`Note: ${filePath} can be committed — it uses an env-var reference, not your literal key.
|
|
25656
|
+
`);
|
|
25657
|
+
}
|
|
25658
|
+
process.stdout.write(`Restart ${requested} to load the server.
|
|
25659
|
+
`);
|
|
25660
|
+
return;
|
|
25661
|
+
}
|
|
25662
|
+
if (group === "agent-context" || group === "agents" && command === "context") {
|
|
25663
|
+
print({
|
|
25664
|
+
object: "agent_context",
|
|
25665
|
+
cli: { binaries: ["secapi", "omni-sec"], version: cliVersion() },
|
|
25666
|
+
baseUrl,
|
|
25667
|
+
mcpUrl: `${baseUrl.replace(/\/+$/, "")}/mcp`,
|
|
25668
|
+
docs: "https://docs.secapi.ai",
|
|
25669
|
+
agentsPage: "https://secapi.ai/agents",
|
|
25670
|
+
auth: {
|
|
25671
|
+
header: "x-api-key",
|
|
25672
|
+
note: "Authenticate with the x-api-key header. Never send the API key as Authorization: Bearer.",
|
|
25673
|
+
envVars: ["SECAPI_API_KEY", "SECAPI_OPERATOR_API_KEY", "SECAPI_BEARER_TOKEN (WorkOS bearer, not an API key)"],
|
|
25674
|
+
stdin: [STDIN_FLAG_NAME, STDIN_BEARER_FLAG_NAME]
|
|
25675
|
+
},
|
|
25676
|
+
install: {
|
|
25677
|
+
mcp: `secapi init --client <claude-code|claude-desktop|cursor|windsurf|project>`,
|
|
25678
|
+
skills: "npx skills add secapi-ai/secapi-skills --global"
|
|
25679
|
+
},
|
|
25680
|
+
commandGroups: [
|
|
25681
|
+
{ group: "account", commands: ["health", "me", "org show", "billing show", "usage show", "limits show", "api-keys list", "api-keys create --label <l> --scopes <s>"] },
|
|
25682
|
+
{ group: "agent", commands: ["agent bootstrap-token --label <l> --scopes <s> --ttl-seconds <n>", "agent bootstrap --token <agbt_...>"] },
|
|
25683
|
+
{ group: "agents", commands: ["agents personas", "agents prompts list [--persona <p>] [--include-v2] [--json]", "agents prompts read <id>", "agents prompts copy <id>", "agents setup --client <name>", "agents context"] },
|
|
25684
|
+
{ group: "entities", commands: ["entities resolve --ticker <t> | --name <n> | --cik <c>"] },
|
|
25685
|
+
{ group: "filings", commands: ["filings search --ticker <t> --form <f>", "filings latest --ticker <t> --form <f>", "sections get --ticker <t> --form 10-K --section item_1a"] },
|
|
25686
|
+
{ group: "factors", commands: ["factors exposures --symbols <list>", "factors decomposition --symbol <t>", "factors screen --keys <list>", "factors valuations --keys <list>"] },
|
|
25687
|
+
{ group: "setup", commands: ["init --client <claude-code|claude-desktop|cursor|windsurf|project> [--print]", "agent-context"] }
|
|
25688
|
+
],
|
|
25689
|
+
conventions: {
|
|
25690
|
+
output: "JSON to stdout by default; human-readable when stdout is a TTY for agents/personas commands.",
|
|
25691
|
+
correlation: "Request-Id header on every response.",
|
|
25692
|
+
guardrails: "Check GET /v1/billing and POST /v1/billing/quote before expensive or repeated workflows."
|
|
25693
|
+
}
|
|
25694
|
+
});
|
|
25695
|
+
return;
|
|
25696
|
+
}
|
|
22386
25697
|
const commandHelpLines = [
|
|
22387
25698
|
"SEC API CLI",
|
|
22388
25699
|
"Preferred binary: secapi",
|
|
22389
25700
|
"Compatibility alias: omni-sec",
|
|
22390
25701
|
"",
|
|
22391
25702
|
"Commands:",
|
|
22392
|
-
"
|
|
22393
|
-
"
|
|
22394
|
-
"
|
|
22395
|
-
"
|
|
22396
|
-
"
|
|
22397
|
-
"
|
|
22398
|
-
"
|
|
22399
|
-
"
|
|
22400
|
-
"
|
|
22401
|
-
"
|
|
22402
|
-
"
|
|
25703
|
+
" secapi health",
|
|
25704
|
+
" secapi me",
|
|
25705
|
+
" secapi org show",
|
|
25706
|
+
" secapi billing show",
|
|
25707
|
+
" secapi dashboard overview",
|
|
25708
|
+
" secapi billing quote --meter-class section_extract --units 10",
|
|
25709
|
+
" secapi billing budget --spend-cap-cents 900 --soft-cap-cents 500 --approval-threshold-cents 750",
|
|
25710
|
+
" secapi billing checkout --plan personal",
|
|
25711
|
+
" secapi billing portal",
|
|
25712
|
+
" secapi agent bootstrap-token --label ci --scopes read:sec --ttl-seconds 900",
|
|
25713
|
+
" secapi agent bootstrap --token agbt_... --label first-agent-key",
|
|
25714
|
+
"",
|
|
25715
|
+
" # Connect an agent (one-command MCP install)",
|
|
25716
|
+
" secapi init --client claude-code # prints the `claude mcp add` command",
|
|
25717
|
+
" secapi init --client cursor # writes .cursor/mcp.json",
|
|
25718
|
+
" secapi init --client claude-desktop --print # dry-run the config",
|
|
25719
|
+
" secapi agent-context # machine-readable CLI surface for agents",
|
|
22403
25720
|
"",
|
|
22404
25721
|
" # Agent prompt library",
|
|
22405
|
-
"
|
|
22406
|
-
"
|
|
22407
|
-
"
|
|
22408
|
-
"
|
|
22409
|
-
"
|
|
22410
|
-
"
|
|
22411
|
-
"
|
|
22412
|
-
"
|
|
22413
|
-
" SECAPI_API_KEY=...
|
|
22414
|
-
" SECAPI_OPERATOR_API_KEY=...
|
|
22415
|
-
" OMNI_DATASTREAM_API_KEY=... omni-sec api-keys list #
|
|
22416
|
-
` printf '%s' "$SECAPI_API_KEY" |
|
|
22417
|
-
"
|
|
22418
|
-
"
|
|
22419
|
-
"
|
|
22420
|
-
"
|
|
22421
|
-
"
|
|
22422
|
-
"
|
|
22423
|
-
"
|
|
22424
|
-
"
|
|
22425
|
-
"
|
|
22426
|
-
"
|
|
22427
|
-
"
|
|
22428
|
-
"
|
|
22429
|
-
"
|
|
22430
|
-
"
|
|
22431
|
-
"
|
|
22432
|
-
"
|
|
22433
|
-
"
|
|
22434
|
-
"
|
|
22435
|
-
"
|
|
22436
|
-
"
|
|
22437
|
-
"
|
|
22438
|
-
"
|
|
22439
|
-
"
|
|
22440
|
-
"
|
|
22441
|
-
"
|
|
22442
|
-
"
|
|
22443
|
-
"
|
|
22444
|
-
"
|
|
22445
|
-
|
|
22446
|
-
|
|
22447
|
-
"
|
|
22448
|
-
"
|
|
22449
|
-
"
|
|
22450
|
-
"
|
|
22451
|
-
"
|
|
25722
|
+
" secapi agents personas",
|
|
25723
|
+
" secapi agents prompts list",
|
|
25724
|
+
" secapi agents prompts list --persona law-firm",
|
|
25725
|
+
" secapi agents prompts list --persona investment-manager --json",
|
|
25726
|
+
" secapi agents prompts list --include-v2",
|
|
25727
|
+
" secapi agents prompts read law-firm-enforcement-history",
|
|
25728
|
+
" secapi agents prompts copy investment-manager-factor-decomposition | pbcopy",
|
|
25729
|
+
" secapi api-keys list",
|
|
25730
|
+
" SECAPI_API_KEY=... secapi api-keys list",
|
|
25731
|
+
" SECAPI_OPERATOR_API_KEY=... secapi admin orgs --limit 20",
|
|
25732
|
+
" OMNI_DATASTREAM_API_KEY=... omni-sec api-keys list # compatibility env + binary alias",
|
|
25733
|
+
` printf '%s' "$SECAPI_API_KEY" | secapi api-keys list ${STDIN_FLAG_NAME}`,
|
|
25734
|
+
" secapi usage show",
|
|
25735
|
+
" secapi limits show",
|
|
25736
|
+
" secapi events list --kind event --limit 10",
|
|
25737
|
+
" secapi events export --kind webhook_delivery --format json",
|
|
25738
|
+
" secapi diagnostics request --request-id req_...",
|
|
25739
|
+
" secapi diagnostics deliveries-summary --limit 50",
|
|
25740
|
+
" secapi admin orgs --limit 20",
|
|
25741
|
+
" secapi admin org --org-id org_...",
|
|
25742
|
+
" secapi admin request --org-id org_... --request-id req_...",
|
|
25743
|
+
" secapi admin deliveries-summary --org-id org_... --limit 20",
|
|
25744
|
+
" secapi observability show",
|
|
25745
|
+
" secapi observability export --limit 20",
|
|
25746
|
+
" secapi api-keys create --label local-dev --scopes read:sec,write:artifacts",
|
|
25747
|
+
" secapi webhooks list",
|
|
25748
|
+
" secapi webhooks create --destination-url https://example.com/hooks/sec --event-types artifact.created,artifact.reconciled",
|
|
25749
|
+
" secapi webhooks rotate-secret --webhook-id wh_...",
|
|
25750
|
+
" secapi webhooks deliveries --webhook-id wh_... --limit 10",
|
|
25751
|
+
" secapi webhooks replay-delivery --webhook-id wh_... --delivery-id wdel_...",
|
|
25752
|
+
" secapi streams list",
|
|
25753
|
+
" secapi streams create --event-types artifact.created,artifact.reconciled --transport poll",
|
|
25754
|
+
" secapi streams events --stream-id strm_... --limit 10",
|
|
25755
|
+
" secapi entities resolve --ticker AAPL",
|
|
25756
|
+
" secapi filings search --ticker AAPL --form 10-K",
|
|
25757
|
+
" secapi filings search --q risk factors --form 10-K",
|
|
25758
|
+
" secapi filings latest --ticker AAPL --form 10-K",
|
|
25759
|
+
" secapi filings render --ticker AAPL --form 10-K",
|
|
25760
|
+
" secapi sections search --ticker AAPL --q risk --form 10-K",
|
|
25761
|
+
" secapi sections get --ticker AAPL --form 10-K --section item_1a",
|
|
25762
|
+
' secapi search fulltext --q "supply chain" --form 10-K --limit 10',
|
|
25763
|
+
' secapi search semantic --q "revenue concentration risk" --ticker AAPL --mode hybrid [--view agent]',
|
|
25764
|
+
" secapi facts get --ticker AAPL --tag Assets --form 10-K",
|
|
25765
|
+
" secapi statements get --ticker AAPL --statement balance_sheet --period annual",
|
|
25766
|
+
" secapi owners 13f --cik 0001067983 --limit 25 [--view agent]",
|
|
25767
|
+
" secapi owners compare-13f --cik 0001067983 --limit 25",
|
|
25768
|
+
" secapi insiders list --ticker AAPL --limit 10 [--view agent]",
|
|
25769
|
+
" secapi compensation list --ticker AAPL --limit 10 [--view agent]",
|
|
25770
|
+
" secapi compensation compare --ticker AAPL --limit 10",
|
|
22452
25771
|
"",
|
|
22453
25772
|
" # Agent-mode endpoints (add --view agent for compact shape)",
|
|
22454
|
-
"
|
|
22455
|
-
"
|
|
22456
|
-
"
|
|
22457
|
-
"
|
|
22458
|
-
"
|
|
22459
|
-
"
|
|
22460
|
-
"
|
|
25773
|
+
" secapi forms 144 --ticker AAPL --limit 10 [--view agent]",
|
|
25774
|
+
" secapi offerings list --ticker NVDA --limit 10 [--view agent]",
|
|
25775
|
+
" secapi events ma --ticker MSFT --limit 10 [--view agent]",
|
|
25776
|
+
" secapi events enforcement --query fraud --limit 10 [--view agent]",
|
|
25777
|
+
" secapi events voting-results --ticker MSFT --limit 10 [--view agent]",
|
|
25778
|
+
" secapi funds nport-holdings --ticker VTI --limit 25 [--view agent]",
|
|
25779
|
+
" secapi companies subsidiaries --ticker AAPL [--view agent]",
|
|
22461
25780
|
"",
|
|
22462
25781
|
" # Dilution endpoints — all support --view agent except `coverage`",
|
|
22463
|
-
"
|
|
22464
|
-
"
|
|
22465
|
-
"
|
|
22466
|
-
"
|
|
22467
|
-
"
|
|
22468
|
-
"
|
|
22469
|
-
"
|
|
22470
|
-
"
|
|
22471
|
-
"
|
|
22472
|
-
"
|
|
22473
|
-
"
|
|
22474
|
-
"
|
|
22475
|
-
"
|
|
22476
|
-
"
|
|
22477
|
-
"
|
|
22478
|
-
"
|
|
22479
|
-
"
|
|
22480
|
-
"
|
|
22481
|
-
"
|
|
22482
|
-
"
|
|
25782
|
+
" secapi dilution events --ticker BBBB --is-atm true --limit 10 [--view agent]",
|
|
25783
|
+
" secapi dilution event --event-id evt_... [--view agent]",
|
|
25784
|
+
" secapi dilution warrants --ticker BBBB --limit 10 [--view agent]",
|
|
25785
|
+
" secapi dilution convertibles --ticker BBBB --limit 10 [--view agent]",
|
|
25786
|
+
" secapi dilution rofr --ticker BBBB --limit 10 [--view agent]",
|
|
25787
|
+
" secapi dilution lockups --ticker BBBB --limit 10 [--view agent]",
|
|
25788
|
+
" secapi dilution cash-position --ticker BBBB --limit 5 [--view agent]",
|
|
25789
|
+
" secapi dilution corporate-actions --ticker BBBB --action-type reverse_split [--view agent]",
|
|
25790
|
+
" secapi dilution nasdaq-compliance --status active --limit 10 [--view agent]",
|
|
25791
|
+
" secapi dilution ratings --overall-risk high --limit 10 [--view agent]",
|
|
25792
|
+
" secapi dilution reverse-splits --ticker BBBB --limit 5 [--view agent]",
|
|
25793
|
+
" secapi dilution score --ticker BBBB [--view agent]",
|
|
25794
|
+
" secapi dilution share-float-history --ticker BBBB --limit 12 [--view agent]",
|
|
25795
|
+
" secapi dilution coverage [--ticker BBBB]",
|
|
25796
|
+
" secapi artifacts bundle --ticker AAPL --form 10-K --section item_1a",
|
|
25797
|
+
" secapi artifacts list --kind markdown_bundle --limit 10",
|
|
25798
|
+
" secapi artifacts summary",
|
|
25799
|
+
" secapi artifacts manifest --artifact-id art_...",
|
|
25800
|
+
" secapi artifacts export --artifact-id art_... --format json",
|
|
25801
|
+
" secapi artifacts reconcile --artifact-id art_...",
|
|
22483
25802
|
"",
|
|
22484
25803
|
" # Macro",
|
|
22485
|
-
"
|
|
22486
|
-
"
|
|
22487
|
-
"
|
|
22488
|
-
"
|
|
22489
|
-
"
|
|
22490
|
-
"
|
|
25804
|
+
" secapi macro high-signal-pack --country JP",
|
|
25805
|
+
" secapi macro regimes --country US --lookback 18m",
|
|
25806
|
+
" secapi macro indicators --country US --indicator GDP",
|
|
25807
|
+
" secapi macro releases --country US",
|
|
25808
|
+
" secapi macro calendar --country US --days 30",
|
|
25809
|
+
" secapi macro forecasts --country US",
|
|
22491
25810
|
"",
|
|
22492
25811
|
" # Factors",
|
|
22493
|
-
"
|
|
22494
|
-
"
|
|
22495
|
-
"
|
|
22496
|
-
"
|
|
22497
|
-
"
|
|
22498
|
-
"
|
|
22499
|
-
"
|
|
22500
|
-
"
|
|
22501
|
-
"
|
|
25812
|
+
" secapi factors catalog --category style",
|
|
25813
|
+
" secapi factors returns --keys MOMENTUM,VALUE --window 1m",
|
|
25814
|
+
" secapi factors history --factor VALUE --range 1y --include trust,series",
|
|
25815
|
+
" secapi factors sparklines --keys MOMENTUM,VALUE --range 1y --points 64",
|
|
25816
|
+
" secapi factors returns-intraday --window 1m",
|
|
25817
|
+
" secapi factors dashboard --country US --category style --ticker AAPL",
|
|
25818
|
+
" secapi factors screen --category style --limit 10",
|
|
25819
|
+
" secapi factors extreme-moves --category style --window 1d --min-z-score 2 --limit 10",
|
|
25820
|
+
" secapi factors extreme-pairs --category style --window 1m --min-z-score 1 --limit 10",
|
|
25821
|
+
" secapi factors valuations --category style --signal tailwind --sort opportunity_score --limit 10",
|
|
25822
|
+
" secapi factors valuation-stocks --factor VALUE --stance beneficiaries --limit 25",
|
|
25823
|
+
" secapi factors pairs --factor1 VALUE --factor2 MOMENTUM --window 1m",
|
|
25824
|
+
" secapi factors pair-history --factor1 VALUE --factor2 MOMENTUM --include series",
|
|
25825
|
+
" secapi factors decomposition --ticker AAPL",
|
|
25826
|
+
" secapi factors related-stocks --ticker AAPL --limit 10",
|
|
25827
|
+
" secapi factors similarity-pack --ticker AAPL --limit 10",
|
|
25828
|
+
" secapi factors exposures --symbols AAPL,MSFT --keys QUALITY,MOMENTUM",
|
|
25829
|
+
" secapi factors bulk-download --keys VALUE,MOMENTUM --format csv",
|
|
25830
|
+
` secapi factors custom --body-json '{"symbol":"AAPL","candidates":["MSFT"]}'`,
|
|
25831
|
+
" secapi factors correlations --keys MOMENTUM,VALUE",
|
|
25832
|
+
" secapi factors regime-performance --country US",
|
|
25833
|
+
"",
|
|
25834
|
+
" # Portfolio factor workflows",
|
|
25835
|
+
` secapi portfolio analyze --holdings-json '[{"symbol":"AAPL","weight":0.6},{"symbol":"MSFT","weight":0.4}]'`,
|
|
25836
|
+
" secapi portfolio attribution --holdings-file holdings.json --window 1m --frequency weekly",
|
|
25837
|
+
` secapi portfolio hedge --holdings-file holdings.json --objective min_drawdown --constraints-json '{"maxHedges":2}'`,
|
|
25838
|
+
` secapi portfolio optimize --holdings-file holdings.json --objective regime_aware --constraints-json '{"maxCandidates":3}'`,
|
|
25839
|
+
" secapi portfolio stress-test --holdings-file holdings.json --scenario-key higher_for_longer",
|
|
25840
|
+
"",
|
|
25841
|
+
" # Factor strategies",
|
|
25842
|
+
" secapi strategies factor-rotation --country US --category style --limit 5",
|
|
25843
|
+
" secapi strategies regime-screen --country US --lookback 6m",
|
|
22502
25844
|
"",
|
|
22503
25845
|
" # Stocks",
|
|
22504
|
-
"
|
|
25846
|
+
" secapi stocks loadings --ticker AAPL",
|
|
22505
25847
|
"",
|
|
22506
25848
|
" # Model Portfolios",
|
|
22507
|
-
"
|
|
25849
|
+
" secapi model-portfolios factor-view --portfolio-id us_megacap_platforms",
|
|
25850
|
+
" secapi models factor-analysis --holdings-file holdings.json --label 'AI leaders' --include-optimizer true",
|
|
22508
25851
|
"",
|
|
22509
25852
|
" # Intelligence",
|
|
22510
|
-
"
|
|
22511
|
-
"
|
|
22512
|
-
"
|
|
22513
|
-
"
|
|
25853
|
+
" secapi intelligence security --ticker AAPL",
|
|
25854
|
+
" secapi intelligence company --ticker AAPL",
|
|
25855
|
+
" secapi intelligence earnings-preview --ticker AAPL",
|
|
25856
|
+
" secapi intelligence footnotes-query --ticker AAPL --topics lease,debt_covenant",
|
|
22514
25857
|
"",
|
|
22515
25858
|
" # Companies (canonical financials)",
|
|
22516
|
-
"
|
|
22517
|
-
"
|
|
22518
|
-
"
|
|
22519
|
-
"
|
|
22520
|
-
"
|
|
22521
|
-
"
|
|
22522
|
-
"
|
|
22523
|
-
"
|
|
25859
|
+
" secapi companies financials --ticker AAPL --period annual",
|
|
25860
|
+
" secapi companies ratios --ticker AAPL --period annual",
|
|
25861
|
+
" secapi companies income-statements --ticker AAPL",
|
|
25862
|
+
" secapi companies balance-sheets --ticker AAPL",
|
|
25863
|
+
" secapi companies cash-flow-statements --ticker AAPL",
|
|
25864
|
+
" secapi companies resolve --ticker AAPL",
|
|
25865
|
+
" secapi companies resolve --figi BBG000B9XRY4",
|
|
25866
|
+
" secapi companies search --q Apple --limit 5",
|
|
22524
25867
|
"",
|
|
22525
25868
|
"Environment:",
|
|
22526
|
-
" Preferred: SECAPI_API_KEY, SECAPI_BEARER_TOKEN, SECAPI_BASE_URL, SECAPI_API_BASE_URL, SECAPI_OPERATOR_API_KEY"
|
|
22527
|
-
" Compatibility fallbacks: OMNI_DATASTREAM_API_KEY, OMNI_DATASTREAM_BEARER_TOKEN, OMNI_DATASTREAM_BASE_URL, OMNI_OPERATOR_API_KEY, OMNI_DATASTREAM_OPERATOR_API_KEY"
|
|
25869
|
+
" Preferred: SECAPI_API_KEY, SECAPI_BEARER_TOKEN, SECAPI_BASE_URL, SECAPI_API_BASE_URL, SECAPI_OPERATOR_API_KEY"
|
|
22528
25870
|
];
|
|
22529
|
-
console.log(commandHelpLines.map((line) => line
|
|
25871
|
+
console.log(commandHelpLines.map((line) => line).join(`
|
|
22530
25872
|
`));
|
|
22531
25873
|
}
|
|
22532
25874
|
main().catch((error51) => {
|