agent-finance-cli 0.1.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.
Files changed (48) hide show
  1. package/Cargo.lock +2632 -0
  2. package/Cargo.toml +31 -0
  3. package/LICENSE-APACHE +202 -0
  4. package/LICENSE-MIT +21 -0
  5. package/README.md +119 -0
  6. package/bin/agent-finance.js +27 -0
  7. package/npm/check-binary-links.js +50 -0
  8. package/npm/check-package.js +39 -0
  9. package/npm/create-platform-package.js +90 -0
  10. package/npm/platform.js +33 -0
  11. package/npm/postinstall.js +62 -0
  12. package/npm/resolve-binary.js +38 -0
  13. package/package.json +54 -0
  14. package/skills/core-full.md +74 -0
  15. package/skills/core.md +59 -0
  16. package/skills/futures.md +18 -0
  17. package/skills/history-indicators.md +42 -0
  18. package/skills/price.md +40 -0
  19. package/skills/providers.md +25 -0
  20. package/skills/research-data.md +34 -0
  21. package/src/app.rs +642 -0
  22. package/src/cache.rs +67 -0
  23. package/src/cli.rs +651 -0
  24. package/src/history.rs +150 -0
  25. package/src/http.rs +76 -0
  26. package/src/indicators.rs +82 -0
  27. package/src/lib.rs +15 -0
  28. package/src/main.rs +4 -0
  29. package/src/model.rs +347 -0
  30. package/src/output.rs +544 -0
  31. package/src/page_read.rs +443 -0
  32. package/src/price.rs +255 -0
  33. package/src/providers/binance_futures.rs +342 -0
  34. package/src/providers/capabilities.rs +322 -0
  35. package/src/providers/cnbc.rs +302 -0
  36. package/src/providers/mod.rs +117 -0
  37. package/src/providers/robinhood.rs +580 -0
  38. package/src/providers/sec_edgar.rs +399 -0
  39. package/src/providers/stooq/catalog.rs +159 -0
  40. package/src/providers/stooq.rs +904 -0
  41. package/src/providers/yahoo.rs +836 -0
  42. package/src/research/fetchers.rs +111 -0
  43. package/src/research/highlights.rs +345 -0
  44. package/src/research/mod.rs +943 -0
  45. package/src/research/tests.rs +42 -0
  46. package/src/skills.rs +58 -0
  47. package/src/stream.rs +356 -0
  48. package/src/time.rs +21 -0
