@sharpe-terminal/mcp-server 1.2.0 → 1.5.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.
@@ -1,12 +1,58 @@
1
1
  /**
2
- * Composite tools that call multiple API endpoints concurrently
3
- * and return formatted markdown. Mirrors the Python server's
4
- * analyze_coin, market_briefing, and find_opportunities.
2
+ * Composite tools that call several API endpoints concurrently and return
3
+ * formatted markdown. Mirrors the Python server's analyze_coin,
4
+ * market_briefing and find_opportunities line for line.
5
+ *
6
+ * Every number a composite prints is a field the API serves, the value the web
7
+ * page and /api/v1 give for the same request (engine L4 WP-D14): the
8
+ * rankings, floors, averages and APRs are request parameters and response
9
+ * fields, never recomputed here. A report ends with the freshness of every
10
+ * answer it read.
5
11
  */
12
+ import { type DataFreshness } from "./api-client.ts";
6
13
  export declare function fmtUsd(value: number | null | undefined): string;
7
14
  export declare function fmtPct(value: number | null | undefined): string;
8
15
  export declare function fmtRate(value: number | null | undefined): string;
16
+ /** An annualized fraction (0.25 = 25%) as a percentage, or N/A. */
17
+ export declare function fmtApr(value: unknown): string;
18
+ /**
19
+ * The open-interest floor (USD) the composites ask the API to apply: funding
20
+ * extremes (`min_oi_usd`), the spot-perp perp leg and both cross-exchange legs
21
+ * (`minOiUsd`, `minVolUsd`). Unfloored, every extreme was a dust market (ESIM
22
+ * on KuCoin: $33K of OI at -16,862% APR, 2026-09-24 audit). The API applies
23
+ * it; unknown open interest fails it there.
24
+ */
25
+ export declare const LIQUIDITY_FLOOR_USD = 1000000;
26
+ /**
27
+ * `max_age_h` on the funding calls: v1 leaves out rows not written for six
28
+ * hours (V1_MAX_AGE_HOURS in the funding read model), so a keyless answer
29
+ * counts the same rows as a keyed one. v1 ignores the parameter.
30
+ */
31
+ export declare const FUNDING_MAX_AGE_HOURS = 6;
32
+ /** One answer's freshness, as the Python server prints it: `dataset · as of … · status[ · degraded] (warnings)`. */
33
+ export declare function freshnessLine(freshness: DataFreshness): string;
34
+ /**
35
+ * The report with a closing line naming the freshness of every answer it read
36
+ * (engine L5 WP-S12), each once, in the order the calls were made. Nothing
37
+ * changes when no answer said anything.
38
+ */
39
+ export declare function withFreshnessReport(report: string, answers: unknown[]): string;
9
40
  type ApiCaller = (apiPath: string, fallbackPath: string, args: Record<string, unknown>) => Promise<unknown>;
41
+ /**
42
+ * Find the prediction row for a ticker in the endpoint's own coverage list.
43
+ *
44
+ * The price-prediction endpoint is keyed by CoinGecko slug ("bitcoin",
45
+ * "avalanche-2", "matic-network"), never by ticker, and a lowercased ticker is
46
+ * not a slug. Guessing one either 404s or — far worse — resolves to whichever
47
+ * unrelated asset happens to own that slug, and tickers are shared across
48
+ * thousands of assets in this dataset. So the guess is a silent wrong-coin
49
+ * risk, never a convenience: it is resolve-or-say-so here.
50
+ *
51
+ * The list response (`GET .../price-prediction/data` with no `coin`) carries
52
+ * both the ticker (`coin`) and the `slug` for every covered asset, so an exact
53
+ * ticker match against it is the endpoint's own documented contract.
54
+ */
55
+ export declare function findPredictionRow(payload: unknown, ticker: string): Record<string, unknown> | null;
10
56
  export declare function analyzeCoin(callApi: ApiCaller, coin: string): Promise<string>;
11
57
  export declare function marketBriefing(callApi: ApiCaller): Promise<string>;
12
58
  export declare function findOpportunities(callApi: ApiCaller): Promise<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"composite-tools.d.ts","sourceRoot":"","sources":["../src/composite-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAW/D;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAG/D;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAGhE;AAgBD,KAAK,SAAS,GAAG,CACf,OAAO,EAAE,MAAM,EACf,YAAY,EAAE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