investing 0.1.58 → 0.1.60
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 +8 -139
- package/dist/{archiver-web.es-fg4bLLZa.cjs → archiver-web.es-aVRMV91L.cjs} +1 -1
- package/dist/{archiver-web.es-B69gABHP.js → archiver-web.es-nT97W1RO.js} +1 -1
- package/dist/db/index.d.ts +17 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/schema.d.ts +17 -0
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/index-37WiaVVO.cjs +13 -0
- package/dist/index-CHQbu68w.js +15 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/predictos/index.d.ts +7 -22
- package/dist/predictos/index.d.ts.map +1 -1
- package/dist/stocks/index.d.ts +0 -1
- package/dist/stocks/index.d.ts.map +1 -1
- package/dist/stocks/quote-cache-service.d.ts +11 -2
- package/dist/stocks/quote-cache-service.d.ts.map +1 -1
- package/dist/stocks/unified-quote-service.d.ts +15 -6
- package/dist/stocks/unified-quote-service.d.ts.map +1 -1
- package/package.json +6 -45
- package/LICENSE-PredictOS-MIT +0 -22
- package/NOTICE +0 -10
- package/dist/bookmakerAnalysis-Bfo1zUVm.js +0 -1
- package/dist/bookmakerAnalysis-CHn1W8uX.cjs +0 -1
- package/dist/callGrok-D0D7zBHK.js +0 -1
- package/dist/callGrok-DWO719mN.cjs +0 -1
- package/dist/events-BJOyGWeU.cjs +0 -1
- package/dist/events-OvBb8rgy.js +0 -1
- package/dist/index-D7fsk2gy.js +0 -15
- package/dist/index-_V1Ql5Es.cjs +0 -13
- package/dist/polymarket-updown-15-limit-order-bot-DCC8HE9Z.cjs +0 -1
- package/dist/polymarket-updown-15-limit-order-bot-Dv5oGAF4.js +0 -1
- package/dist/predictos/agents/bookmaker-agent.d.ts +0 -8
- package/dist/predictos/agents/bookmaker-agent.d.ts.map +0 -1
- package/dist/predictos/agents/event-analysis-agent.d.ts +0 -8
- package/dist/predictos/agents/event-analysis-agent.d.ts.map +0 -1
- package/dist/predictos/agents/index.d.ts +0 -21
- package/dist/predictos/agents/index.d.ts.map +0 -1
- package/dist/predictos/agents/index.js +0 -1
- package/dist/predictos/agents/index.mjs +0 -1
- package/dist/predictos/agents/mapper-agent.d.ts +0 -17
- package/dist/predictos/agents/mapper-agent.d.ts.map +0 -1
- package/dist/predictos/agents/polyfactual-research.d.ts +0 -47
- package/dist/predictos/agents/polyfactual-research.d.ts.map +0 -1
- package/dist/predictos/agents/polymarket-position-tracker.d.ts +0 -31
- package/dist/predictos/agents/polymarket-position-tracker.d.ts.map +0 -1
- package/dist/predictos/agents/polymarket-put-order.d.ts +0 -88
- package/dist/predictos/agents/polymarket-put-order.d.ts.map +0 -1
- package/dist/predictos/agents/polymarket-updown-15-limit-order-bot.d.ts +0 -92
- package/dist/predictos/agents/polymarket-updown-15-limit-order-bot.d.ts.map +0 -1
- package/dist/predictos/agents/x402-seller.d.ts +0 -34
- package/dist/predictos/agents/x402-seller.d.ts.map +0 -1
- package/dist/predictos/ai/callBlockRun.d.ts +0 -54
- package/dist/predictos/ai/callBlockRun.d.ts.map +0 -1
- package/dist/predictos/ai/callGrok.d.ts +0 -22
- package/dist/predictos/ai/callGrok.d.ts.map +0 -1
- package/dist/predictos/ai/callOpenAI.d.ts +0 -19
- package/dist/predictos/ai/callOpenAI.d.ts.map +0 -1
- package/dist/predictos/ai/http.d.ts +0 -19
- package/dist/predictos/ai/http.d.ts.map +0 -1
- package/dist/predictos/ai/index.d.ts +0 -19
- package/dist/predictos/ai/index.d.ts.map +0 -1
- package/dist/predictos/ai/index.js +0 -1
- package/dist/predictos/ai/index.mjs +0 -1
- package/dist/predictos/ai/prompts/analyzeEventMarkets.d.ts +0 -12
- package/dist/predictos/ai/prompts/analyzeEventMarkets.d.ts.map +0 -1
- package/dist/predictos/ai/prompts/arbitrageAnalysis.d.ts +0 -14
- package/dist/predictos/ai/prompts/arbitrageAnalysis.d.ts.map +0 -1
- package/dist/predictos/ai/prompts/bookmakerAnalysis.d.ts +0 -17
- package/dist/predictos/ai/prompts/bookmakerAnalysis.d.ts.map +0 -1
- package/dist/predictos/ai/prompts/searchQueryGenerator.d.ts +0 -18
- package/dist/predictos/ai/prompts/searchQueryGenerator.d.ts.map +0 -1
- package/dist/predictos/ai/types.d.ts +0 -214
- package/dist/predictos/ai/types.d.ts.map +0 -1
- package/dist/predictos/arbitrage.d.ts +0 -8
- package/dist/predictos/arbitrage.d.ts.map +0 -1
- package/dist/predictos/arbitrage.js +0 -1
- package/dist/predictos/arbitrage.mjs +0 -1
- package/dist/predictos/clients/polyfactual.d.ts +0 -72
- package/dist/predictos/clients/polyfactual.d.ts.map +0 -1
- package/dist/predictos/clients/polymarket.d.ts +0 -283
- package/dist/predictos/clients/polymarket.d.ts.map +0 -1
- package/dist/predictos/clients/x402.d.ts +0 -213
- package/dist/predictos/clients/x402.d.ts.map +0 -1
- package/dist/predictos/data/kalshi.d.ts +0 -66
- package/dist/predictos/data/kalshi.d.ts.map +0 -1
- package/dist/predictos/data/kalshi.js +0 -1
- package/dist/predictos/data/kalshi.mjs +0 -1
- package/dist/predictos/data/polymarket.d.ts +0 -105
- package/dist/predictos/data/polymarket.d.ts.map +0 -1
- package/dist/predictos/data/polymarket.js +0 -1
- package/dist/predictos/data/polymarket.mjs +0 -1
- package/dist/predictos/events.d.ts +0 -9
- package/dist/predictos/events.d.ts.map +0 -1
- package/dist/predictos/index.js +0 -1
- package/dist/predictos/index.mjs +0 -1
- package/dist/predictos/types.d.ts +0 -408
- package/dist/predictos/types.d.ts.map +0 -1
- package/dist/searchQueryGenerator-DIIs9xw5.js +0 -1
- package/dist/searchQueryGenerator-rCVblXJS.cjs +0 -1
package/README.md
CHANGED
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
<!-- template-git-repo:badges:start -->
|
|
6
6
|
<p align="center">
|
|
7
|
-
<a href="https://
|
|
7
|
+
<a href="https://docs.autoinvestment.broker/"><img src="https://img.shields.io/badge/Docs-blue?logo=ReadTheDocs&logoColor=white" alt="Documentation" /></a>
|
|
8
8
|
<br />
|
|
9
|
-
<a href="https://github.com/OpenSourceAGI/
|
|
9
|
+
<a href="https://github.com/OpenSourceAGI/ai-broker-investing-agent/stargazers"><img src="https://img.shields.io/github/stars/OpenSourceAGI/ai-broker-investing-agent" alt="GitHub Stars" /></a>
|
|
10
10
|
<a href="https://www.npmjs.com/package/investing"><img src="https://img.shields.io/npm/dm/investing.svg" alt="NPM Monthly Downloads" /></a>
|
|
11
11
|
<a href="https://www.npmjs.com/package/investing"><img src="https://img.shields.io/npm/v/investing.svg" alt="npm version" /></a>
|
|
12
12
|
<a href="https://www.npmjs.com/package/investing"><img src="https://img.shields.io/npm/dt/investing.svg" alt="NPM Total Downloads" /></a>
|
|
13
13
|
<a href="https://www.npmjs.com/package/investing"><img src="https://img.shields.io/npm/types/investing" alt="TypeScript types" /></a>
|
|
14
14
|
<a href="https://packagephobia.com/result?p=investing"><img src="https://packagephobia.com/badge?p=investing" alt="Install size" /></a>
|
|
15
15
|
<br />
|
|
16
|
-
<a href="https://github.com/OpenSourceAGI/
|
|
17
|
-
<a href="https://github.com/OpenSourceAGI/
|
|
18
|
-
<a href="https://github.com/OpenSourceAGI/
|
|
19
|
-
<a href="https://github.com/OpenSourceAGI/
|
|
20
|
-
<a href="https://github.com/OpenSourceAGI/
|
|
16
|
+
<a href="https://github.com/OpenSourceAGI/ai-broker-investing-agent/issues"><img src="https://img.shields.io/github/issues/OpenSourceAGI/ai-broker-investing-agent?logo=github" alt="GitHub Issues" /></a>
|
|
17
|
+
<a href="https://github.com/OpenSourceAGI/ai-broker-investing-agent/pulls"><img src="https://img.shields.io/github/issues-pr/OpenSourceAGI/ai-broker-investing-agent?logo=github&label=PRs" alt="Open Pull Requests" /></a>
|
|
18
|
+
<a href="https://github.com/OpenSourceAGI/ai-broker-investing-agent/pulls?q=is%3Apr+is%3Aclosed"><img src="https://img.shields.io/github/issues-pr-closed/OpenSourceAGI/ai-broker-investing-agent?logo=github&label=PRs%20merged&color=8957e5" alt="Merged Pull Requests" /></a>
|
|
19
|
+
<a href="https://github.com/OpenSourceAGI/ai-broker-investing-agent/discussions"><img src="https://img.shields.io/github/discussions/OpenSourceAGI/ai-broker-investing-agent" alt="GitHub Discussions" /></a>
|
|
20
|
+
<a href="https://github.com/OpenSourceAGI/ai-broker-investing-agent/commits/main/"><img src="https://img.shields.io/github/last-commit/OpenSourceAGI/ai-broker-investing-agent.svg" alt="GitHub last commit" /></a>
|
|
21
21
|
<br />
|
|
22
|
-
<a href="https://stackblitz.com/github/OpenSourceAGI/
|
|
22
|
+
<a href="https://stackblitz.com/github/OpenSourceAGI/ai-broker-investing-agent/tree/main/packages/investing"><img height="20px" src="https://developer.stackblitz.com/img/open_in_stackblitz.svg" alt="Open in StackBlitz" /></a>
|
|
23
23
|
<img src="https://img.shields.io/badge/Bun-14151A?logo=bun&logoColor=white" alt="Bun" /> <img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white" alt="TypeScript" /> <img src="https://img.shields.io/badge/Drizzle%20ORM-C5F74F?logo=drizzle&logoColor=white" alt="Drizzle ORM" /> <img src="https://img.shields.io/badge/Zod-3E67B1?logo=zod&logoColor=white" alt="Zod" /> <img src="https://img.shields.io/badge/Vite-646CFF?logo=vite&logoColor=white" alt="Vite" /> <img src="https://img.shields.io/badge/Vitest-6E9F18?logo=vitest&logoColor=white" alt="Vitest" />
|
|
24
24
|
</p>
|
|
25
25
|
<!-- template-git-repo:badges:end -->
|
|
@@ -33,8 +33,6 @@ A comprehensive TypeScript/JavaScript library for investment analysis, trading a
|
|
|
33
33
|
- 🤖 **Trading Agents** - Multi-agent framework for automated trading strategies
|
|
34
34
|
- 📊 **Stock Data** - Fetch and analyze stock data from Yahoo Finance, SEC filings, and more
|
|
35
35
|
- 💹 **Prediction Markets** - Polymarket integration for prediction market data
|
|
36
|
-
- 🔮 **PredictOS Core** - Multi-agent prediction-market analysis, Kalshi/Polymarket
|
|
37
|
-
data clients, and cross-platform arbitrage (merged in from the `predictos` package)
|
|
38
36
|
- 🔌 **Alpaca Trading API** - Easy-to-use wrapper for Alpaca trading platform
|
|
39
37
|
- 📈 **Technical Analysis** - Algorithmic trading strategies and indicators
|
|
40
38
|
- 🎯 **Social Trading** - Track and analyze top traders and strategies
|
|
@@ -113,37 +111,6 @@ const leaders = await fetchLeaderboard({
|
|
|
113
111
|
});
|
|
114
112
|
```
|
|
115
113
|
|
|
116
|
-
### PredictOS — Prediction-Market Analysis & Arbitrage
|
|
117
|
-
|
|
118
|
-
```typescript
|
|
119
|
-
import {
|
|
120
|
-
runEventAnalysisAgent,
|
|
121
|
-
findArbitrage,
|
|
122
|
-
getEvents,
|
|
123
|
-
} from "investing/predictos";
|
|
124
|
-
|
|
125
|
-
const url = "https://polymarket.com/event/will-x-happen-by-2026";
|
|
126
|
-
|
|
127
|
-
// Resolve a Polymarket / Kalshi / Jupiter event URL into its raw markets
|
|
128
|
-
const event = await getEvents({ url });
|
|
129
|
-
|
|
130
|
-
// Analyze those markets for alpha and a predicted winner
|
|
131
|
-
const { analysis } = await runEventAnalysisAgent({
|
|
132
|
-
markets: event.markets,
|
|
133
|
-
eventIdentifier: event.eventIdentifier,
|
|
134
|
-
pmType: event.pmType,
|
|
135
|
-
model: "grok-4-fast",
|
|
136
|
-
tools: ["x_search"], // Grok models only
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
// Look for the same event mispriced on the other venue
|
|
140
|
-
const arb = await findArbitrage({ url, model: "grok-4-fast" });
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
Every entry point takes a typed `request` object and an optional second
|
|
144
|
-
`config` (`AIConfig` / `DataConfig`) that falls back to `process.env`. Missing
|
|
145
|
-
required fields **throw** rather than returning an error result.
|
|
146
|
-
|
|
147
114
|
### Trading Agents Framework
|
|
148
115
|
|
|
149
116
|
```typescript
|
|
@@ -248,90 +215,6 @@ Get Polymarket leaderboard of top traders.
|
|
|
248
215
|
- `limit` - Number of results (default: 20)
|
|
249
216
|
- `category` - Market category (default: 'overall')
|
|
250
217
|
|
|
251
|
-
### PredictOS Core
|
|
252
|
-
|
|
253
|
-
```typescript
|
|
254
|
-
import {
|
|
255
|
-
runEventAnalysisAgent,
|
|
256
|
-
runBookmakerAgent,
|
|
257
|
-
runMapperAgent,
|
|
258
|
-
findArbitrage,
|
|
259
|
-
getEvents,
|
|
260
|
-
} from "investing/predictos";
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
> Adapted from [PredictOS](https://github.com/PredictionXBT/PredictOS) by
|
|
264
|
-
> **PredictionXBT** (MIT licensed, © 2025). The original code shipped as
|
|
265
|
-
> Deno/Supabase edge functions; here it is refactored into plain, typed,
|
|
266
|
-
> dependency-light library functions with no HTTP/CORS layer. It lived in a
|
|
267
|
-
> sibling `predictos` package until that package was merged into `investing`.
|
|
268
|
-
> See [`NOTICE`](./NOTICE) and
|
|
269
|
-
> [`LICENSE-PredictOS-MIT`](./LICENSE-PredictOS-MIT).
|
|
270
|
-
|
|
271
|
-
#### What it covers
|
|
272
|
-
|
|
273
|
-
- **AI provider clients** — OpenAI (Responses API), Grok/xAI (Responses API,
|
|
274
|
-
with optional `x_search` / `web_search` tools), and BlockRun (x402
|
|
275
|
-
wallet-based micropayments across 20+ models), plus the analysis prompt
|
|
276
|
-
builders (`analyzeEventMarkets`, `bookmakerAnalysis`, `arbitrageAnalysis`,
|
|
277
|
-
`searchQueryGenerator`).
|
|
278
|
-
- **Market data clients** — Kalshi via the DFlow API
|
|
279
|
-
(`investing/predictos/data/kalshi`) and Polymarket via the Dome API
|
|
280
|
-
(`investing/predictos/data/polymarket`).
|
|
281
|
-
- **Multi-agent pipeline** (`investing/predictos/agents`):
|
|
282
|
-
- `runEventAnalysisAgent` — analyzes an event's markets for alpha and a
|
|
283
|
-
predicted winner.
|
|
284
|
-
- `runBookmakerAgent` — aggregates multiple agent analyses (and optional
|
|
285
|
-
external data sources) into a single consolidated assessment.
|
|
286
|
-
- `runMapperAgent` — turns an analysis into Polymarket order parameters
|
|
287
|
-
(pure logic; Kalshi mapping not yet implemented).
|
|
288
|
-
- **Cross-platform arbitrage** (`investing/predictos/arbitrage`) —
|
|
289
|
-
`findArbitrage` parses a Polymarket/Kalshi URL, generates a search query with
|
|
290
|
-
AI, searches the other platform, and evaluates whether the same event is
|
|
291
|
-
mispriced across venues.
|
|
292
|
-
- **Event fetching** (`getEvents`) — resolves a Polymarket/Kalshi/Jupiter URL
|
|
293
|
-
into its raw markets (Kalshi via DFlow, Polymarket via the Gamma API).
|
|
294
|
-
|
|
295
|
-
#### Subpath exports
|
|
296
|
-
|
|
297
|
-
| Import | Contents |
|
|
298
|
-
| --- | --- |
|
|
299
|
-
| `investing/predictos` | Everything (barrel) |
|
|
300
|
-
| `investing/predictos/ai` | AI clients + prompt builders |
|
|
301
|
-
| `investing/predictos/data/kalshi` | Kalshi (DFlow) data client |
|
|
302
|
-
| `investing/predictos/data/polymarket` | Polymarket (Dome) data client |
|
|
303
|
-
| `investing/predictos/agents` | `runEventAnalysisAgent`, `runBookmakerAgent`, `runMapperAgent` |
|
|
304
|
-
| `investing/predictos/arbitrage` | `findArbitrage` |
|
|
305
|
-
|
|
306
|
-
The barrel re-exports the Kalshi (DFlow) client at the top level. The Polymarket
|
|
307
|
-
(Dome) client exposes Kalshi helpers under the same names, so the barrel renames
|
|
308
|
-
those two to `getDomeKalshiMarketsByEvent` / `buildDomeKalshiMarketUrl` — import
|
|
309
|
-
from `investing/predictos/data/polymarket` for their original names. The
|
|
310
|
-
Gamma/CLOB trading client, Polyfactual and x402 are namespaced on the barrel as
|
|
311
|
-
`polymarketClob`, `polyfactual` and `x402` for the same reason.
|
|
312
|
-
|
|
313
|
-
#### Refactor notes (Deno → Node)
|
|
314
|
-
|
|
315
|
-
- Deno HTTP handlers (`Deno.serve`, `new Response(...)`, CORS headers) were
|
|
316
|
-
removed. Each endpoint is now a plain exported async function taking typed
|
|
317
|
-
parameters and returning a typed result; validation failures `throw`.
|
|
318
|
-
- `Deno.env.get("X")` was replaced with config/options objects
|
|
319
|
-
(`AIConfig`, `DataConfig`, per-call `apiKey`/`walletKey`) that fall back to
|
|
320
|
-
`process.env` (`OPENAI_API_KEY`, `XAI_API_KEY`, `BLOCKRUN_WALLET_KEY`,
|
|
321
|
-
`DOME_API_KEY`, `DFLOW_API_KEY`). No secrets are hardcoded.
|
|
322
|
-
- Remote (`https://...`) and `npm:` import specifiers were replaced with normal
|
|
323
|
-
package imports (`ethers`). The global `fetch` (Node 18+) is used throughout.
|
|
324
|
-
- Prompt text and analysis logic are preserved verbatim.
|
|
325
|
-
|
|
326
|
-
#### Not ported (yet)
|
|
327
|
-
|
|
328
|
-
Intentionally left out of the core port — noted for future work: the Next.js
|
|
329
|
-
`terminal/` frontend, the Python alpha-hunter examples, the **pay.sh** payment
|
|
330
|
-
serving flows, **Irys** verifiable-agent storage, wallet-tracking websockets, and
|
|
331
|
-
on-chain order execution (the mapper produces order parameters, but placing
|
|
332
|
-
orders is out of scope). The BlockRun client *is* ported (it only needs `ethers`
|
|
333
|
-
+ `fetch`), but its on-chain micropayment flow is untested in this environment.
|
|
334
|
-
|
|
335
218
|
### Trading Agents
|
|
336
219
|
|
|
337
220
|
```typescript
|
|
@@ -411,12 +294,6 @@ ALPACA_SECRET=your_secret_here
|
|
|
411
294
|
# OpenAI for AI-powered analysis
|
|
412
295
|
OPENAI_API_KEY=your_openai_key
|
|
413
296
|
|
|
414
|
-
# PredictOS: prediction-market analysis and data
|
|
415
|
-
XAI_API_KEY=your_xai_key # Grok/xAI
|
|
416
|
-
BLOCKRUN_WALLET_KEY=your_wallet_key # BlockRun x402 micropayments
|
|
417
|
-
DOME_API_KEY=your_dome_key # Polymarket market data
|
|
418
|
-
DFLOW_API_KEY=your_dflow_key # Kalshi market data
|
|
419
|
-
|
|
420
297
|
# Optional: Alternative LLM providers
|
|
421
298
|
ANTHROPIC_API_KEY=your_anthropic_key
|
|
422
299
|
GOOGLE_API_KEY=your_google_key
|
|
@@ -529,15 +406,7 @@ See the `/examples` directory for complete working examples:
|
|
|
529
406
|
|
|
530
407
|
- [GitHub Repository](https://github.com/vtempest/ai-broker-investment-agent)
|
|
531
408
|
- [Documentation](https://invest.vtempest.com/docs)
|
|
532
|
-
- [Agent skill](../../skills/ask-investing/SKILL.md)
|
|
533
409
|
- [Examples](./examples)
|
|
534
410
|
|
|
535
|
-
## Credits
|
|
536
|
-
|
|
537
|
-
The `predictos` module is a derivative work of
|
|
538
|
-
[PredictOS](https://github.com/PredictionXBT/PredictOS) — all original design and
|
|
539
|
-
logic © 2025 PredictionXBT, MIT licensed. See [`NOTICE`](./NOTICE) and
|
|
540
|
-
[`LICENSE-PredictOS-MIT`](./LICENSE-PredictOS-MIT).
|
|
541
|
-
|
|
542
411
|
- [GitHub Issues](https://github.com/vtempest/ai-broker-investment-agent/issues)
|
|
543
412
|
- [Documentation](https://invest.vtempest.com/docs)
|