agent-finance-cli 0.1.1 → 0.1.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/Cargo.lock +3928 -786
- package/Cargo.toml +3 -1
- package/README.md +7 -1
- package/package.json +6 -6
- package/skills/core-full.md +14 -0
- package/skills/core.md +9 -0
- package/skills/prediction-markets.md +47 -0
- package/skills/providers.md +2 -1
- package/src/app.rs +70 -7
- package/src/cli.rs +67 -4
- package/src/model.rs +83 -0
- package/src/output.rs +181 -8
- package/src/providers/capabilities.rs +49 -0
- package/src/providers/mod.rs +1 -0
- package/src/providers/polymarket.rs +1071 -0
- package/src/skills.rs +7 -1
- package/src/time.rs +70 -2
package/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "agent-finance-cli"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.3"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
license = "MIT OR Apache-2.0"
|
|
6
6
|
repository = "https://github.com/M4n5ter/agent-finance-cli"
|
|
@@ -29,3 +29,5 @@ zip = { version = "8.6.0", default-features = false, features = ["deflate"] }
|
|
|
29
29
|
scraper = "0.27.0"
|
|
30
30
|
wreq = { version = "6.0.0-rc.29", default-features = false, features = ["cookies", "deflate", "gzip", "json", "socks", "system-proxy", "tokio-rt", "webpki-roots"] }
|
|
31
31
|
wreq-util = "3.0.0-rc.12"
|
|
32
|
+
iana-time-zone = "0.1"
|
|
33
|
+
polymarket_client_sdk_v2 = { version = "*", features = ["clob", "gamma", "data"] }
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
AI Agent-first CLI for no-key financial market data and research context.
|
|
4
4
|
|
|
5
|
-
`agent-finance` is designed for human-operated AI agents: the CLI can print its own task-specific skills, then provide current quotes, regular/pre/post/overnight session splits, OHLCV history, local indicators, proxy futures data, no-key research payloads, URL text extraction, provider capability notes, polling, and Yahoo WebSocket streams.
|
|
5
|
+
`agent-finance` is designed for human-operated AI agents: the CLI can print its own task-specific skills, then provide current quotes, regular/pre/post/overnight session splits, OHLCV history, local indicators, proxy futures data, prediction-market sentiment, no-key research payloads, URL text extraction, provider capability notes, polling, and Yahoo WebSocket streams.
|
|
6
6
|
|
|
7
7
|
If you are an AI Agent, start here:
|
|
8
8
|
|
|
@@ -69,6 +69,10 @@ agent-finance read-url "https://www.sec.gov/Archives/edgar/data/0001807794/00016
|
|
|
69
69
|
agent-finance search "optical interconnect"
|
|
70
70
|
agent-finance screen day_gainers
|
|
71
71
|
agent-finance providers
|
|
72
|
+
|
|
73
|
+
# Prediction-market sentiment and event probabilities.
|
|
74
|
+
agent-finance polymarket search "spacex ipo" --limit 5
|
|
75
|
+
agent-finance polymarket market MARKET_ID_OR_SLUG --json
|
|
72
76
|
```
|
|
73
77
|
|
|
74
78
|
## Agent Skills
|
|
@@ -81,6 +85,7 @@ agent-finance skills get core --full
|
|
|
81
85
|
agent-finance skills get price
|
|
82
86
|
agent-finance skills get research-data
|
|
83
87
|
agent-finance skills get providers
|
|
88
|
+
agent-finance skills get prediction-markets
|
|
84
89
|
agent-finance skills get history-indicators
|
|
85
90
|
agent-finance skills get futures
|
|
86
91
|
```
|
|
@@ -92,6 +97,7 @@ agent-finance skills get futures
|
|
|
92
97
|
- `history` defaults to adjusted prices and includes corporate actions unless disabled.
|
|
93
98
|
- `providers` is the source-of-truth capability matrix. Do not infer coverage from provider names.
|
|
94
99
|
- Binance futures / TradFi perps are derivative/proxy prices. They are useful for 24h price discovery, but they are not the legal equity, broker fill, or pre-IPO ownership price.
|
|
100
|
+
- Polymarket is a prediction-market sentiment source. Use it for implied probabilities, orderbook, spread, volume, liquidity, open interest, holder preview rows, and probability history. It is not an equity quote, primary-source fact, or confirmation of insider information.
|
|
95
101
|
- `read-url` is an extraction fallback using direct/Jina/Defuddle readers. It is not a login-capable browser.
|
|
96
102
|
- Dynamic, login-gated, screenshot-sensitive, or noisy pages should be verified with a real browser tool. `agent-browser` and `opencli` are examples, not dependencies.
|
|
97
103
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-finance-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "AI Agent-first CLI for no-key financial market data and research context.",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"check:npm": "node npm/check-package.js"
|
|
32
32
|
},
|
|
33
33
|
"optionalDependencies": {
|
|
34
|
-
"agent-finance-cli-darwin-arm64": "0.1.
|
|
35
|
-
"agent-finance-cli-darwin-x64": "0.1.
|
|
36
|
-
"agent-finance-cli-linux-arm64": "0.1.
|
|
37
|
-
"agent-finance-cli-linux-x64": "0.1.
|
|
38
|
-
"agent-finance-cli-win32-x64": "0.1.
|
|
34
|
+
"agent-finance-cli-darwin-arm64": "0.1.3",
|
|
35
|
+
"agent-finance-cli-darwin-x64": "0.1.3",
|
|
36
|
+
"agent-finance-cli-linux-arm64": "0.1.3",
|
|
37
|
+
"agent-finance-cli-linux-x64": "0.1.3",
|
|
38
|
+
"agent-finance-cli-win32-x64": "0.1.3"
|
|
39
39
|
},
|
|
40
40
|
"keywords": [
|
|
41
41
|
"finance",
|
package/skills/core-full.md
CHANGED
|
@@ -10,6 +10,7 @@ agent-finance skills get core
|
|
|
10
10
|
agent-finance skills get price
|
|
11
11
|
agent-finance skills get research-data
|
|
12
12
|
agent-finance skills get providers
|
|
13
|
+
agent-finance skills get prediction-markets
|
|
13
14
|
agent-finance skills get history-indicators
|
|
14
15
|
agent-finance skills get futures
|
|
15
16
|
```
|
|
@@ -67,8 +68,21 @@ agent-finance futures LITEUSDT --json
|
|
|
67
68
|
|
|
68
69
|
Use `providers` as the source-of-truth coverage matrix. Binance futures / TradFi perps are derivative/proxy prices, not legal equity or broker-fill prices.
|
|
69
70
|
|
|
71
|
+
## Prediction Markets
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
agent-finance polymarket search "spacex ipo" --limit 5
|
|
75
|
+
agent-finance polymarket search "spcex" --limit 5
|
|
76
|
+
agent-finance polymarket market MARKET_ID_OR_SLUG --json
|
|
77
|
+
agent-finance skills get prediction-markets
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Use Polymarket for quantifiable sentiment and event-probability signals. It does not replace SEC/IR/company releases, verified news, or equity quotes.
|
|
81
|
+
|
|
70
82
|
## Network and Browser Boundaries
|
|
71
83
|
|
|
72
84
|
The CLI respects `--proxy`, `AGENT_FINANCE_PROXY`, and standard proxy environment variables. It does not hardcode a local proxy.
|
|
73
85
|
|
|
86
|
+
Polymarket uses the official SDK by default. When `--proxy` or `--no-proxy` is explicit, it uses public REST fallback through the CLI HTTP stack so those network controls are honored.
|
|
87
|
+
|
|
74
88
|
`read-url` is a text extraction fallback. For dynamic, login-gated, screenshot-sensitive, or noisy pages, open the original page with an available real browser tool such as agent-browser or opencli.
|
package/skills/core.md
CHANGED
|
@@ -48,6 +48,14 @@ agent-finance search "optical interconnect"
|
|
|
48
48
|
agent-finance screen day_gainers
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
5. Prediction-market sentiment:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
agent-finance polymarket search "spacex ipo" --limit 5
|
|
55
|
+
agent-finance polymarket market MARKET_ID_OR_SLUG
|
|
56
|
+
agent-finance skills get prediction-markets
|
|
57
|
+
```
|
|
58
|
+
|
|
51
59
|
## Rules
|
|
52
60
|
|
|
53
61
|
- Use `price` for the default "what is the current price?" answer.
|
|
@@ -55,5 +63,6 @@ agent-finance screen day_gainers
|
|
|
55
63
|
- Use both daily and minute history before judging fills, limit-order quality, stop placement, or intraday action.
|
|
56
64
|
- Use `providers --json` when an Agent needs a machine-readable capability matrix.
|
|
57
65
|
- Treat Binance futures / TradFi perps as proxy/derivative price discovery only.
|
|
66
|
+
- Treat Polymarket as quantifiable prediction-market sentiment and event-probability evidence only; it is not an equity quote or primary-source fact.
|
|
58
67
|
- `read-url` is a text extraction fallback, not a real browser. For dynamic, login-gated, screenshot-sensitive, or noisy pages, use an available browser tool such as agent-browser or opencli.
|
|
59
68
|
- JSON output preserves structured fields for downstream computation. Human output is for quick inspection.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# agent-finance prediction-markets skill
|
|
2
|
+
|
|
3
|
+
Use this skill when an AI Agent needs prediction-market sentiment, event probabilities, or "what capital is pricing in" for a public event.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
agent-finance polymarket search "spacex ipo" --limit 5
|
|
9
|
+
agent-finance polymarket search "spcex" --limit 5
|
|
10
|
+
agent-finance polymarket market MARKET_ID_OR_SLUG
|
|
11
|
+
agent-finance polymarket market MARKET_ID_OR_SLUG --json
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Search Semantics
|
|
15
|
+
|
|
16
|
+
- Treat Polymarket search as public relevance search. Do not describe it as guaranteed fuzzy search.
|
|
17
|
+
- Use multiple query fallbacks for important topics:
|
|
18
|
+
- `spacex`, `space x`, `starship`, `ipo`
|
|
19
|
+
- `nvidia`, `nvda`, product names, regulatory events
|
|
20
|
+
- The CLI locally filters and sorts by active/closed state, volume, liquidity, and market signal strength. Still inspect source URLs and raw JSON for important decisions.
|
|
21
|
+
|
|
22
|
+
## Interpretation Rules
|
|
23
|
+
|
|
24
|
+
- Polymarket prices are implied probabilities backed by user capital.
|
|
25
|
+
- They are useful as quantifiable sentiment and event-probability evidence.
|
|
26
|
+
- They are not facts, confirmed insider information, legal equity prices, broker-fill prices, or official company disclosures.
|
|
27
|
+
- For investment research, pair this signal with primary sources: SEC filings, IR pages, company releases, earnings calls, and verifiable news.
|
|
28
|
+
|
|
29
|
+
## Useful Flags
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
agent-finance polymarket search "spacex ipo" --include-closed --min-volume 1000 --json
|
|
33
|
+
agent-finance polymarket market MARKET_ID_OR_SLUG --limit 20 --refresh
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- `--include-closed`: include resolved/closed markets for historical expectation checks.
|
|
37
|
+
- `--min-volume`: ignore thin markets.
|
|
38
|
+
- `--refresh`: bypass local cache.
|
|
39
|
+
- `--cache-ttl-seconds`: tune freshness for repeated agent workflows.
|
|
40
|
+
- `--json`: preserve full structured payloads for downstream reasoning.
|
|
41
|
+
|
|
42
|
+
## Boundaries
|
|
43
|
+
|
|
44
|
+
- This CLI is read-only for Polymarket.
|
|
45
|
+
- It does not accept private keys, derive API keys, place orders, cancel orders, or manage Polymarket positions.
|
|
46
|
+
- Default transport uses the official SDK. Explicit `--proxy` or `--no-proxy` uses public REST fallback through the CLI HTTP stack so those network controls are honored.
|
|
47
|
+
- Holder data is reported as preview rows returned by the API limit, not as a total holder count.
|
package/skills/providers.md
CHANGED
|
@@ -19,7 +19,8 @@ agent-finance providers --json
|
|
|
19
19
|
- Robinhood and CNBC are partial no-key sources; use them as cross-checks, not replacements for official filings or primary disclosures.
|
|
20
20
|
- Stooq live can provide no-key daily/weekly/monthly history; intraday bulk data requires explicit imported ZIP cache.
|
|
21
21
|
- Binance futures / TradFi perps are proxy/derivative instruments.
|
|
22
|
+
- Polymarket is a prediction-market sentiment source. Use `polymarket search` and `polymarket market` for implied probability, orderbook, liquidity, OI, holder preview rows, and probability history; do not use it as an equity quote or primary-source fact.
|
|
22
23
|
|
|
23
24
|
## Browser Boundary
|
|
24
25
|
|
|
25
|
-
The CLI uses HTTP requests with browser-like TLS behavior where possible, but it is not a full browser. Dynamic, login-gated, screenshot-sensitive, or noisy pages require a real browser tool.
|
|
26
|
+
The CLI uses HTTP requests with browser-like TLS behavior where possible, but it is not a full browser. Dynamic, login-gated, screenshot-sensitive, or noisy pages require a real browser tool. Polymarket uses the official SDK by default; explicit `--proxy` or `--no-proxy` uses public REST fallback through the CLI HTTP stack.
|
package/src/app.rs
CHANGED
|
@@ -8,8 +8,9 @@ use serde::Serialize;
|
|
|
8
8
|
|
|
9
9
|
use crate::cli::{
|
|
10
10
|
Cli, Command, FuturesArgs, HistoryArgs, HistorySession, IndicatorsArgs, NewsArgs, OptionsArgs,
|
|
11
|
-
OptionsProvider,
|
|
12
|
-
ScreenArgs, SearchArgs, SessionsArgs, StooqArgs,
|
|
11
|
+
OptionsProvider, PolymarketArgs, PolymarketCommand, Provider, ProviderResearchArgs,
|
|
12
|
+
ProvidersArgs, ReadUrlArgs, ResearchArgs, ScreenArgs, SearchArgs, SessionsArgs, StooqArgs,
|
|
13
|
+
StooqCommand, WatchArgs,
|
|
13
14
|
};
|
|
14
15
|
use crate::http::http_client;
|
|
15
16
|
use crate::indicators::compute_indicator;
|
|
@@ -21,21 +22,27 @@ use crate::providers::{self, binance_futures, stooq};
|
|
|
21
22
|
use crate::research;
|
|
22
23
|
use crate::skills;
|
|
23
24
|
use crate::stream;
|
|
25
|
+
use crate::time::resolve_timezone;
|
|
24
26
|
|
|
25
27
|
pub async fn run() -> Result<()> {
|
|
26
28
|
let cli = Cli::parse();
|
|
27
29
|
let proxy = cli.proxy.as_deref();
|
|
28
30
|
let no_proxy = cli.no_proxy;
|
|
29
|
-
let timezone = cli.timezone.
|
|
31
|
+
let timezone = resolve_timezone(cli.timezone.as_deref())?;
|
|
32
|
+
let timezone = timezone.as_str();
|
|
30
33
|
let timeout_seconds = cli.timeout_seconds;
|
|
31
34
|
match cli.command {
|
|
32
35
|
Command::Price(args) => run_price(args, proxy, no_proxy, timeout_seconds, timezone).await,
|
|
33
36
|
Command::Sessions(args) => {
|
|
34
37
|
run_sessions(args, proxy, no_proxy, timeout_seconds, timezone).await
|
|
35
38
|
}
|
|
36
|
-
Command::History(args) =>
|
|
39
|
+
Command::History(args) => {
|
|
40
|
+
run_history(args, proxy, no_proxy, timeout_seconds, timezone).await
|
|
41
|
+
}
|
|
37
42
|
Command::Indicators(args) => run_indicators(args, proxy, no_proxy, timeout_seconds).await,
|
|
38
|
-
Command::Futures(args) =>
|
|
43
|
+
Command::Futures(args) => {
|
|
44
|
+
run_futures(args, proxy, no_proxy, timeout_seconds, timezone).await
|
|
45
|
+
}
|
|
39
46
|
Command::Fundamentals(args) => {
|
|
40
47
|
run_provider_quote_summary(
|
|
41
48
|
args,
|
|
@@ -88,6 +95,9 @@ pub async fn run() -> Result<()> {
|
|
|
88
95
|
Command::News(args) => run_news(args, proxy, no_proxy, timeout_seconds, timezone).await,
|
|
89
96
|
Command::ReadUrl(args) => run_read_url(args, proxy, no_proxy, timeout_seconds).await,
|
|
90
97
|
Command::Search(args) => run_search(args, proxy, no_proxy, timeout_seconds, timezone).await,
|
|
98
|
+
Command::Polymarket(args) => {
|
|
99
|
+
run_polymarket(args, proxy, no_proxy, timeout_seconds, timezone).await
|
|
100
|
+
}
|
|
91
101
|
Command::Screen(args) => run_screen(args, proxy, no_proxy, timeout_seconds, timezone).await,
|
|
92
102
|
Command::Stooq(args) => run_stooq(args, proxy, no_proxy, timeout_seconds).await,
|
|
93
103
|
Command::Providers(args) => run_providers(args),
|
|
@@ -97,6 +107,57 @@ pub async fn run() -> Result<()> {
|
|
|
97
107
|
}
|
|
98
108
|
}
|
|
99
109
|
|
|
110
|
+
async fn run_polymarket(
|
|
111
|
+
args: PolymarketArgs,
|
|
112
|
+
proxy: Option<&str>,
|
|
113
|
+
no_proxy: bool,
|
|
114
|
+
timeout_seconds: u64,
|
|
115
|
+
timezone: &str,
|
|
116
|
+
) -> Result<()> {
|
|
117
|
+
let client = http_client(timeout_seconds, proxy, no_proxy)?;
|
|
118
|
+
let use_http_transport = proxy.is_some() || no_proxy;
|
|
119
|
+
match args.command {
|
|
120
|
+
PolymarketCommand::Search(args) => {
|
|
121
|
+
let options = providers::polymarket::SearchRequestOptions {
|
|
122
|
+
query: args.query,
|
|
123
|
+
limit: args.limit,
|
|
124
|
+
include_closed: args.include_closed,
|
|
125
|
+
min_volume: args.min_volume,
|
|
126
|
+
refresh: args.refresh,
|
|
127
|
+
cache_ttl_seconds: args.cache_ttl_seconds,
|
|
128
|
+
timeout_seconds,
|
|
129
|
+
use_http_transport,
|
|
130
|
+
};
|
|
131
|
+
let report = providers::polymarket::search_report(&client, &options, timezone).await?;
|
|
132
|
+
if args.json {
|
|
133
|
+
println!("{}", serde_json::to_string_pretty(&report)?);
|
|
134
|
+
} else {
|
|
135
|
+
output::print_prediction_search_report(&report);
|
|
136
|
+
}
|
|
137
|
+
Ok(())
|
|
138
|
+
}
|
|
139
|
+
PolymarketCommand::Market(args) => {
|
|
140
|
+
let options = providers::polymarket::MarketRequestOptions {
|
|
141
|
+
identifier: args.identifier,
|
|
142
|
+
limit: args.limit,
|
|
143
|
+
include_closed: args.include_closed,
|
|
144
|
+
min_volume: args.min_volume,
|
|
145
|
+
refresh: args.refresh,
|
|
146
|
+
cache_ttl_seconds: args.cache_ttl_seconds,
|
|
147
|
+
timeout_seconds,
|
|
148
|
+
use_http_transport,
|
|
149
|
+
};
|
|
150
|
+
let report = providers::polymarket::market_report(&client, &options, timezone).await?;
|
|
151
|
+
if args.json {
|
|
152
|
+
println!("{}", serde_json::to_string_pretty(&report)?);
|
|
153
|
+
} else {
|
|
154
|
+
output::print_prediction_market_report(&report);
|
|
155
|
+
}
|
|
156
|
+
Ok(())
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
100
161
|
fn run_skills(args: crate::cli::SkillsArgs) -> Result<()> {
|
|
101
162
|
match args.command {
|
|
102
163
|
crate::cli::SkillsCommand::List => {
|
|
@@ -193,6 +254,7 @@ async fn run_history(
|
|
|
193
254
|
proxy: Option<&str>,
|
|
194
255
|
no_proxy: bool,
|
|
195
256
|
timeout_seconds: u64,
|
|
257
|
+
timezone: &str,
|
|
196
258
|
) -> Result<()> {
|
|
197
259
|
let client = http_client(timeout_seconds, proxy, no_proxy)?;
|
|
198
260
|
let provider = effective_history_provider(args.provider, args.session);
|
|
@@ -213,7 +275,7 @@ async fn run_history(
|
|
|
213
275
|
if args.json {
|
|
214
276
|
println!("{}", serde_json::to_string_pretty(&history)?);
|
|
215
277
|
} else {
|
|
216
|
-
output::print_history_table(&history);
|
|
278
|
+
output::print_history_table(&history, timezone);
|
|
217
279
|
}
|
|
218
280
|
Ok(())
|
|
219
281
|
}
|
|
@@ -291,6 +353,7 @@ async fn run_futures(
|
|
|
291
353
|
proxy: Option<&str>,
|
|
292
354
|
no_proxy: bool,
|
|
293
355
|
timeout_seconds: u64,
|
|
356
|
+
timezone: &str,
|
|
294
357
|
) -> Result<()> {
|
|
295
358
|
let client = http_client(timeout_seconds, proxy, no_proxy)?;
|
|
296
359
|
let stats =
|
|
@@ -299,7 +362,7 @@ async fn run_futures(
|
|
|
299
362
|
if args.json {
|
|
300
363
|
println!("{}", serde_json::to_string_pretty(&stats)?);
|
|
301
364
|
} else {
|
|
302
|
-
output::print_futures_stats(&stats);
|
|
365
|
+
output::print_futures_stats(&stats, timezone);
|
|
303
366
|
}
|
|
304
367
|
|
|
305
368
|
if stats.errors.is_empty() {
|
package/src/cli.rs
CHANGED
|
@@ -2,7 +2,6 @@ use std::path::PathBuf;
|
|
|
2
2
|
|
|
3
3
|
use clap::{Parser, Subcommand, ValueEnum};
|
|
4
4
|
|
|
5
|
-
use crate::time::DEFAULT_TIMEZONE;
|
|
6
5
|
pub const HISTORY_INTERVAL_HELP: &str = "Bar interval. Provider-specific values: Yahoo 1m/2m/5m/15m/30m/60m/90m/1h/1d/5d/1wk/1mo/3mo; Robinhood 5m/10m/1h/1d/1w; Stooq live 1d/1w/1mo; Stooq bulk 5m/1h after sync; Binance klines 1m/3m/5m/15m/30m/1h/2h/4h/6h/8h/12h/1d/3d/1w/1M.";
|
|
7
6
|
|
|
8
7
|
#[derive(Parser, Debug)]
|
|
@@ -21,9 +20,10 @@ pub struct Cli {
|
|
|
21
20
|
#[arg(long, global = true)]
|
|
22
21
|
pub no_proxy: bool,
|
|
23
22
|
|
|
24
|
-
/// Human-output timezone.
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
/// Human-output timezone. Defaults to the machine's local IANA timezone.
|
|
24
|
+
/// UTC is still preserved in JSON fields.
|
|
25
|
+
#[arg(long, global = true)]
|
|
26
|
+
pub timezone: Option<String>,
|
|
27
27
|
|
|
28
28
|
/// HTTP timeout in seconds.
|
|
29
29
|
#[arg(long, global = true, default_value_t = 10)]
|
|
@@ -61,6 +61,8 @@ pub enum Command {
|
|
|
61
61
|
ReadUrl(ReadUrlArgs),
|
|
62
62
|
/// Search Yahoo Finance for tickers and news.
|
|
63
63
|
Search(SearchArgs),
|
|
64
|
+
/// Inspect Polymarket prediction-market sentiment and event-probability signals.
|
|
65
|
+
Polymarket(PolymarketArgs),
|
|
64
66
|
/// Run Yahoo predefined screeners.
|
|
65
67
|
Screen(ScreenArgs),
|
|
66
68
|
/// Inspect or import Stooq bulk historical data packages.
|
|
@@ -341,6 +343,67 @@ pub struct SearchArgs {
|
|
|
341
343
|
pub json: bool,
|
|
342
344
|
}
|
|
343
345
|
|
|
346
|
+
#[derive(Parser, Debug)]
|
|
347
|
+
pub struct PolymarketArgs {
|
|
348
|
+
#[command(subcommand)]
|
|
349
|
+
pub command: PolymarketCommand,
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
#[derive(Subcommand, Debug)]
|
|
353
|
+
pub enum PolymarketCommand {
|
|
354
|
+
/// Search public Polymarket events and markets by relevance.
|
|
355
|
+
Search(PolymarketSearchArgs),
|
|
356
|
+
/// Inspect one Polymarket market by numeric id or slug.
|
|
357
|
+
Market(PolymarketMarketArgs),
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
#[derive(Parser, Debug)]
|
|
361
|
+
pub struct PolymarketSearchArgs {
|
|
362
|
+
pub query: String,
|
|
363
|
+
|
|
364
|
+
#[arg(long, default_value_t = 8)]
|
|
365
|
+
pub limit: usize,
|
|
366
|
+
|
|
367
|
+
#[arg(long)]
|
|
368
|
+
pub include_closed: bool,
|
|
369
|
+
|
|
370
|
+
#[arg(long)]
|
|
371
|
+
pub min_volume: Option<f64>,
|
|
372
|
+
|
|
373
|
+
#[arg(long)]
|
|
374
|
+
pub refresh: bool,
|
|
375
|
+
|
|
376
|
+
#[arg(long, default_value_t = 900)]
|
|
377
|
+
pub cache_ttl_seconds: u64,
|
|
378
|
+
|
|
379
|
+
#[arg(long)]
|
|
380
|
+
pub json: bool,
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
#[derive(Parser, Debug)]
|
|
384
|
+
pub struct PolymarketMarketArgs {
|
|
385
|
+
pub identifier: String,
|
|
386
|
+
|
|
387
|
+
/// Maximum rows for holder/trade/orderbook detail previews.
|
|
388
|
+
#[arg(long, default_value_t = 10)]
|
|
389
|
+
pub limit: usize,
|
|
390
|
+
|
|
391
|
+
#[arg(long)]
|
|
392
|
+
pub include_closed: bool,
|
|
393
|
+
|
|
394
|
+
#[arg(long)]
|
|
395
|
+
pub min_volume: Option<f64>,
|
|
396
|
+
|
|
397
|
+
#[arg(long)]
|
|
398
|
+
pub refresh: bool,
|
|
399
|
+
|
|
400
|
+
#[arg(long, default_value_t = 900)]
|
|
401
|
+
pub cache_ttl_seconds: u64,
|
|
402
|
+
|
|
403
|
+
#[arg(long)]
|
|
404
|
+
pub json: bool,
|
|
405
|
+
}
|
|
406
|
+
|
|
344
407
|
#[derive(Parser, Debug)]
|
|
345
408
|
pub struct ScreenArgs {
|
|
346
409
|
/// Yahoo predefined screener id, for example most_actives, day_gainers, day_losers.
|
package/src/model.rs
CHANGED
|
@@ -325,6 +325,89 @@ pub struct SearchReport {
|
|
|
325
325
|
pub payload: Value,
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
+
#[derive(Debug, Clone, Serialize)]
|
|
329
|
+
pub struct PredictionSearchReport {
|
|
330
|
+
pub provider: String,
|
|
331
|
+
pub query: String,
|
|
332
|
+
pub fetched_at_utc: String,
|
|
333
|
+
pub fetched_at_local: String,
|
|
334
|
+
pub cache_status: String,
|
|
335
|
+
pub source_urls: Vec<String>,
|
|
336
|
+
pub interpretation_note: String,
|
|
337
|
+
pub markets: Vec<PredictionMarketSummary>,
|
|
338
|
+
pub payload: Value,
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
#[derive(Debug, Clone, Serialize)]
|
|
342
|
+
pub struct PredictionMarketReport {
|
|
343
|
+
pub provider: String,
|
|
344
|
+
pub identifier: String,
|
|
345
|
+
pub fetched_at_utc: String,
|
|
346
|
+
pub fetched_at_local: String,
|
|
347
|
+
pub cache_status: String,
|
|
348
|
+
pub enrichment_status: String,
|
|
349
|
+
pub enrichment_fetched_at_utc: String,
|
|
350
|
+
pub enrichment_fetched_at_local: String,
|
|
351
|
+
pub source_urls: Vec<String>,
|
|
352
|
+
pub interpretation_note: String,
|
|
353
|
+
pub market: PredictionMarketSummary,
|
|
354
|
+
pub outcomes: Vec<PredictionOutcome>,
|
|
355
|
+
pub price_history: Vec<PredictionPricePoint>,
|
|
356
|
+
pub open_interest: Option<f64>,
|
|
357
|
+
pub holder_preview_count: Option<usize>,
|
|
358
|
+
pub data_errors: BTreeMap<String, String>,
|
|
359
|
+
pub payload: Value,
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
#[derive(Debug, Clone, Serialize)]
|
|
363
|
+
pub struct PredictionMarketSummary {
|
|
364
|
+
pub id: Option<String>,
|
|
365
|
+
pub condition_id: Option<String>,
|
|
366
|
+
pub slug: Option<String>,
|
|
367
|
+
pub event_id: Option<String>,
|
|
368
|
+
pub event_slug: Option<String>,
|
|
369
|
+
pub title: String,
|
|
370
|
+
pub question: Option<String>,
|
|
371
|
+
pub active: Option<bool>,
|
|
372
|
+
pub closed: Option<bool>,
|
|
373
|
+
pub accepting_orders: Option<bool>,
|
|
374
|
+
pub end_time_utc: Option<String>,
|
|
375
|
+
pub end_time_local: Option<String>,
|
|
376
|
+
pub volume: Option<f64>,
|
|
377
|
+
pub volume_24hr: Option<f64>,
|
|
378
|
+
pub liquidity: Option<f64>,
|
|
379
|
+
pub open_interest: Option<f64>,
|
|
380
|
+
pub best_bid: Option<f64>,
|
|
381
|
+
pub best_ask: Option<f64>,
|
|
382
|
+
pub spread: Option<f64>,
|
|
383
|
+
pub last_trade_price: Option<f64>,
|
|
384
|
+
pub one_hour_price_change: Option<f64>,
|
|
385
|
+
pub one_day_price_change: Option<f64>,
|
|
386
|
+
pub one_week_price_change: Option<f64>,
|
|
387
|
+
pub market_url: Option<String>,
|
|
388
|
+
pub outcomes: Vec<PredictionOutcome>,
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
#[derive(Debug, Clone, Serialize)]
|
|
392
|
+
pub struct PredictionOutcome {
|
|
393
|
+
pub label: String,
|
|
394
|
+
pub implied_probability: Option<f64>,
|
|
395
|
+
pub clob_token_id: Option<String>,
|
|
396
|
+
pub best_bid: Option<f64>,
|
|
397
|
+
pub best_ask: Option<f64>,
|
|
398
|
+
pub spread: Option<f64>,
|
|
399
|
+
pub last_trade_price: Option<f64>,
|
|
400
|
+
pub bid_count: usize,
|
|
401
|
+
pub ask_count: usize,
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
#[derive(Debug, Clone, Serialize)]
|
|
405
|
+
pub struct PredictionPricePoint {
|
|
406
|
+
pub time_utc: Option<String>,
|
|
407
|
+
pub time_local: Option<String>,
|
|
408
|
+
pub price: f64,
|
|
409
|
+
}
|
|
410
|
+
|
|
328
411
|
#[derive(Debug, Clone, Serialize)]
|
|
329
412
|
pub struct StreamQuote {
|
|
330
413
|
pub symbol: String,
|