@keystrokehq/polymarket 0.0.9 → 0.0.16-integration-id-canonicalization.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/dist/pricing.mjs DELETED
@@ -1,105 +0,0 @@
1
- import { D as createPolymarketClient, E as polymarketOperation, g as priceHistoryResponseSchema, n as clobPriceSchema, r as clobPricesMapSchema, t as clobMidpointSchema } from "./schemas-DGLbQgHc.mjs";
2
- import { z } from "zod";
3
-
4
- //#region src/pricing.ts
5
- /**
6
- * polymarket/pricing.ts
7
- *
8
- * Steps for pricing data via the CLOB API.
9
- * Note: CLOB API returns prices as strings, not numbers.
10
- */
11
- const getPrice = polymarketOperation({
12
- id: "polymarket.get-polymarket-price",
13
- name: "Get Polymarket Price",
14
- description: "Get price for a token and side (BUY/SELL) via the CLOB API",
15
- input: z.object({
16
- tokenID: z.string(),
17
- side: z.enum(["BUY", "SELL"])
18
- }),
19
- output: clobPriceSchema,
20
- run: async (input, credentials) => {
21
- return createPolymarketClient(credentials).request({
22
- host: "clob",
23
- method: "GET",
24
- path: "/price",
25
- query: {
26
- token_id: input.tokenID,
27
- side: input.side
28
- }
29
- });
30
- }
31
- });
32
- const getMidpoint = polymarketOperation({
33
- id: "polymarket.get-polymarket-midpoint",
34
- name: "Get Polymarket Midpoint",
35
- description: "Get midpoint price for a token via the CLOB API",
36
- input: z.object({ tokenID: z.string() }),
37
- output: clobMidpointSchema,
38
- run: async (input, credentials) => {
39
- return createPolymarketClient(credentials).request({
40
- host: "clob",
41
- method: "GET",
42
- path: "/midpoint",
43
- query: { token_id: input.tokenID }
44
- });
45
- }
46
- });
47
- const listPrices = polymarketOperation({
48
- id: "polymarket.list-polymarket-prices",
49
- name: "List Polymarket Prices",
50
- description: "Get all current prices via the CLOB API",
51
- input: z.object({}),
52
- output: clobPricesMapSchema,
53
- run: async (_input, credentials) => {
54
- return createPolymarketClient(credentials).request({
55
- host: "clob",
56
- method: "GET",
57
- path: "/prices"
58
- });
59
- }
60
- });
61
- const batchGetPrices = polymarketOperation({
62
- id: "polymarket.batch-get-polymarket-prices",
63
- name: "Batch Get Polymarket Prices",
64
- description: "Get prices for multiple tokens (max 500) via the CLOB API",
65
- input: z.object({ tokenIDs: z.array(z.string()).max(500) }),
66
- output: clobPricesMapSchema,
67
- run: async (input, credentials) => {
68
- return createPolymarketClient(credentials).request({
69
- host: "clob",
70
- method: "POST",
71
- path: "/prices",
72
- body: input.tokenIDs
73
- });
74
- }
75
- });
76
- const getPriceHistory = polymarketOperation({
77
- id: "polymarket.get-polymarket-price-history",
78
- name: "Get Polymarket Price History",
79
- description: "Get historical prices with interval/fidelity via the CLOB API",
80
- input: z.object({
81
- tokenID: z.string(),
82
- interval: z.string().optional(),
83
- fidelity: z.number().optional(),
84
- startTs: z.number().optional(),
85
- endTs: z.number().optional()
86
- }),
87
- output: priceHistoryResponseSchema,
88
- run: async (input, credentials) => {
89
- return createPolymarketClient(credentials).request({
90
- host: "clob",
91
- method: "GET",
92
- path: "/prices-history",
93
- query: {
94
- market: input.tokenID,
95
- interval: input.interval,
96
- fidelity: input.fidelity,
97
- startTs: input.startTs,
98
- endTs: input.endTs
99
- }
100
- });
101
- }
102
- });
103
-
104
- //#endregion
105
- export { batchGetPrices, getMidpoint, getPrice, getPriceHistory, listPrices };