@apicity/simplefunctions 0.5.3
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/LICENSE +21 -0
- package/README.md +1166 -0
- package/dist/src/example.d.ts +8 -0
- package/dist/src/example.d.ts.map +1 -0
- package/dist/src/example.js +117 -0
- package/dist/src/example.js.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/simplefunctions.d.ts +3 -0
- package/dist/src/simplefunctions.d.ts.map +1 -0
- package/dist/src/simplefunctions.js +1071 -0
- package/dist/src/simplefunctions.js.map +1 -0
- package/dist/src/types.d.ts +419 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +11 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/zod.d.ts +736 -0
- package/dist/src/zod.d.ts.map +1 -0
- package/dist/src/zod.js +327 -0
- package/dist/src/zod.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,1071 @@
|
|
|
1
|
+
import { attachExamples } from "./example.js";
|
|
2
|
+
import { SimpleFunctionsError } from "./types.js";
|
|
3
|
+
import { SimpleFunctionsAgentFeedRequestSchema, SimpleFunctionsBillRequestSchema, SimpleFunctionsBriefingRequestSchema, SimpleFunctionsCalendarRequestSchema, SimpleFunctionsCalibrationRequestSchema, SimpleFunctionsCandlesRequestSchema, SimpleFunctionsChangesRequestSchema, SimpleFunctionsCongressMemberRequestSchema, SimpleFunctionsCongressMembersRequestSchema, SimpleFunctionsContextRequestSchema, SimpleFunctionsContagionRequestSchema, SimpleFunctionsCrossVenueRequestSchema, SimpleFunctionsDiscussRequestSchema, SimpleFunctionsEconQueryRequestSchema, SimpleFunctionsEdgesRequestSchema, SimpleFunctionsEmptyRequestSchema, SimpleFunctionsFeaturedMarketsRequestSchema, SimpleFunctionsFredRequestSchema, SimpleFunctionsGovQueryRequestSchema, SimpleFunctionsIdeaRequestSchema, SimpleFunctionsIndexHistoryRequestSchema, SimpleFunctionsInspectRequestSchema, SimpleFunctionsLegislationRequestSchema, SimpleFunctionsMarketCandlesRequestSchema, SimpleFunctionsMarketDetailRequestSchema, SimpleFunctionsMarketsRequestSchema, SimpleFunctionsMicrostructureHistoryRequestSchema, SimpleFunctionsMoversRequestSchema, SimpleFunctionsNoRequestSchema, SimpleFunctionsOddsRequestSchema, SimpleFunctionsPublicListRequestSchema, SimpleFunctionsPublicSearchRequestSchema, SimpleFunctionsQueryRequestSchema, SimpleFunctionsRegimeScanRequestSchema, SimpleFunctionsScanRequestSchema, SimpleFunctionsScreenByTickersRequestSchema, SimpleFunctionsScreenRequestSchema, SimpleFunctionsSearchRequestSchema, SimpleFunctionsSlugRequestSchema, SimpleFunctionsTickerRequestSchema, SimpleFunctionsTickerSchema, SimpleFunctionsTradesRequestSchema, SimpleFunctionsWorldDeltaRequestSchema, SimpleFunctionsWorldPathRequestSchema, SimpleFunctionsWorldRequestSchema, SimpleFunctionsYieldCurveRequestSchema, } from "./zod.js";
|
|
4
|
+
function isErrorBody(value) {
|
|
5
|
+
return typeof value === "object" && value !== null;
|
|
6
|
+
}
|
|
7
|
+
function attachAbortHandler(signal, controller) {
|
|
8
|
+
if (signal.aborted) {
|
|
9
|
+
controller.abort();
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
signal.addEventListener("abort", () => controller.abort(), { once: true });
|
|
13
|
+
}
|
|
14
|
+
function formatErrorMessage(status, body) {
|
|
15
|
+
if (isErrorBody(body)) {
|
|
16
|
+
const error = body.error ?? body.message;
|
|
17
|
+
if (error) {
|
|
18
|
+
return `SimpleFunctions API error ${status}: ${error}`;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return `SimpleFunctions API error: ${status}`;
|
|
22
|
+
}
|
|
23
|
+
function createLocalError(status, message) {
|
|
24
|
+
return new SimpleFunctionsError(formatErrorMessage(status, { error: message }), status, {
|
|
25
|
+
error: message,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function parseWithSchema(schema, req) {
|
|
29
|
+
const parsed = schema.safeParse(req);
|
|
30
|
+
if (!parsed.success) {
|
|
31
|
+
const issue = parsed.error.issues[0];
|
|
32
|
+
const message = issue?.message ?? "Invalid SimpleFunctions request";
|
|
33
|
+
throw createLocalError(400, message);
|
|
34
|
+
}
|
|
35
|
+
return parsed.data;
|
|
36
|
+
}
|
|
37
|
+
function parseOptionalWithSchema(schema, req) {
|
|
38
|
+
return parseWithSchema(schema, req ?? {});
|
|
39
|
+
}
|
|
40
|
+
function parseRequest(req, apiKey) {
|
|
41
|
+
const parsed = parseWithSchema(SimpleFunctionsQueryRequestSchema, req);
|
|
42
|
+
if (parsed.model && parsed.model !== "cheap" && !apiKey) {
|
|
43
|
+
throw createLocalError(401, "Custom model tier requires a valid API key. Add header: Authorization: Bearer sf_live_xxx");
|
|
44
|
+
}
|
|
45
|
+
return { ...parsed, q: parsed.q.trim() };
|
|
46
|
+
}
|
|
47
|
+
function requireApiKey(apiKey, endpoint) {
|
|
48
|
+
if (!apiKey) {
|
|
49
|
+
throw createLocalError(401, `${endpoint} requires a valid API key. Add header: Authorization: Bearer sf_live_xxx`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function addQueryParam(qs, key, value) {
|
|
53
|
+
if (value === undefined || value === "")
|
|
54
|
+
return;
|
|
55
|
+
if (Array.isArray(value)) {
|
|
56
|
+
if (value.length > 0)
|
|
57
|
+
qs.set(key, value.join(","));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
qs.set(key, String(value));
|
|
61
|
+
}
|
|
62
|
+
function buildQuery(params) {
|
|
63
|
+
const qs = new URLSearchParams();
|
|
64
|
+
for (const [key, value] of Object.entries(params)) {
|
|
65
|
+
addQueryParam(qs, key, value);
|
|
66
|
+
}
|
|
67
|
+
const query = qs.toString();
|
|
68
|
+
return query ? `?${query}` : "";
|
|
69
|
+
}
|
|
70
|
+
function buildQueryForQuery(req) {
|
|
71
|
+
return buildQuery({
|
|
72
|
+
q: req.q,
|
|
73
|
+
mode: req.mode,
|
|
74
|
+
sources: req.sources,
|
|
75
|
+
limit: req.limit,
|
|
76
|
+
model: req.model,
|
|
77
|
+
depth: req.depth,
|
|
78
|
+
nextActions: req.nextActions,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function pathSegments(path) {
|
|
82
|
+
const rawSegments = Array.isArray(path) ? path : path.split("/");
|
|
83
|
+
return rawSegments.map((segment) => segment.trim()).filter(Boolean);
|
|
84
|
+
}
|
|
85
|
+
function encodePath(path) {
|
|
86
|
+
const segments = pathSegments(path);
|
|
87
|
+
if (segments.length === 0) {
|
|
88
|
+
throw createLocalError(400, "path is required");
|
|
89
|
+
}
|
|
90
|
+
return segments.map((segment) => encodeURIComponent(segment)).join("/");
|
|
91
|
+
}
|
|
92
|
+
function buildListQuery(req) {
|
|
93
|
+
return buildQuery({
|
|
94
|
+
q: req.q,
|
|
95
|
+
category: req.category,
|
|
96
|
+
venue: req.venue,
|
|
97
|
+
limit: req.limit,
|
|
98
|
+
offset: req.offset,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function pathSegment(value) {
|
|
102
|
+
return encodeURIComponent(String(value));
|
|
103
|
+
}
|
|
104
|
+
function parseTicker(ticker) {
|
|
105
|
+
return parseWithSchema(SimpleFunctionsTickerSchema, ticker).trim();
|
|
106
|
+
}
|
|
107
|
+
function trimWorldRequest(req) {
|
|
108
|
+
return {
|
|
109
|
+
...req,
|
|
110
|
+
dt: req.dt?.trim(),
|
|
111
|
+
focus: req.focus?.trim(),
|
|
112
|
+
from: req.from?.trim(),
|
|
113
|
+
item: req.item?.trim(),
|
|
114
|
+
since: req.since?.trim(),
|
|
115
|
+
window: req.window?.trim(),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function parseWorldRequest(req = {}) {
|
|
119
|
+
return trimWorldRequest(parseOptionalWithSchema(SimpleFunctionsWorldRequestSchema, req));
|
|
120
|
+
}
|
|
121
|
+
function parseWorldPathRequest(req) {
|
|
122
|
+
const parsed = parseWithSchema(SimpleFunctionsWorldPathRequestSchema, req);
|
|
123
|
+
return {
|
|
124
|
+
...trimWorldRequest(parsed),
|
|
125
|
+
path: parsed.path,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function parseAgentFeedRequest(req) {
|
|
129
|
+
const parsed = parseWithSchema(SimpleFunctionsAgentFeedRequestSchema, req);
|
|
130
|
+
return {
|
|
131
|
+
...parsed,
|
|
132
|
+
since: parsed.since?.trim(),
|
|
133
|
+
topic: parsed.topic.trim(),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function strictToQueryValue(value) {
|
|
137
|
+
if (value === undefined)
|
|
138
|
+
return undefined;
|
|
139
|
+
if (typeof value === "boolean")
|
|
140
|
+
return value ? "1" : "0";
|
|
141
|
+
return String(value);
|
|
142
|
+
}
|
|
143
|
+
function buildWorldQuery(req) {
|
|
144
|
+
return buildQuery({
|
|
145
|
+
format: req.format,
|
|
146
|
+
compact: req.compact,
|
|
147
|
+
limit: req.limit,
|
|
148
|
+
depth: req.depth,
|
|
149
|
+
since: req.since,
|
|
150
|
+
focus: req.focus,
|
|
151
|
+
op: req.op,
|
|
152
|
+
window: req.window,
|
|
153
|
+
dt: req.dt,
|
|
154
|
+
from: req.from,
|
|
155
|
+
item: req.item,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function buildWorldDeltaQuery(req) {
|
|
159
|
+
return buildQuery({
|
|
160
|
+
since: req.since,
|
|
161
|
+
format: req.format,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function buildInspectQuery(req) {
|
|
165
|
+
return buildQuery({
|
|
166
|
+
format: req.format,
|
|
167
|
+
contagion: req.contagion,
|
|
168
|
+
diff: req.diff,
|
|
169
|
+
trend: req.trend,
|
|
170
|
+
nextActions: req.nextActions,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function buildAgentFeedQuery(req) {
|
|
174
|
+
return buildQuery({
|
|
175
|
+
since: req.since,
|
|
176
|
+
limit: req.limit,
|
|
177
|
+
format: req.format,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function wantsJson(format, defaultJson) {
|
|
181
|
+
return format === "json" || (format === undefined && defaultJson);
|
|
182
|
+
}
|
|
183
|
+
export function createSimpleFunctions(opts = {}) {
|
|
184
|
+
const baseURL = (opts.baseURL ?? "https://simplefunctions.dev").replace(/\/+$/, "");
|
|
185
|
+
const dataBaseURL = (opts.dataBaseURL ?? "https://data.simplefunctions.dev").replace(/\/+$/, "");
|
|
186
|
+
const doFetch = opts.fetch ?? fetch;
|
|
187
|
+
const timeout = opts.timeout ?? 30000;
|
|
188
|
+
async function makeJsonRequest(method, path, body, signal, requestBaseURL = baseURL) {
|
|
189
|
+
const controller = new AbortController();
|
|
190
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
191
|
+
if (signal) {
|
|
192
|
+
attachAbortHandler(signal, controller);
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
const headers = {};
|
|
196
|
+
if (opts.apiKey) {
|
|
197
|
+
headers.Authorization = `Bearer ${opts.apiKey}`;
|
|
198
|
+
}
|
|
199
|
+
const init = {
|
|
200
|
+
method,
|
|
201
|
+
headers,
|
|
202
|
+
signal: controller.signal,
|
|
203
|
+
};
|
|
204
|
+
if (body !== undefined) {
|
|
205
|
+
headers["Content-Type"] = "application/json";
|
|
206
|
+
init.body = JSON.stringify(body);
|
|
207
|
+
}
|
|
208
|
+
const res = await doFetch(`${requestBaseURL}${path}`, init);
|
|
209
|
+
clearTimeout(timeoutId);
|
|
210
|
+
if (!res.ok) {
|
|
211
|
+
let resBody = null;
|
|
212
|
+
try {
|
|
213
|
+
resBody = await res.json();
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
// ignore parse errors
|
|
217
|
+
}
|
|
218
|
+
throw new SimpleFunctionsError(formatErrorMessage(res.status, resBody), res.status, resBody);
|
|
219
|
+
}
|
|
220
|
+
return (await res.json());
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
clearTimeout(timeoutId);
|
|
224
|
+
if (error instanceof SimpleFunctionsError)
|
|
225
|
+
throw error;
|
|
226
|
+
throw new SimpleFunctionsError(`SimpleFunctions request failed: ${error}`, 500);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
async function makeGetTextRequest(path, signal, requestBaseURL = baseURL) {
|
|
230
|
+
const controller = new AbortController();
|
|
231
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
232
|
+
if (signal) {
|
|
233
|
+
attachAbortHandler(signal, controller);
|
|
234
|
+
}
|
|
235
|
+
try {
|
|
236
|
+
const headers = {};
|
|
237
|
+
if (opts.apiKey) {
|
|
238
|
+
headers.Authorization = `Bearer ${opts.apiKey}`;
|
|
239
|
+
}
|
|
240
|
+
const res = await doFetch(`${requestBaseURL}${path}`, {
|
|
241
|
+
method: "GET",
|
|
242
|
+
headers,
|
|
243
|
+
signal: controller.signal,
|
|
244
|
+
});
|
|
245
|
+
clearTimeout(timeoutId);
|
|
246
|
+
if (!res.ok) {
|
|
247
|
+
let resBody = null;
|
|
248
|
+
try {
|
|
249
|
+
resBody = await res.json();
|
|
250
|
+
}
|
|
251
|
+
catch {
|
|
252
|
+
// ignore parse errors
|
|
253
|
+
}
|
|
254
|
+
throw new SimpleFunctionsError(formatErrorMessage(res.status, resBody), res.status, resBody);
|
|
255
|
+
}
|
|
256
|
+
return await res.text();
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
clearTimeout(timeoutId);
|
|
260
|
+
if (error instanceof SimpleFunctionsError)
|
|
261
|
+
throw error;
|
|
262
|
+
throw new SimpleFunctionsError(`SimpleFunctions request failed: ${error}`, 500);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
// GET https://simplefunctions.dev/api/public/query{query}
|
|
266
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/query
|
|
267
|
+
const query = Object.assign(async (req, signal) => {
|
|
268
|
+
const parsed = parseRequest(req, opts.apiKey);
|
|
269
|
+
const query = buildQueryForQuery(parsed);
|
|
270
|
+
return makeJsonRequest("GET", `/api/public/query${query}`, undefined, signal);
|
|
271
|
+
}, { schema: SimpleFunctionsQueryRequestSchema });
|
|
272
|
+
// GET https://simplefunctions.dev/api/agent/world/delta{query}
|
|
273
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/world-state
|
|
274
|
+
const worldDelta = Object.assign(async (req, signal) => {
|
|
275
|
+
const parsed = parseWithSchema(SimpleFunctionsWorldDeltaRequestSchema, req);
|
|
276
|
+
const query = buildWorldDeltaQuery({
|
|
277
|
+
...parsed,
|
|
278
|
+
since: parsed.since.trim(),
|
|
279
|
+
});
|
|
280
|
+
if (wantsJson(parsed.format, false)) {
|
|
281
|
+
return makeJsonRequest("GET", `/api/agent/world/delta${query}`, undefined, signal);
|
|
282
|
+
}
|
|
283
|
+
return makeGetTextRequest(`/api/agent/world/delta${query}`, signal);
|
|
284
|
+
}, { schema: SimpleFunctionsWorldDeltaRequestSchema });
|
|
285
|
+
// GET https://simplefunctions.dev/api/agent/world/feed
|
|
286
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/world-state
|
|
287
|
+
const worldFeed = Object.assign(async (signal) => {
|
|
288
|
+
return makeGetTextRequest("/api/agent/world/feed", signal);
|
|
289
|
+
}, { schema: SimpleFunctionsNoRequestSchema });
|
|
290
|
+
// sig-ok: path helper represents the catch-all /world/{...path} route.
|
|
291
|
+
// GET https://simplefunctions.dev/api/agent/world/{path}{query}
|
|
292
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/world-state
|
|
293
|
+
const worldPath = Object.assign(async (req, signal) => {
|
|
294
|
+
const parsed = parseWorldPathRequest(req);
|
|
295
|
+
const query = buildWorldQuery(parsed);
|
|
296
|
+
const path = encodePath(parsed.path);
|
|
297
|
+
if (wantsJson(parsed.format, false)) {
|
|
298
|
+
return makeJsonRequest("GET", `/api/agent/world/${path}${query}`, undefined, signal);
|
|
299
|
+
}
|
|
300
|
+
return makeGetTextRequest(`/api/agent/world/${path}${query}`, signal);
|
|
301
|
+
}, { schema: SimpleFunctionsWorldPathRequestSchema });
|
|
302
|
+
// GET https://simplefunctions.dev/api/agent/world{query}
|
|
303
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/world-state
|
|
304
|
+
const world = Object.assign(async (req = {}, signal) => {
|
|
305
|
+
const parsed = parseWorldRequest(req);
|
|
306
|
+
const query = buildWorldQuery(parsed);
|
|
307
|
+
if (wantsJson(parsed.format, false)) {
|
|
308
|
+
return makeJsonRequest("GET", `/api/agent/world${query}`, undefined, signal);
|
|
309
|
+
}
|
|
310
|
+
return makeGetTextRequest(`/api/agent/world${query}`, signal);
|
|
311
|
+
}, {
|
|
312
|
+
schema: SimpleFunctionsWorldRequestSchema,
|
|
313
|
+
delta: worldDelta,
|
|
314
|
+
feed: worldFeed,
|
|
315
|
+
path: worldPath,
|
|
316
|
+
});
|
|
317
|
+
// GET https://simplefunctions.dev/api/agent/inspect/{ticker}{query}
|
|
318
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/agent
|
|
319
|
+
const inspect = Object.assign(async (req, signal) => {
|
|
320
|
+
const parsed = parseWithSchema(SimpleFunctionsInspectRequestSchema, req);
|
|
321
|
+
const query = buildInspectQuery(parsed);
|
|
322
|
+
const ticker = pathSegment(parsed.ticker.trim());
|
|
323
|
+
if (wantsJson(parsed.format, true)) {
|
|
324
|
+
return makeJsonRequest("GET", `/api/agent/inspect/${ticker}${query}`, undefined, signal);
|
|
325
|
+
}
|
|
326
|
+
return makeGetTextRequest(`/api/agent/inspect/${ticker}${query}`, signal);
|
|
327
|
+
}, { schema: SimpleFunctionsInspectRequestSchema });
|
|
328
|
+
// GET https://simplefunctions.dev/api/agent/feed/{topic}{query}
|
|
329
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/agent
|
|
330
|
+
const agentFeed = Object.assign(async (req, signal) => {
|
|
331
|
+
const parsed = parseAgentFeedRequest(req);
|
|
332
|
+
const query = buildAgentFeedQuery(parsed);
|
|
333
|
+
const topic = parsed.topic;
|
|
334
|
+
if (wantsJson(parsed.format, false)) {
|
|
335
|
+
return makeJsonRequest("GET", `/api/agent/feed/${encodeURIComponent(topic)}${query}`, undefined, signal);
|
|
336
|
+
}
|
|
337
|
+
return makeGetTextRequest(`/api/agent/feed/${encodeURIComponent(topic)}${query}`, signal);
|
|
338
|
+
}, { schema: SimpleFunctionsAgentFeedRequestSchema });
|
|
339
|
+
// GET https://data.simplefunctions.dev/v1/heartbeat
|
|
340
|
+
// Docs: https://docs.simplefunctions.dev/reference/realtime-data
|
|
341
|
+
const heartbeat = Object.assign(async (signal) => {
|
|
342
|
+
return makeJsonRequest("GET", "/v1/heartbeat", undefined, signal, dataBaseURL);
|
|
343
|
+
}, { schema: SimpleFunctionsNoRequestSchema });
|
|
344
|
+
// GET https://data.simplefunctions.dev/v1/markets{query}
|
|
345
|
+
// Docs: https://docs.simplefunctions.dev/reference/realtime-data
|
|
346
|
+
const dataMarketsList = Object.assign(async (req = {}, signal) => {
|
|
347
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsMarketsRequestSchema, req);
|
|
348
|
+
const query = buildQuery({
|
|
349
|
+
q: parsed.q?.trim(),
|
|
350
|
+
venue: parsed.venue,
|
|
351
|
+
});
|
|
352
|
+
return makeJsonRequest("GET", `/v1/markets${query}`, undefined, signal, dataBaseURL);
|
|
353
|
+
}, { schema: SimpleFunctionsMarketsRequestSchema });
|
|
354
|
+
// GET https://data.simplefunctions.dev/v1/markets/featured{query}
|
|
355
|
+
// Docs: https://docs.simplefunctions.dev/reference/realtime-data
|
|
356
|
+
const featured = Object.assign(async (req = {}, signal) => {
|
|
357
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsFeaturedMarketsRequestSchema, req);
|
|
358
|
+
const query = buildQuery({
|
|
359
|
+
n: parsed.n,
|
|
360
|
+
});
|
|
361
|
+
return makeJsonRequest("GET", `/v1/markets/featured${query}`, undefined, signal, dataBaseURL);
|
|
362
|
+
}, { schema: SimpleFunctionsFeaturedMarketsRequestSchema });
|
|
363
|
+
// GET https://data.simplefunctions.dev/v1/markets/{ticker}
|
|
364
|
+
// Docs: https://docs.simplefunctions.dev/reference/realtime-data
|
|
365
|
+
const marketRetrieve = Object.assign(async (ticker, signal) => {
|
|
366
|
+
ticker = parseTicker(ticker);
|
|
367
|
+
return makeJsonRequest("GET", `/v1/markets/${encodeURIComponent(ticker)}`, undefined, signal, dataBaseURL);
|
|
368
|
+
}, { schema: SimpleFunctionsTickerSchema });
|
|
369
|
+
const dataMarkets = Object.assign(dataMarketsList, {
|
|
370
|
+
featured,
|
|
371
|
+
retrieve: marketRetrieve,
|
|
372
|
+
});
|
|
373
|
+
// GET https://data.simplefunctions.dev/v1/search{query}
|
|
374
|
+
// Docs: https://docs.simplefunctions.dev/reference/realtime-data
|
|
375
|
+
const dataSearch = Object.assign(async (req, signal) => {
|
|
376
|
+
const parsed = parseWithSchema(SimpleFunctionsSearchRequestSchema, req);
|
|
377
|
+
const query = buildQuery({
|
|
378
|
+
q: parsed.q.trim(),
|
|
379
|
+
limit: parsed.limit,
|
|
380
|
+
venue: parsed.venue,
|
|
381
|
+
strict: strictToQueryValue(parsed.strict),
|
|
382
|
+
});
|
|
383
|
+
return makeJsonRequest("GET", `/v1/search${query}`, undefined, signal, dataBaseURL);
|
|
384
|
+
}, { schema: SimpleFunctionsSearchRequestSchema });
|
|
385
|
+
// GET https://data.simplefunctions.dev/v1/snapshot
|
|
386
|
+
// Docs: https://docs.simplefunctions.dev/reference/realtime-data
|
|
387
|
+
const snapshot = Object.assign(async (signal) => {
|
|
388
|
+
return makeJsonRequest("GET", "/v1/snapshot", undefined, signal, dataBaseURL);
|
|
389
|
+
}, { schema: SimpleFunctionsNoRequestSchema });
|
|
390
|
+
// GET https://data.simplefunctions.dev/v1/movers{query}
|
|
391
|
+
// Docs: https://docs.simplefunctions.dev/reference/realtime-data
|
|
392
|
+
const movers = Object.assign(async (req = {}, signal) => {
|
|
393
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsMoversRequestSchema, req);
|
|
394
|
+
const query = buildQuery({
|
|
395
|
+
window: parsed.window,
|
|
396
|
+
n: parsed.n,
|
|
397
|
+
minVol: parsed.minVol,
|
|
398
|
+
dir: parsed.dir,
|
|
399
|
+
});
|
|
400
|
+
return makeJsonRequest("GET", `/v1/movers${query}`, undefined, signal, dataBaseURL);
|
|
401
|
+
}, { schema: SimpleFunctionsMoversRequestSchema });
|
|
402
|
+
// GET https://data.simplefunctions.dev/v1/orderbook/{ticker}
|
|
403
|
+
// Docs: https://docs.simplefunctions.dev/reference/realtime-data
|
|
404
|
+
const orderbook = Object.assign(async (ticker, signal) => {
|
|
405
|
+
ticker = parseTicker(ticker);
|
|
406
|
+
return makeJsonRequest("GET", `/v1/orderbook/${encodeURIComponent(ticker)}`, undefined, signal, dataBaseURL);
|
|
407
|
+
}, { schema: SimpleFunctionsTickerSchema });
|
|
408
|
+
// GET https://data.simplefunctions.dev/v1/candles/{ticker}{query}
|
|
409
|
+
// Docs: https://docs.simplefunctions.dev/reference/realtime-data
|
|
410
|
+
const candles = Object.assign(async (ticker, req = {}, signal) => {
|
|
411
|
+
ticker = parseTicker(ticker);
|
|
412
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsCandlesRequestSchema, req);
|
|
413
|
+
const query = buildQuery({
|
|
414
|
+
tf: parsed.tf,
|
|
415
|
+
limit: parsed.limit,
|
|
416
|
+
});
|
|
417
|
+
return makeJsonRequest("GET", `/v1/candles/${encodeURIComponent(ticker)}${query}`, undefined, signal, dataBaseURL);
|
|
418
|
+
}, { schema: SimpleFunctionsCandlesRequestSchema });
|
|
419
|
+
// GET https://data.simplefunctions.dev/v1/trades/{ticker}{query}
|
|
420
|
+
// Docs: https://docs.simplefunctions.dev/reference/realtime-data
|
|
421
|
+
const trades = Object.assign(async (ticker, req = {}, signal) => {
|
|
422
|
+
ticker = parseTicker(ticker);
|
|
423
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsTradesRequestSchema, req);
|
|
424
|
+
const query = buildQuery({
|
|
425
|
+
limit: parsed.limit,
|
|
426
|
+
});
|
|
427
|
+
return makeJsonRequest("GET", `/v1/trades/${encodeURIComponent(ticker)}${query}`, undefined, signal, dataBaseURL);
|
|
428
|
+
}, { schema: SimpleFunctionsTradesRequestSchema });
|
|
429
|
+
// GET https://simplefunctions.dev/api/public/market/{ticker}{query}
|
|
430
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/market-detail
|
|
431
|
+
const marketDetail = Object.assign(async (req, signal) => {
|
|
432
|
+
const parsed = parseWithSchema(SimpleFunctionsMarketDetailRequestSchema, req);
|
|
433
|
+
if (parsed.refresh) {
|
|
434
|
+
requireApiKey(opts.apiKey, "refresh=true");
|
|
435
|
+
}
|
|
436
|
+
const ticker = pathSegment(parsed.ticker);
|
|
437
|
+
const query = buildQuery({
|
|
438
|
+
depth: parsed.depth,
|
|
439
|
+
refresh: parsed.refresh,
|
|
440
|
+
cv_preset: parsed.cvPreset,
|
|
441
|
+
cv_min_conf: parsed.cvMinConf,
|
|
442
|
+
cv_max_dt_days: parsed.cvMaxDtDays,
|
|
443
|
+
nextActions: parsed.nextActions,
|
|
444
|
+
});
|
|
445
|
+
return makeJsonRequest("GET", `/api/public/market/${ticker}${query}`, undefined, signal);
|
|
446
|
+
}, { schema: SimpleFunctionsMarketDetailRequestSchema });
|
|
447
|
+
// GET https://simplefunctions.dev/api/public/market/{ticker}/history
|
|
448
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/market-detail
|
|
449
|
+
const marketHistory = Object.assign(async (req, signal) => {
|
|
450
|
+
const parsed = parseWithSchema(SimpleFunctionsTickerRequestSchema, req);
|
|
451
|
+
const ticker = pathSegment(parsed.ticker);
|
|
452
|
+
return makeJsonRequest("GET", `/api/public/market/${ticker}/history`, undefined, signal);
|
|
453
|
+
}, { schema: SimpleFunctionsTickerRequestSchema });
|
|
454
|
+
// GET https://simplefunctions.dev/api/public/market/{ticker}/candles{query}
|
|
455
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
456
|
+
const marketCandles = Object.assign(async (req, signal) => {
|
|
457
|
+
const parsed = parseWithSchema(SimpleFunctionsMarketCandlesRequestSchema, req);
|
|
458
|
+
const ticker = pathSegment(parsed.ticker);
|
|
459
|
+
const query = buildQuery({
|
|
460
|
+
venue: parsed.venue,
|
|
461
|
+
timeframe: parsed.timeframe,
|
|
462
|
+
tf: parsed.tf,
|
|
463
|
+
limit: parsed.limit,
|
|
464
|
+
});
|
|
465
|
+
return makeJsonRequest("GET", `/api/public/market/${ticker}/candles${query}`, undefined, signal);
|
|
466
|
+
}, { schema: SimpleFunctionsMarketCandlesRequestSchema });
|
|
467
|
+
const market = Object.assign(marketDetail, {
|
|
468
|
+
history: marketHistory,
|
|
469
|
+
candles: marketCandles,
|
|
470
|
+
});
|
|
471
|
+
// GET https://simplefunctions.dev/api/public/markets{query}
|
|
472
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
473
|
+
const markets = Object.assign(async (req = {}, signal) => {
|
|
474
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsPublicListRequestSchema, req);
|
|
475
|
+
const query = buildListQuery(parsed);
|
|
476
|
+
return makeJsonRequest("GET", `/api/public/markets${query}`, undefined, signal);
|
|
477
|
+
}, { schema: SimpleFunctionsPublicListRequestSchema });
|
|
478
|
+
// GET https://simplefunctions.dev/api/public/newmarkets{query}
|
|
479
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
480
|
+
const newmarkets = Object.assign(async (req = {}, signal) => {
|
|
481
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsPublicListRequestSchema, req);
|
|
482
|
+
const query = buildListQuery(parsed);
|
|
483
|
+
return makeJsonRequest("GET", `/api/public/newmarkets${query}`, undefined, signal);
|
|
484
|
+
}, { schema: SimpleFunctionsPublicListRequestSchema });
|
|
485
|
+
// GET https://simplefunctions.dev/api/public/scan{query}
|
|
486
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
487
|
+
const scan = Object.assign(async (req = {}, signal) => {
|
|
488
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsScanRequestSchema, req);
|
|
489
|
+
const query = buildQuery({
|
|
490
|
+
q: parsed.q,
|
|
491
|
+
mode: parsed.mode,
|
|
492
|
+
series: parsed.series,
|
|
493
|
+
market: parsed.market,
|
|
494
|
+
limit: parsed.limit,
|
|
495
|
+
});
|
|
496
|
+
return makeJsonRequest("GET", `/api/public/scan${query}`, undefined, signal);
|
|
497
|
+
}, { schema: SimpleFunctionsScanRequestSchema });
|
|
498
|
+
// GET https://simplefunctions.dev/api/public/screen{query}
|
|
499
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
500
|
+
const screen = Object.assign(async (req = {}, signal) => {
|
|
501
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsScreenRequestSchema, req);
|
|
502
|
+
const query = buildQuery({
|
|
503
|
+
venue: parsed.venue,
|
|
504
|
+
category: parsed.category,
|
|
505
|
+
minPrice: parsed.minPrice,
|
|
506
|
+
maxPrice: parsed.maxPrice,
|
|
507
|
+
minVolume: parsed.minVolume,
|
|
508
|
+
limit: parsed.limit,
|
|
509
|
+
});
|
|
510
|
+
return makeJsonRequest("GET", `/api/public/screen${query}`, undefined, signal);
|
|
511
|
+
}, { schema: SimpleFunctionsScreenRequestSchema });
|
|
512
|
+
// GET https://simplefunctions.dev/api/public/screen-by-tickers{query}
|
|
513
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
514
|
+
const screenByTickers = Object.assign(async (req, signal) => {
|
|
515
|
+
const parsed = parseWithSchema(SimpleFunctionsScreenByTickersRequestSchema, req);
|
|
516
|
+
const query = buildQuery({
|
|
517
|
+
tickers: parsed.tickers,
|
|
518
|
+
venue: parsed.venue,
|
|
519
|
+
minVolume: parsed.minVolume,
|
|
520
|
+
});
|
|
521
|
+
return makeJsonRequest("GET", `/api/public/screen-by-tickers${query}`, undefined, signal);
|
|
522
|
+
}, { schema: SimpleFunctionsScreenByTickersRequestSchema });
|
|
523
|
+
// GET https://simplefunctions.dev/api/public/search{query}
|
|
524
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
525
|
+
const search = Object.assign(async (req, signal) => {
|
|
526
|
+
const parsed = parseWithSchema(SimpleFunctionsPublicSearchRequestSchema, req);
|
|
527
|
+
const query = buildQuery({
|
|
528
|
+
q: parsed.q.trim(),
|
|
529
|
+
limit: parsed.limit,
|
|
530
|
+
});
|
|
531
|
+
return makeJsonRequest("GET", `/api/public/search${query}`, undefined, signal);
|
|
532
|
+
}, { schema: SimpleFunctionsPublicSearchRequestSchema });
|
|
533
|
+
// GET https://simplefunctions.dev/api/public/live-tickers{query}
|
|
534
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
535
|
+
const liveTickers = Object.assign(async (req = {}, signal) => {
|
|
536
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsPublicListRequestSchema, req);
|
|
537
|
+
const query = buildListQuery(parsed);
|
|
538
|
+
return makeJsonRequest("GET", `/api/public/live-tickers${query}`, undefined, signal);
|
|
539
|
+
}, { schema: SimpleFunctionsPublicListRequestSchema });
|
|
540
|
+
// GET https://simplefunctions.dev/api/public/market-microstructure-history{query}
|
|
541
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
542
|
+
const marketMicrostructureHistory = Object.assign(async (req, signal) => {
|
|
543
|
+
const parsed = parseWithSchema(SimpleFunctionsMicrostructureHistoryRequestSchema, req);
|
|
544
|
+
const query = buildQuery({
|
|
545
|
+
ticker: parsed.ticker,
|
|
546
|
+
venue: parsed.venue,
|
|
547
|
+
days: parsed.days,
|
|
548
|
+
limit: parsed.limit,
|
|
549
|
+
});
|
|
550
|
+
return makeJsonRequest("GET", `/api/public/market-microstructure-history${query}`, undefined, signal);
|
|
551
|
+
}, { schema: SimpleFunctionsMicrostructureHistoryRequestSchema });
|
|
552
|
+
// GET https://simplefunctions.dev/api/public/cross-venue/pairs{query}
|
|
553
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
554
|
+
const crossVenuePairs = Object.assign(async (req = {}, signal) => {
|
|
555
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsCrossVenueRequestSchema, req);
|
|
556
|
+
const query = buildQuery({
|
|
557
|
+
venue: parsed.venue,
|
|
558
|
+
minConfidence: parsed.minConfidence,
|
|
559
|
+
limit: parsed.limit,
|
|
560
|
+
});
|
|
561
|
+
return makeJsonRequest("GET", `/api/public/cross-venue/pairs${query}`, undefined, signal);
|
|
562
|
+
}, { schema: SimpleFunctionsCrossVenueRequestSchema });
|
|
563
|
+
// GET https://simplefunctions.dev/api/public/cross-venue/stats{query}
|
|
564
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
565
|
+
const crossVenueStats = Object.assign(async (req = {}, signal) => {
|
|
566
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsCrossVenueRequestSchema, req);
|
|
567
|
+
const query = buildQuery({
|
|
568
|
+
venue: parsed.venue,
|
|
569
|
+
minConfidence: parsed.minConfidence,
|
|
570
|
+
limit: parsed.limit,
|
|
571
|
+
});
|
|
572
|
+
return makeJsonRequest("GET", `/api/public/cross-venue/stats${query}`, undefined, signal);
|
|
573
|
+
}, { schema: SimpleFunctionsCrossVenueRequestSchema });
|
|
574
|
+
// GET https://simplefunctions.dev/api/public/index
|
|
575
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/index-regime
|
|
576
|
+
const indexCurrent = Object.assign(async (req = {}, signal) => {
|
|
577
|
+
parseOptionalWithSchema(SimpleFunctionsEmptyRequestSchema, req);
|
|
578
|
+
return makeJsonRequest("GET", "/api/public/index", undefined, signal);
|
|
579
|
+
}, { schema: SimpleFunctionsEmptyRequestSchema });
|
|
580
|
+
// GET https://simplefunctions.dev/api/public/index/history{query}
|
|
581
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/index-regime
|
|
582
|
+
const indexHistory = Object.assign(async (req = {}, signal) => {
|
|
583
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsIndexHistoryRequestSchema, req);
|
|
584
|
+
const query = buildQuery({
|
|
585
|
+
days: parsed.days,
|
|
586
|
+
theme: parsed.theme,
|
|
587
|
+
});
|
|
588
|
+
return makeJsonRequest("GET", `/api/public/index/history${query}`, undefined, signal);
|
|
589
|
+
}, { schema: SimpleFunctionsIndexHistoryRequestSchema });
|
|
590
|
+
const index = Object.assign(indexCurrent, {
|
|
591
|
+
history: indexHistory,
|
|
592
|
+
});
|
|
593
|
+
// GET https://simplefunctions.dev/api/public/regime/scan{query}
|
|
594
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/index-regime
|
|
595
|
+
const regimeScan = Object.assign(async (req = {}, signal) => {
|
|
596
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsRegimeScanRequestSchema, req);
|
|
597
|
+
const query = buildQuery({
|
|
598
|
+
label: parsed.label,
|
|
599
|
+
venue: parsed.venue,
|
|
600
|
+
limit: parsed.limit,
|
|
601
|
+
});
|
|
602
|
+
return makeJsonRequest("GET", `/api/public/regime/scan${query}`, undefined, signal);
|
|
603
|
+
}, { schema: SimpleFunctionsRegimeScanRequestSchema });
|
|
604
|
+
// GET https://simplefunctions.dev/api/public/odds{query}
|
|
605
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
606
|
+
const odds = Object.assign(async (req = {}, signal) => {
|
|
607
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsOddsRequestSchema, req);
|
|
608
|
+
const query = buildQuery({
|
|
609
|
+
category: parsed.category,
|
|
610
|
+
band: parsed.band,
|
|
611
|
+
limit: parsed.limit,
|
|
612
|
+
});
|
|
613
|
+
return makeJsonRequest("GET", `/api/public/odds${query}`, undefined, signal);
|
|
614
|
+
}, { schema: SimpleFunctionsOddsRequestSchema });
|
|
615
|
+
// sig-ok: Markdown filename endpoint uses oddsMd as a JS-safe method name.
|
|
616
|
+
// GET https://simplefunctions.dev/api/public/odds.md{query}
|
|
617
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
618
|
+
const oddsMd = Object.assign(async (req = {}, signal) => {
|
|
619
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsOddsRequestSchema, req);
|
|
620
|
+
const query = buildQuery({
|
|
621
|
+
category: parsed.category,
|
|
622
|
+
band: parsed.band,
|
|
623
|
+
limit: parsed.limit,
|
|
624
|
+
});
|
|
625
|
+
return makeGetTextRequest(`/api/public/odds.md${query}`, signal);
|
|
626
|
+
}, { schema: SimpleFunctionsOddsRequestSchema });
|
|
627
|
+
// GET https://simplefunctions.dev/api/public/calendar{query}
|
|
628
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/index-regime
|
|
629
|
+
const calendar = Object.assign(async (req = {}, signal) => {
|
|
630
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsCalendarRequestSchema, req);
|
|
631
|
+
const query = buildQuery({
|
|
632
|
+
from: parsed.from,
|
|
633
|
+
to: parsed.to,
|
|
634
|
+
category: parsed.category,
|
|
635
|
+
limit: parsed.limit,
|
|
636
|
+
});
|
|
637
|
+
return makeJsonRequest("GET", `/api/public/calendar${query}`, undefined, signal);
|
|
638
|
+
}, { schema: SimpleFunctionsCalendarRequestSchema });
|
|
639
|
+
// GET https://simplefunctions.dev/api/public/yield-curves
|
|
640
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
641
|
+
const yieldCurvesList = Object.assign(async (req = {}, signal) => {
|
|
642
|
+
parseOptionalWithSchema(SimpleFunctionsEmptyRequestSchema, req);
|
|
643
|
+
return makeJsonRequest("GET", "/api/public/yield-curves", undefined, signal);
|
|
644
|
+
}, { schema: SimpleFunctionsEmptyRequestSchema });
|
|
645
|
+
// sig-ok: detail endpoint hangs off the yieldCurves collection.
|
|
646
|
+
// GET https://simplefunctions.dev/api/public/yield-curves/{event}
|
|
647
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
648
|
+
const yieldCurveEvent = Object.assign(async (req, signal) => {
|
|
649
|
+
const parsed = parseWithSchema(SimpleFunctionsYieldCurveRequestSchema, req);
|
|
650
|
+
const event = pathSegment(parsed.event);
|
|
651
|
+
return makeJsonRequest("GET", `/api/public/yield-curves/${event}`, undefined, signal);
|
|
652
|
+
}, { schema: SimpleFunctionsYieldCurveRequestSchema });
|
|
653
|
+
const yieldCurves = Object.assign(yieldCurvesList, {
|
|
654
|
+
event: yieldCurveEvent,
|
|
655
|
+
});
|
|
656
|
+
// GET https://simplefunctions.dev/api/public/liquidity-by-theme{query}
|
|
657
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
658
|
+
const liquidityByTheme = Object.assign(async (req = {}, signal) => {
|
|
659
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsPublicListRequestSchema, req);
|
|
660
|
+
const query = buildListQuery(parsed);
|
|
661
|
+
return makeJsonRequest("GET", `/api/public/liquidity-by-theme${query}`, undefined, signal);
|
|
662
|
+
}, { schema: SimpleFunctionsPublicListRequestSchema });
|
|
663
|
+
// GET https://simplefunctions.dev/api/public/contagion{query}
|
|
664
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
665
|
+
const contagion = Object.assign(async (req = {}, signal) => {
|
|
666
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsContagionRequestSchema, req);
|
|
667
|
+
const query = buildQuery({
|
|
668
|
+
ticker: parsed.ticker,
|
|
669
|
+
window: parsed.window,
|
|
670
|
+
limit: parsed.limit,
|
|
671
|
+
});
|
|
672
|
+
return makeJsonRequest("GET", `/api/public/contagion${query}`, undefined, signal);
|
|
673
|
+
}, { schema: SimpleFunctionsContagionRequestSchema });
|
|
674
|
+
// GET https://simplefunctions.dev/api/public/query-gov{query}
|
|
675
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/gov-econ
|
|
676
|
+
const queryGov = Object.assign(async (req, signal) => {
|
|
677
|
+
const parsed = parseWithSchema(SimpleFunctionsGovQueryRequestSchema, req);
|
|
678
|
+
const query = buildQuery({
|
|
679
|
+
q: parsed.q.trim(),
|
|
680
|
+
mode: parsed.mode,
|
|
681
|
+
sources: parsed.sources,
|
|
682
|
+
limit: parsed.limit,
|
|
683
|
+
depth: parsed.depth,
|
|
684
|
+
});
|
|
685
|
+
return makeJsonRequest("GET", `/api/public/query-gov${query}`, undefined, signal);
|
|
686
|
+
}, { schema: SimpleFunctionsGovQueryRequestSchema });
|
|
687
|
+
// GET https://simplefunctions.dev/api/public/legislation{query}
|
|
688
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/gov-econ
|
|
689
|
+
const legislationList = Object.assign(async (req = {}, signal) => {
|
|
690
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsLegislationRequestSchema, req);
|
|
691
|
+
const query = buildQuery({
|
|
692
|
+
q: parsed.q,
|
|
693
|
+
congress: parsed.congress,
|
|
694
|
+
type: parsed.type,
|
|
695
|
+
limit: parsed.limit,
|
|
696
|
+
});
|
|
697
|
+
return makeJsonRequest("GET", `/api/public/legislation${query}`, undefined, signal);
|
|
698
|
+
}, { schema: SimpleFunctionsLegislationRequestSchema });
|
|
699
|
+
// sig-ok: detail endpoint hangs off the legislation collection.
|
|
700
|
+
// GET https://simplefunctions.dev/api/public/legislation/{billId}
|
|
701
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/gov-econ
|
|
702
|
+
const legislationByBillId = Object.assign(async (req, signal) => {
|
|
703
|
+
const parsed = parseWithSchema(SimpleFunctionsBillRequestSchema, req);
|
|
704
|
+
const billId = pathSegment(parsed.billId);
|
|
705
|
+
return makeJsonRequest("GET", `/api/public/legislation/${billId}`, undefined, signal);
|
|
706
|
+
}, { schema: SimpleFunctionsBillRequestSchema });
|
|
707
|
+
const legislation = Object.assign(legislationList, {
|
|
708
|
+
byBillId: legislationByBillId,
|
|
709
|
+
});
|
|
710
|
+
// GET https://simplefunctions.dev/api/public/congress/members{query}
|
|
711
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
712
|
+
const congressMembers = Object.assign(async (req = {}, signal) => {
|
|
713
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsCongressMembersRequestSchema, req);
|
|
714
|
+
const query = buildQuery({
|
|
715
|
+
q: parsed.q,
|
|
716
|
+
state: parsed.state,
|
|
717
|
+
party: parsed.party,
|
|
718
|
+
chamber: parsed.chamber,
|
|
719
|
+
limit: parsed.limit,
|
|
720
|
+
});
|
|
721
|
+
return makeJsonRequest("GET", `/api/public/congress/members${query}`, undefined, signal);
|
|
722
|
+
}, { schema: SimpleFunctionsCongressMembersRequestSchema });
|
|
723
|
+
// GET https://simplefunctions.dev/api/public/congress/member/{id}
|
|
724
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
725
|
+
const congressMember = Object.assign(async (req, signal) => {
|
|
726
|
+
const parsed = parseWithSchema(SimpleFunctionsCongressMemberRequestSchema, req);
|
|
727
|
+
const id = pathSegment(parsed.id);
|
|
728
|
+
return makeJsonRequest("GET", `/api/public/congress/member/${id}`, undefined, signal);
|
|
729
|
+
}, { schema: SimpleFunctionsCongressMemberRequestSchema });
|
|
730
|
+
// GET https://simplefunctions.dev/api/public/query-econ{query}
|
|
731
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/gov-econ
|
|
732
|
+
const queryEcon = Object.assign(async (req, signal) => {
|
|
733
|
+
const parsed = parseWithSchema(SimpleFunctionsEconQueryRequestSchema, req);
|
|
734
|
+
const query = buildQuery({
|
|
735
|
+
q: parsed.q.trim(),
|
|
736
|
+
mode: parsed.mode,
|
|
737
|
+
limit: parsed.limit,
|
|
738
|
+
includeMarkets: parsed.includeMarkets,
|
|
739
|
+
});
|
|
740
|
+
return makeJsonRequest("GET", `/api/public/query-econ${query}`, undefined, signal);
|
|
741
|
+
}, { schema: SimpleFunctionsEconQueryRequestSchema });
|
|
742
|
+
// GET https://simplefunctions.dev/api/public/fred{query}
|
|
743
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/gov-econ
|
|
744
|
+
const fred = Object.assign(async (req, signal) => {
|
|
745
|
+
const parsed = parseWithSchema(SimpleFunctionsFredRequestSchema, req);
|
|
746
|
+
const query = buildQuery({
|
|
747
|
+
series: parsed.series,
|
|
748
|
+
start: parsed.start,
|
|
749
|
+
end: parsed.end,
|
|
750
|
+
limit: parsed.limit,
|
|
751
|
+
});
|
|
752
|
+
return makeJsonRequest("GET", `/api/public/fred${query}`, undefined, signal);
|
|
753
|
+
}, { schema: SimpleFunctionsFredRequestSchema });
|
|
754
|
+
// GET https://simplefunctions.dev/api/public/databento{query}
|
|
755
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
756
|
+
const databento = Object.assign(async (req = {}, signal) => {
|
|
757
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsPublicListRequestSchema, req);
|
|
758
|
+
const query = buildListQuery(parsed);
|
|
759
|
+
return makeJsonRequest("GET", `/api/public/databento${query}`, undefined, signal);
|
|
760
|
+
}, { schema: SimpleFunctionsPublicListRequestSchema });
|
|
761
|
+
// GET https://simplefunctions.dev/api/public/trad-markets{query}
|
|
762
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
763
|
+
const tradMarkets = Object.assign(async (req = {}, signal) => {
|
|
764
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsPublicListRequestSchema, req);
|
|
765
|
+
const query = buildListQuery(parsed);
|
|
766
|
+
return makeJsonRequest("GET", `/api/public/trad-markets${query}`, undefined, signal);
|
|
767
|
+
}, { schema: SimpleFunctionsPublicListRequestSchema });
|
|
768
|
+
// GET https://simplefunctions.dev/api/changes{query}
|
|
769
|
+
// Docs: https://docs.simplefunctions.dev/reference/daily-data
|
|
770
|
+
const changes = Object.assign(async (req = {}, signal) => {
|
|
771
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsChangesRequestSchema, req);
|
|
772
|
+
const query = buildQuery({
|
|
773
|
+
since: parsed.since,
|
|
774
|
+
type: parsed.type,
|
|
775
|
+
limit: parsed.limit,
|
|
776
|
+
});
|
|
777
|
+
return makeJsonRequest("GET", `/api/changes${query}`, undefined, signal);
|
|
778
|
+
}, { schema: SimpleFunctionsChangesRequestSchema });
|
|
779
|
+
// GET https://simplefunctions.dev/api/public/context{query}
|
|
780
|
+
// Docs: https://docs.simplefunctions.dev/reference/daily-data
|
|
781
|
+
const context = Object.assign(async (req = {}, signal) => {
|
|
782
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsContextRequestSchema, req);
|
|
783
|
+
const query = buildQuery({
|
|
784
|
+
compact: parsed.compact,
|
|
785
|
+
});
|
|
786
|
+
return makeJsonRequest("GET", `/api/public/context${query}`, undefined, signal);
|
|
787
|
+
}, { schema: SimpleFunctionsContextRequestSchema });
|
|
788
|
+
// GET https://simplefunctions.dev/api/public/briefing{query}
|
|
789
|
+
// Docs: https://docs.simplefunctions.dev/reference/daily-data
|
|
790
|
+
const briefing = Object.assign(async (req = {}, signal) => {
|
|
791
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsBriefingRequestSchema, req);
|
|
792
|
+
const query = buildQuery({
|
|
793
|
+
topic: parsed.topic,
|
|
794
|
+
date: parsed.date,
|
|
795
|
+
compact: parsed.compact,
|
|
796
|
+
});
|
|
797
|
+
return makeJsonRequest("GET", `/api/public/briefing${query}`, undefined, signal);
|
|
798
|
+
}, { schema: SimpleFunctionsBriefingRequestSchema });
|
|
799
|
+
// GET https://simplefunctions.dev/api/public/topic/{slug}
|
|
800
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
801
|
+
const topic = Object.assign(async (req, signal) => {
|
|
802
|
+
const parsed = parseWithSchema(SimpleFunctionsSlugRequestSchema, req);
|
|
803
|
+
const slug = pathSegment(parsed.slug);
|
|
804
|
+
return makeJsonRequest("GET", `/api/public/topic/${slug}`, undefined, signal);
|
|
805
|
+
}, { schema: SimpleFunctionsSlugRequestSchema });
|
|
806
|
+
// GET https://simplefunctions.dev/api/public/answer/{slug}
|
|
807
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
808
|
+
const answer = Object.assign(async (req, signal) => {
|
|
809
|
+
const parsed = parseWithSchema(SimpleFunctionsSlugRequestSchema, req);
|
|
810
|
+
const slug = pathSegment(parsed.slug);
|
|
811
|
+
return makeJsonRequest("GET", `/api/public/answer/${slug}`, undefined, signal);
|
|
812
|
+
}, { schema: SimpleFunctionsSlugRequestSchema });
|
|
813
|
+
// GET https://simplefunctions.dev/api/public/glossary{query}
|
|
814
|
+
// Docs: https://docs.simplefunctions.dev/reference/daily-data
|
|
815
|
+
const glossaryList = Object.assign(async (req = {}, signal) => {
|
|
816
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsPublicListRequestSchema, req);
|
|
817
|
+
const query = buildListQuery(parsed);
|
|
818
|
+
return makeJsonRequest("GET", `/api/public/glossary${query}`, undefined, signal);
|
|
819
|
+
}, { schema: SimpleFunctionsPublicListRequestSchema });
|
|
820
|
+
// sig-ok: detail endpoint hangs off the glossary collection.
|
|
821
|
+
// GET https://simplefunctions.dev/api/public/glossary/{slug}
|
|
822
|
+
// Docs: https://docs.simplefunctions.dev/reference/daily-data
|
|
823
|
+
const glossaryEntry = Object.assign(async (req, signal) => {
|
|
824
|
+
const parsed = parseWithSchema(SimpleFunctionsSlugRequestSchema, req);
|
|
825
|
+
const slug = pathSegment(parsed.slug);
|
|
826
|
+
return makeJsonRequest("GET", `/api/public/glossary/${slug}`, undefined, signal);
|
|
827
|
+
}, { schema: SimpleFunctionsSlugRequestSchema });
|
|
828
|
+
const glossary = Object.assign(glossaryList, {
|
|
829
|
+
entry: glossaryEntry,
|
|
830
|
+
});
|
|
831
|
+
// GET https://simplefunctions.dev/api/public/guide
|
|
832
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
833
|
+
const guide = Object.assign(async (req = {}, signal) => {
|
|
834
|
+
parseOptionalWithSchema(SimpleFunctionsEmptyRequestSchema, req);
|
|
835
|
+
return makeJsonRequest("GET", "/api/public/guide", undefined, signal);
|
|
836
|
+
}, { schema: SimpleFunctionsEmptyRequestSchema });
|
|
837
|
+
// GET https://simplefunctions.dev/api/public/highlights{query}
|
|
838
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
839
|
+
const highlights = Object.assign(async (req = {}, signal) => {
|
|
840
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsPublicListRequestSchema, req);
|
|
841
|
+
const query = buildListQuery(parsed);
|
|
842
|
+
return makeJsonRequest("GET", `/api/public/highlights${query}`, undefined, signal);
|
|
843
|
+
}, { schema: SimpleFunctionsPublicListRequestSchema });
|
|
844
|
+
// GET https://simplefunctions.dev/api/public/diff{query}
|
|
845
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
846
|
+
const diff = Object.assign(async (req = {}, signal) => {
|
|
847
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsPublicListRequestSchema, req);
|
|
848
|
+
const query = buildListQuery(parsed);
|
|
849
|
+
return makeJsonRequest("GET", `/api/public/diff${query}`, undefined, signal);
|
|
850
|
+
}, { schema: SimpleFunctionsPublicListRequestSchema });
|
|
851
|
+
// POST https://simplefunctions.dev/api/public/discuss
|
|
852
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
853
|
+
const discuss = Object.assign(async (req, signal) => {
|
|
854
|
+
const parsed = parseWithSchema(SimpleFunctionsDiscussRequestSchema, req);
|
|
855
|
+
return makeJsonRequest("POST", "/api/public/discuss", parsed, signal);
|
|
856
|
+
}, { schema: SimpleFunctionsDiscussRequestSchema });
|
|
857
|
+
// GET https://simplefunctions.dev/api/public/skills{query}
|
|
858
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
859
|
+
const skills = Object.assign(async (req = {}, signal) => {
|
|
860
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsPublicListRequestSchema, req);
|
|
861
|
+
const query = buildListQuery(parsed);
|
|
862
|
+
return makeJsonRequest("GET", `/api/public/skills${query}`, undefined, signal);
|
|
863
|
+
}, { schema: SimpleFunctionsPublicListRequestSchema });
|
|
864
|
+
// GET https://simplefunctions.dev/api/public/skill/{slug}
|
|
865
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
866
|
+
const skill = Object.assign(async (req, signal) => {
|
|
867
|
+
const parsed = parseWithSchema(SimpleFunctionsSlugRequestSchema, req);
|
|
868
|
+
const slug = pathSegment(parsed.slug);
|
|
869
|
+
return makeJsonRequest("GET", `/api/public/skill/${slug}`, undefined, signal);
|
|
870
|
+
}, { schema: SimpleFunctionsSlugRequestSchema });
|
|
871
|
+
// GET https://simplefunctions.dev/api/public/theses{query}
|
|
872
|
+
// Docs: https://docs.simplefunctions.dev/reference/daily-data
|
|
873
|
+
const theses = Object.assign(async (req = {}, signal) => {
|
|
874
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsPublicListRequestSchema, req);
|
|
875
|
+
const query = buildListQuery(parsed);
|
|
876
|
+
return makeJsonRequest("GET", `/api/public/theses${query}`, undefined, signal);
|
|
877
|
+
}, { schema: SimpleFunctionsPublicListRequestSchema });
|
|
878
|
+
// GET https://simplefunctions.dev/api/public/thesis/{slug}
|
|
879
|
+
// Docs: https://docs.simplefunctions.dev/reference/daily-data
|
|
880
|
+
const thesis = Object.assign(async (req, signal) => {
|
|
881
|
+
const parsed = parseWithSchema(SimpleFunctionsSlugRequestSchema, req);
|
|
882
|
+
const slug = pathSegment(parsed.slug);
|
|
883
|
+
return makeJsonRequest("GET", `/api/public/thesis/${slug}`, undefined, signal);
|
|
884
|
+
}, { schema: SimpleFunctionsSlugRequestSchema });
|
|
885
|
+
// GET https://simplefunctions.dev/api/public/opinions{query}
|
|
886
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
887
|
+
const opinionsList = Object.assign(async (req = {}, signal) => {
|
|
888
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsPublicListRequestSchema, req);
|
|
889
|
+
const query = buildListQuery(parsed);
|
|
890
|
+
return makeJsonRequest("GET", `/api/public/opinions${query}`, undefined, signal);
|
|
891
|
+
}, { schema: SimpleFunctionsPublicListRequestSchema });
|
|
892
|
+
// sig-ok: detail endpoint hangs off the opinions collection.
|
|
893
|
+
// GET https://simplefunctions.dev/api/public/opinions/{slug}
|
|
894
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
895
|
+
const opinionEntry = Object.assign(async (req, signal) => {
|
|
896
|
+
const parsed = parseWithSchema(SimpleFunctionsSlugRequestSchema, req);
|
|
897
|
+
const slug = pathSegment(parsed.slug);
|
|
898
|
+
return makeJsonRequest("GET", `/api/public/opinions/${slug}`, undefined, signal);
|
|
899
|
+
}, { schema: SimpleFunctionsSlugRequestSchema });
|
|
900
|
+
const opinions = Object.assign(opinionsList, {
|
|
901
|
+
entry: opinionEntry,
|
|
902
|
+
});
|
|
903
|
+
// GET https://simplefunctions.dev/api/public/technicals{query}
|
|
904
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
905
|
+
const technicalsList = Object.assign(async (req = {}, signal) => {
|
|
906
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsPublicListRequestSchema, req);
|
|
907
|
+
const query = buildListQuery(parsed);
|
|
908
|
+
return makeJsonRequest("GET", `/api/public/technicals${query}`, undefined, signal);
|
|
909
|
+
}, { schema: SimpleFunctionsPublicListRequestSchema });
|
|
910
|
+
// sig-ok: detail endpoint hangs off the technicals collection.
|
|
911
|
+
// GET https://simplefunctions.dev/api/public/technicals/{slug}
|
|
912
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/public-market-data
|
|
913
|
+
const technicalsEntry = Object.assign(async (req, signal) => {
|
|
914
|
+
const parsed = parseWithSchema(SimpleFunctionsSlugRequestSchema, req);
|
|
915
|
+
const slug = pathSegment(parsed.slug);
|
|
916
|
+
return makeJsonRequest("GET", `/api/public/technicals/${slug}`, undefined, signal);
|
|
917
|
+
}, { schema: SimpleFunctionsSlugRequestSchema });
|
|
918
|
+
const technicals = Object.assign(technicalsList, {
|
|
919
|
+
entry: technicalsEntry,
|
|
920
|
+
});
|
|
921
|
+
// GET https://simplefunctions.dev/api/public/ideas{query}
|
|
922
|
+
// Docs: https://docs.simplefunctions.dev/reference/daily-data
|
|
923
|
+
const ideasList = Object.assign(async (req = {}, signal) => {
|
|
924
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsPublicListRequestSchema, req);
|
|
925
|
+
const query = buildListQuery(parsed);
|
|
926
|
+
return makeJsonRequest("GET", `/api/public/ideas${query}`, undefined, signal);
|
|
927
|
+
}, { schema: SimpleFunctionsPublicListRequestSchema });
|
|
928
|
+
// sig-ok: detail endpoint hangs off the ideas collection.
|
|
929
|
+
// GET https://simplefunctions.dev/api/public/ideas/{id}
|
|
930
|
+
// Docs: https://docs.simplefunctions.dev/reference/daily-data
|
|
931
|
+
const ideaById = Object.assign(async (req, signal) => {
|
|
932
|
+
const parsed = parseWithSchema(SimpleFunctionsIdeaRequestSchema, req);
|
|
933
|
+
const id = pathSegment(parsed.id);
|
|
934
|
+
return makeJsonRequest("GET", `/api/public/ideas/${id}`, undefined, signal);
|
|
935
|
+
}, { schema: SimpleFunctionsIdeaRequestSchema });
|
|
936
|
+
const ideas = Object.assign(ideasList, {
|
|
937
|
+
byId: ideaById,
|
|
938
|
+
});
|
|
939
|
+
// GET https://simplefunctions.dev/api/public/calibration{query}
|
|
940
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/index-regime
|
|
941
|
+
const publicCalibration = Object.assign(async (req = {}, signal) => {
|
|
942
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsCalibrationRequestSchema, req);
|
|
943
|
+
const query = buildQuery({
|
|
944
|
+
source: parsed.source,
|
|
945
|
+
period: parsed.period,
|
|
946
|
+
category: parsed.category,
|
|
947
|
+
topic: parsed.topic,
|
|
948
|
+
min_volume: parsed.minVolume,
|
|
949
|
+
});
|
|
950
|
+
return makeJsonRequest("GET", `/api/public/calibration${query}`, undefined, signal);
|
|
951
|
+
}, { schema: SimpleFunctionsCalibrationRequestSchema });
|
|
952
|
+
// GET https://simplefunctions.dev/api/calibration{query}
|
|
953
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/index-regime
|
|
954
|
+
const calibration = Object.assign(async (req = {}, signal) => {
|
|
955
|
+
requireApiKey(opts.apiKey, "/api/calibration");
|
|
956
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsCalibrationRequestSchema, req);
|
|
957
|
+
const query = buildQuery({
|
|
958
|
+
source: parsed.source,
|
|
959
|
+
period: parsed.period,
|
|
960
|
+
category: parsed.category,
|
|
961
|
+
topic: parsed.topic,
|
|
962
|
+
min_volume: parsed.minVolume,
|
|
963
|
+
});
|
|
964
|
+
return makeJsonRequest("GET", `/api/calibration${query}`, undefined, signal);
|
|
965
|
+
}, { schema: SimpleFunctionsCalibrationRequestSchema });
|
|
966
|
+
// GET https://simplefunctions.dev/api/edges{query}
|
|
967
|
+
// Docs: https://docs.simplefunctions.dev/api-reference/index-regime
|
|
968
|
+
const edges = Object.assign(async (req = {}, signal) => {
|
|
969
|
+
requireApiKey(opts.apiKey, "/api/edges");
|
|
970
|
+
const parsed = parseOptionalWithSchema(SimpleFunctionsEdgesRequestSchema, req);
|
|
971
|
+
const query = buildQuery({
|
|
972
|
+
limit: parsed.limit,
|
|
973
|
+
minStrength: parsed.minStrength,
|
|
974
|
+
theme: parsed.theme,
|
|
975
|
+
venue: parsed.venue,
|
|
976
|
+
});
|
|
977
|
+
return makeJsonRequest("GET", `/api/edges${query}`, undefined, signal);
|
|
978
|
+
}, { schema: SimpleFunctionsEdgesRequestSchema });
|
|
979
|
+
const publicApi = {
|
|
980
|
+
query,
|
|
981
|
+
market,
|
|
982
|
+
markets,
|
|
983
|
+
newmarkets,
|
|
984
|
+
scan,
|
|
985
|
+
screen,
|
|
986
|
+
screenByTickers,
|
|
987
|
+
search,
|
|
988
|
+
liveTickers,
|
|
989
|
+
marketMicrostructureHistory,
|
|
990
|
+
crossVenue: {
|
|
991
|
+
pairs: crossVenuePairs,
|
|
992
|
+
stats: crossVenueStats,
|
|
993
|
+
},
|
|
994
|
+
index,
|
|
995
|
+
regime: {
|
|
996
|
+
scan: regimeScan,
|
|
997
|
+
},
|
|
998
|
+
odds,
|
|
999
|
+
oddsMd,
|
|
1000
|
+
calendar,
|
|
1001
|
+
yieldCurves,
|
|
1002
|
+
liquidityByTheme,
|
|
1003
|
+
contagion,
|
|
1004
|
+
queryGov,
|
|
1005
|
+
legislation,
|
|
1006
|
+
congress: {
|
|
1007
|
+
members: congressMembers,
|
|
1008
|
+
member: congressMember,
|
|
1009
|
+
},
|
|
1010
|
+
queryEcon,
|
|
1011
|
+
fred,
|
|
1012
|
+
databento,
|
|
1013
|
+
tradMarkets,
|
|
1014
|
+
context,
|
|
1015
|
+
briefing,
|
|
1016
|
+
topic,
|
|
1017
|
+
answer,
|
|
1018
|
+
glossary,
|
|
1019
|
+
guide,
|
|
1020
|
+
highlights,
|
|
1021
|
+
diff,
|
|
1022
|
+
discuss,
|
|
1023
|
+
skills,
|
|
1024
|
+
skill,
|
|
1025
|
+
theses,
|
|
1026
|
+
thesis,
|
|
1027
|
+
opinions,
|
|
1028
|
+
technicals,
|
|
1029
|
+
ideas,
|
|
1030
|
+
calibration: publicCalibration,
|
|
1031
|
+
};
|
|
1032
|
+
const api = {
|
|
1033
|
+
agent: {
|
|
1034
|
+
world,
|
|
1035
|
+
inspect,
|
|
1036
|
+
feed: agentFeed,
|
|
1037
|
+
},
|
|
1038
|
+
calibration,
|
|
1039
|
+
changes,
|
|
1040
|
+
edges,
|
|
1041
|
+
public: publicApi,
|
|
1042
|
+
};
|
|
1043
|
+
const data = {
|
|
1044
|
+
v1: {
|
|
1045
|
+
heartbeat,
|
|
1046
|
+
markets: dataMarkets,
|
|
1047
|
+
search: dataSearch,
|
|
1048
|
+
snapshot,
|
|
1049
|
+
movers,
|
|
1050
|
+
orderbook,
|
|
1051
|
+
candles,
|
|
1052
|
+
trades,
|
|
1053
|
+
},
|
|
1054
|
+
};
|
|
1055
|
+
return attachExamples({
|
|
1056
|
+
api,
|
|
1057
|
+
data,
|
|
1058
|
+
get: {
|
|
1059
|
+
api,
|
|
1060
|
+
data,
|
|
1061
|
+
},
|
|
1062
|
+
post: {
|
|
1063
|
+
api: {
|
|
1064
|
+
public: {
|
|
1065
|
+
discuss,
|
|
1066
|
+
},
|
|
1067
|
+
},
|
|
1068
|
+
},
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
//# sourceMappingURL=simplefunctions.js.map
|