@@ -0,0 +1,38 @@
1
+ const fs = require("node:fs");
2
+ const path = require("node:path");
3
+
4
+ const { executableName, localBuildBinary, platformPackageName } = require("./platform");
5
+
6
+ function resolveBinary(options = {}) {
7
+ const root = path.resolve(__dirname, "..");
8
+ const packageName = platformPackageName();
9
+
10
+ if (packageName) {
11
+ try {
12
+ const packageJson = require.resolve(`${packageName}/package.json`, {
13
+ paths: [root],
14
+ });
15
+ const binary = path.join(path.dirname(packageJson), "bin", executableName());
16
+ if (fs.existsSync(binary)) {
17
+ return binary;
18
+ }
19
+ } catch (error) {
20
+ if (!isMissingPackage(error) && !options.silent) {
21
+ throw error;
22
+ }
23
+ }
24
+ }
25
+
26
+ const fallback = localBuildBinary(root);
27
+ if (fs.existsSync(fallback)) {
28
+ return fallback;
29
+ }
30
+
31
+ return undefined;
32
+ }
33
+
34
+ function isMissingPackage(error) {
35
+ return error && error.code === "MODULE_NOT_FOUND";
36
+ }
37
+
38
+ module.exports = { resolveBinary };
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "agent-finance-cli",
3
+ "version": "0.1.0",
4
+ "description": "AI Agent-first CLI for no-key financial market data and research context.",
5
+ "license": "MIT OR Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/M4n5ter/agent-finance-cli.git"
9
+ },
10
+ "homepage": "https://github.com/M4n5ter/agent-finance-cli#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/M4n5ter/agent-finance-cli/issues"
13
+ },
14
+ "bin": {
15
+ "agent-finance": "bin/agent-finance.js"
16
+ },
17
+ "files": [
18
+ "bin/",
19
+ "npm/",
20
+ "skills/",
21
+ "src/",
22
+ "Cargo.toml",
23
+ "Cargo.lock",
24
+ "README.md",
25
+ "LICENSE-MIT",
26
+ "LICENSE-APACHE"
27
+ ],
28
+ "scripts": {
29
+ "postinstall": "node npm/postinstall.js",
30
+ "prepack": "cargo fmt --check && cargo clippy --all-targets && cargo test --locked",
31
+ "check:npm": "node npm/check-package.js"
32
+ },
33
+ "optionalDependencies": {
34
+ "agent-finance-cli-darwin-arm64": "0.1.0",
35
+ "agent-finance-cli-darwin-x64": "0.1.0",
36
+ "agent-finance-cli-linux-arm64": "0.1.0",
37
+ "agent-finance-cli-linux-x64": "0.1.0",
38
+ "agent-finance-cli-win32-x64": "0.1.0"
39
+ },
40
+ "keywords": [
41
+ "finance",
42
+ "market-data",
43
+ "cli",
44
+ "ai-agent",
45
+ "yahoo-finance",
46
+ "sec-edgar"
47
+ ],
48
+ "engines": {
49
+ "node": ">=18"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
53
+ }
54
+ }
@@ -0,0 +1,74 @@
1
+ # agent-finance full core skill
2
+
3
+ Read this when you need the full command map for `agent-finance`.
4
+
5
+ ## Command Map
6
+
7
+ ```bash
8
+ agent-finance skills list
9
+ agent-finance skills get core
10
+ agent-finance skills get price
11
+ agent-finance skills get research-data
12
+ agent-finance skills get providers
13
+ agent-finance skills get history-indicators
14
+ agent-finance skills get futures
15
+ ```
16
+
17
+ ## Price and Sessions
18
+
19
+ ```bash
20
+ agent-finance price CRDO
21
+ agent-finance price CRDO MRVL --json
22
+ agent-finance sessions CRDO
23
+ agent-finance sessions LITE --proxy-symbol LITEUSDT
24
+ ```
25
+
26
+ `price` answers the default current-price question. `sessions` compares regular/pre/post/overnight/provider/proxy sources.
27
+
28
+ ## History and Indicators
29
+
30
+ ```bash
31
+ agent-finance history CRDO --range 1mo --interval 1d
32
+ agent-finance history CRDO --range 5d --interval 1m --session extended --adjustment raw --no-actions
33
+ agent-finance history CRDO --range 1y --interval 1d --adjustment auto --repair
34
+ agent-finance indicators CRDO MRVL --limit 120
35
+ ```
36
+
37
+ Use history before making order, fill, stop-loss, take-profit, or intraday trend judgments. Indicators are summaries; they do not replace the bar path.
38
+
39
+ ## Research Data
40
+
41
+ ```bash
42
+ agent-finance fundamentals CRDO
43
+ agent-finance fundamentals CRDO --provider sec-edgar
44
+ agent-finance fundamentals CRDO --provider robinhood
45
+ agent-finance fundamentals CRDO --provider cnbc
46
+ agent-finance analysis CRDO
47
+ agent-finance options CRDO
48
+ agent-finance options CRDO --provider robinhood --count 80
49
+ agent-finance ownership CRDO
50
+ agent-finance events CRDO --provider sec-edgar
51
+ agent-finance news CRDO
52
+ agent-finance read-url "https://www.sec.gov/Archives/edgar/data/0001807794/000162828026014017/crdo-20260131.htm"
53
+ agent-finance search "optical interconnect"
54
+ agent-finance screen day_gainers
55
+ ```
56
+
57
+ Research reports include sources, modules, coverage gaps, highlights, and raw payloads in JSON mode.
58
+
59
+ ## Providers and Proxy Data
60
+
61
+ ```bash
62
+ agent-finance providers
63
+ agent-finance providers --json
64
+ agent-finance futures SPCXUSDT
65
+ agent-finance futures LITEUSDT --json
66
+ ```
67
+
68
+ 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
+ ## Network and Browser Boundaries
71
+
72
+ The CLI respects `--proxy`, `AGENT_FINANCE_PROXY`, and standard proxy environment variables. It does not hardcode a local proxy.
73
+
74
+ `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 ADDED
@@ -0,0 +1,59 @@
1
+ # agent-finance core skill
2
+
3
+ This skill is printed by the `agent-finance` CLI. It is the first thing an AI Agent should read before using the tool.
4
+
5
+ ## Start Here
6
+
7
+ ```bash
8
+ agent-finance skills list
9
+ agent-finance skills get core --full
10
+ agent-finance providers
11
+ ```
12
+
13
+ ## Default Workflow
14
+
15
+ 1. Current observable price:
16
+
17
+ ```bash
18
+ agent-finance price CRDO
19
+ agent-finance price CRDO --json
20
+ ```
21
+
22
+ 2. Precise session/provider split:
23
+
24
+ ```bash
25
+ agent-finance sessions CRDO
26
+ agent-finance sessions LITE --proxy-symbol LITEUSDT
27
+ ```
28
+
29
+ 3. History before a trading or order-quality conclusion:
30
+
31
+ ```bash
32
+ agent-finance history LITE --interval 1d --range 1mo --adjustment auto --limit 30
33
+ agent-finance history LITE --interval 1m --range 5d --session extended --adjustment raw --no-actions --limit 120
34
+ ```
35
+
36
+ 4. Research data:
37
+
38
+ ```bash
39
+ agent-finance fundamentals CRDO
40
+ agent-finance fundamentals CRDO --provider sec-edgar
41
+ agent-finance analysis CRDO
42
+ agent-finance options CRDO
43
+ agent-finance ownership CRDO
44
+ agent-finance events CRDO --provider sec-edgar
45
+ agent-finance news CRDO
46
+ agent-finance read-url "https://www.sec.gov/Archives/edgar/data/0001807794/000162828026014017/crdo-20260131.htm"
47
+ agent-finance search "optical interconnect"
48
+ agent-finance screen day_gainers
49
+ ```
50
+
51
+ ## Rules
52
+
53
+ - Use `price` for the default "what is the current price?" answer.
54
+ - Use `sessions` when premarket, postmarket, overnight, BOATS, provider differences, or proxy prices matter.
55
+ - Use both daily and minute history before judging fills, limit-order quality, stop placement, or intraday action.
56
+ - Use `providers --json` when an Agent needs a machine-readable capability matrix.
57
+ - Treat Binance futures / TradFi perps as proxy/derivative price discovery only.
58
+ - `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
+ - JSON output preserves structured fields for downstream computation. Human output is for quick inspection.
@@ -0,0 +1,18 @@
1
+ # agent-finance futures and proxy skill
2
+
3
+ Use this for Binance USD-M futures / TradFi perps such as `SPCXUSDT` and `LITEUSDT`.
4
+
5
+ ```bash
6
+ agent-finance futures SPCXUSDT --funding-limit 8
7
+ agent-finance futures LITEUSDT --funding-limit 8 --json
8
+ ```
9
+
10
+ Fields:
11
+
12
+ - `last_price`: latest 24h ticker trade price.
13
+ - `mark_price`: risk and funding reference price.
14
+ - `index_price`: index reference price.
15
+ - `funding`: funding rate.
16
+ - `open_interest`: open interest.
17
+
18
+ Risk rule: proxy/perpetual contracts are derivatives. They are not the legal equity, pre-IPO ownership, or broker-fill price.
@@ -0,0 +1,42 @@
1
+ # agent-finance history and indicators skill
2
+
3
+ ## History
4
+
5
+ ```bash
6
+ agent-finance history LITE --provider auto --interval 1d --range 1mo --limit 30
7
+ agent-finance history LITE --interval 1m --range 5d --session extended --adjustment raw --no-actions --limit 200
8
+ agent-finance history LITE --interval 1d --range 1y --adjustment auto --repair --limit 252
9
+ agent-finance history AAPL --provider robinhood --interval 5m --range 1d --session extended --limit 80
10
+ agent-finance history LITEUSDT --provider binance-futures --interval 1d --limit 30
11
+ ```
12
+
13
+ ## Intervals
14
+
15
+ - Yahoo / Yahoo extended: `1m`, `2m`, `5m`, `15m`, `30m`, `60m`, `90m`, `1h`, `1d`, `5d`, `1wk`, `1mo`, `3mo`.
16
+ - Robinhood: `5m`, `10m`, `1h`, `1d`, `1w`.
17
+ - Stooq live: `1d`, `1w`, `1mo`.
18
+ - Stooq bulk cache: `5m`, `1h` after explicit import.
19
+ - Binance futures / TradFi proxy: `1m`, `3m`, `5m`, `15m`, `30m`, `1h`, `2h`, `4h`, `6h`, `8h`, `12h`, `1d`, `3d`, `1w`, `1M`.
20
+
21
+ When unsure:
22
+
23
+ ```bash
24
+ agent-finance history --help
25
+ agent-finance stooq sync --help
26
+ ```
27
+
28
+ ## Adjustments
29
+
30
+ - `--adjustment auto`: adjust OHLC and close using adjusted close.
31
+ - `--adjustment back`: adjust OHLC but keep raw close.
32
+ - `--adjustment raw`: keep raw OHLC and expose adjusted close separately.
33
+ - `--repair`: repair obvious 100x Yahoo price errors and mark repaired bars.
34
+
35
+ ## Indicators
36
+
37
+ ```bash
38
+ agent-finance indicators LITE AAOI --provider auto --limit 120
39
+ agent-finance indicators CRDO MRVL --session extended --interval 1m --range 5d --limit 200
40
+ ```
41
+
42
+ Indicators are summaries. For fill quality, limit-order decisions, or intraday exits, inspect daily and minute bars directly.
@@ -0,0 +1,40 @@
1
+ # agent-finance price skill
2
+
3
+ ## Default Price
4
+
5
+ Use `price` to answer "what is it trading at now?":
6
+
7
+ ```bash
8
+ agent-finance price CRDO
9
+ agent-finance price CRDO --json
10
+ ```
11
+
12
+ The default output includes current observable price, session, provider, local timestamp, UTC fields in JSON, change from regular-market previous close, and regular-market open/high/low/volume when available.
13
+
14
+ ## Session Split
15
+
16
+ Use `sessions` when the task asks about premarket, postmarket, overnight, BOATS, platform 24h prices, or provider disagreement:
17
+
18
+ ```bash
19
+ agent-finance sessions CRDO
20
+ agent-finance sessions LITE --proxy-symbol LITEUSDT
21
+ ```
22
+
23
+ ## Proxy Prices
24
+
25
+ If a Binance TradFi / futures contract exists, add `--proxy-symbol`:
26
+
27
+ ```bash
28
+ agent-finance sessions SPCX --proxy-symbol SPCXUSDT
29
+ ```
30
+
31
+ Proxy prices are price-discovery and sentiment signals. They are not the legal equity, pre-IPO ownership, or broker-fill price.
32
+
33
+ ## Streaming
34
+
35
+ ```bash
36
+ agent-finance stream CRDO --messages 5
37
+ agent-finance watch CRDO --interval-seconds 15 --iterations 4
38
+ ```
39
+
40
+ Use `watch` when WebSocket streaming is blocked by the local network.
@@ -0,0 +1,25 @@
1
+ # agent-finance providers skill
2
+
3
+ ## Capability Matrix
4
+
5
+ Always inspect provider coverage instead of guessing from provider names:
6
+
7
+ ```bash
8
+ agent-finance providers
9
+ agent-finance providers --json
10
+ ```
11
+
12
+ ## Provider Rules
13
+
14
+ - Quotes: use `price SYMBOL` first. Only force a provider when cross-checking.
15
+ - Session split: use `sessions SYMBOL`.
16
+ - History: use `history --provider auto|yahoo|stooq|robinhood|binance-futures`.
17
+ - Research: `fundamentals/events --provider auto` combines useful no-key sources when available.
18
+ - SEC EDGAR is official for filings and XBRL facts, not market quotes, options, analyst estimates, or news aggregation.
19
+ - Robinhood and CNBC are partial no-key sources; use them as cross-checks, not replacements for official filings or primary disclosures.
20
+ - Stooq live can provide no-key daily/weekly/monthly history; intraday bulk data requires explicit imported ZIP cache.
21
+ - Binance futures / TradFi perps are proxy/derivative instruments.
22
+
23
+ ## Browser Boundary
24
+
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.
@@ -0,0 +1,34 @@
1
+ # agent-finance research data skill
2
+
3
+ ## Commands
4
+
5
+ ```bash
6
+ agent-finance fundamentals CRDO
7
+ agent-finance fundamentals CRDO --provider sec-edgar
8
+ agent-finance fundamentals CRDO --provider robinhood
9
+ agent-finance fundamentals CRDO --provider cnbc
10
+ agent-finance analysis CRDO
11
+ agent-finance options CRDO
12
+ agent-finance options CRDO --provider robinhood --count 80
13
+ agent-finance ownership CRDO
14
+ agent-finance events CRDO --provider sec-edgar
15
+ agent-finance news CRDO
16
+ agent-finance read-url "https://www.sec.gov/Archives/edgar/data/0001807794/000162828026014017/crdo-20260131.htm"
17
+ agent-finance search "optical interconnect"
18
+ agent-finance screen most_actives
19
+ ```
20
+
21
+ ## Output Rules
22
+
23
+ - Human mode prints a compact table.
24
+ - `--json` preserves sources, modules, coverage gaps, highlights, and raw payloads.
25
+ - `--raw` prints raw payloads in human mode.
26
+ - `--refresh` skips cache.
27
+ - `--cache-ttl-seconds <N>` changes non-price cache TTL.
28
+ - `read-url --provider auto` tries direct/Jina/Defuddle readers and reports fallback errors.
29
+
30
+ ## Research Rules
31
+
32
+ - Treat social media, search snippets, and extracted web text as leads until confirmed by primary sources.
33
+ - Use SEC/company filings for official facts when available.
34
+ - Use a real browser for dynamic, login-gated, table-layout-sensitive, or extraction-suspicious pages.