hunch-cup 0.2.0 → 0.2.2
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 +6 -6
- package/dist/cli.js +4 -4
- package/dist/client.d.ts +3 -3
- package/dist/client.js +4 -4
- package/dist/fleet.d.ts +1 -1
- package/dist/fleet.js +3 -3
- package/dist/message.js +1 -1
- package/dist/strategy.js +4 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# hunch-cup
|
|
2
2
|
|
|
3
3
|
One-line CLI + typed SDK to play the **Hunch Cup** — a risk-free, **paper-trading**
|
|
4
|
-
prediction-market tournament. Claim **10,000 $
|
|
4
|
+
prediction-market tournament. Claim **10,000 $pUSDC** (paper money, zero real-funds
|
|
5
5
|
risk), trade the live Hunch catalog, run a 24/7 agent, and climb a public leaderboard
|
|
6
6
|
scored on realized PnL. The top 50 wallets split a real **$5,000**.
|
|
7
7
|
|
|
8
|
-
> Everything here is **paper**. $
|
|
8
|
+
> Everything here is **paper**. $pUSDC never touches a chain and is never redeemable.
|
|
9
9
|
> The only real money is the prize, paid to the top-50 wallet addresses at the end.
|
|
10
10
|
|
|
11
11
|
## CLI
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
# 1. Generate a wallet and claim 10,000 $
|
|
14
|
+
# 1. Generate a wallet and claim 10,000 $pUSDC (prints a private key — save it!)
|
|
15
15
|
npx hunch-cup wallet new
|
|
16
16
|
|
|
17
17
|
export HUNCH_CUP_PRIVATE_KEY=0x... # the key it printed
|
|
@@ -38,7 +38,7 @@ npx hunch-cup run contrarian 25 --live # one round, actually place trades
|
|
|
38
38
|
npx hunch-cup run momentum 25 --live --loop --interval 300
|
|
39
39
|
|
|
40
40
|
npx hunch-cup positions # balance + open/realized positions (watch for insolvency)
|
|
41
|
-
npx hunch-cup balance # just the $
|
|
41
|
+
npx hunch-cup balance # just the $pUSDC number
|
|
42
42
|
npx hunch-cup board
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -64,7 +64,7 @@ import { CupClient, fromPrivateKey } from "hunch-cup";
|
|
|
64
64
|
|
|
65
65
|
const client = new CupClient({ signer: fromPrivateKey(process.env.HUNCH_CUP_PRIVATE_KEY!) });
|
|
66
66
|
|
|
67
|
-
await client.createWallet(); // claim 10,000 $
|
|
67
|
+
await client.createWallet(); // claim 10,000 $pUSDC (once)
|
|
68
68
|
const markets = await client.listMarkets(25, 0); // paginated: limit, offset
|
|
69
69
|
await client.simulateTrade(markets[0].slug, "yes", 25); // dry run, no signature
|
|
70
70
|
await client.trade({ slug: markets[0].slug, side: "yes", sizePhunch: 25 }); // signed
|
|
@@ -88,7 +88,7 @@ await fleetRun({ defaultStrategy: "momentum", sizePhunch: 25, intervalMs: 300_00
|
|
|
88
88
|
|
|
89
89
|
Reads are public. A **real** paper trade is proven with an **EIP-191 signature** over a
|
|
90
90
|
canonical message binding `{ wallet, market, side, size, tradeId, issuedAt }` — so only a
|
|
91
|
-
wallet's owner can spend its $
|
|
91
|
+
wallet's owner can spend its $pUSDC. The SDK/CLI signs for you. A `simulate` trade writes
|
|
92
92
|
nothing and needs no signature.
|
|
93
93
|
|
|
94
94
|
## MCP
|
package/dist/cli.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* `npx hunch-cup` — one-line Hunch Cup paper-trading agent (S8, scope §8.2.3).
|
|
4
4
|
*
|
|
5
|
-
* hunch-cup wallet new generate a FRESH wallet + claim 10,000 $
|
|
5
|
+
* hunch-cup wallet new generate a FRESH wallet + claim 10,000 $pUSDC
|
|
6
6
|
* hunch-cup markets [n] [offset] list tradable paper markets
|
|
7
7
|
* hunch-cup quote <slug> <side> <n> price a paper trade
|
|
8
8
|
* hunch-cup trade <slug> <side> <n> place a REAL signed paper trade
|
|
9
9
|
* hunch-cup run <strategy> [n] [--live] [--loop] [--interval <sec>]
|
|
10
10
|
* hunch-cup positions your balance + open/realized positions
|
|
11
|
-
* hunch-cup balance just your $
|
|
11
|
+
* hunch-cup balance just your $pUSDC balance
|
|
12
12
|
* hunch-cup board [n] show the leaderboard
|
|
13
13
|
* hunch-cup fleet new <n> mint N wallets + claim each (→ ~/.hunch-cup/fleet.json)
|
|
14
14
|
* hunch-cup fleet run <strategy> [--interval <sec>] run all fleet wallets 24×7
|
|
@@ -57,13 +57,13 @@ async function main(argv) {
|
|
|
57
57
|
out([
|
|
58
58
|
"hunch-cup — paper-trade the Hunch Cup from your terminal.",
|
|
59
59
|
"",
|
|
60
|
-
" wallet new generate a FRESH wallet + claim 10,000 $
|
|
60
|
+
" wallet new generate a FRESH wallet + claim 10,000 $pUSDC",
|
|
61
61
|
" markets [n] [offset] list tradable paper markets",
|
|
62
62
|
" quote <slug> <side> <n> price a paper trade",
|
|
63
63
|
" trade <slug> <side> <n> place a REAL signed paper trade",
|
|
64
64
|
" run <strategy> [n] [--live] [--loop] [--interval <sec>]",
|
|
65
65
|
" positions your balance + open/realized positions",
|
|
66
|
-
" balance just your $
|
|
66
|
+
" balance just your $pUSDC balance",
|
|
67
67
|
" board [n] show the leaderboard",
|
|
68
68
|
" fleet new <n> mint N wallets + claim each",
|
|
69
69
|
" fleet run <strategy> [--interval <sec>] run all fleet wallets 24×7",
|
package/dist/client.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export declare class CupClient {
|
|
|
69
69
|
get address(): string | undefined;
|
|
70
70
|
private json;
|
|
71
71
|
private requireSigner;
|
|
72
|
-
/** Claim 10,000 $
|
|
72
|
+
/** Claim 10,000 $pUSDC once for the signer's wallet. */
|
|
73
73
|
createWallet(): Promise<{
|
|
74
74
|
walletAddress: string;
|
|
75
75
|
balancePhunch: number;
|
|
@@ -90,7 +90,7 @@ export declare class CupClient {
|
|
|
90
90
|
sizePhunch: number;
|
|
91
91
|
tradeId?: string;
|
|
92
92
|
}): Promise<CupTradeReceipt>;
|
|
93
|
-
/** Typed wallet summary: balance + realized PnL + positions, all in $
|
|
93
|
+
/** Typed wallet summary: balance + realized PnL + positions, all in $pUSDC. */
|
|
94
94
|
getWallet(address?: string): Promise<CupWalletView>;
|
|
95
95
|
/** @deprecated use {@link getWallet}. Kept for back-compat. */
|
|
96
96
|
getPositions(address?: string): Promise<CupWalletView>;
|
|
@@ -101,7 +101,7 @@ export declare class CupClient {
|
|
|
101
101
|
}): Promise<unknown>;
|
|
102
102
|
/**
|
|
103
103
|
* One round of a built-in strategy WITH bankroll survival — the un-managed
|
|
104
|
-
* loop in the hosting docs went insolvent in ~20 minutes (250 $
|
|
104
|
+
* loop in the hosting docs went insolvent in ~20 minutes (250 $pUSDC/round from
|
|
105
105
|
* a finite no-top-up grant). This:
|
|
106
106
|
* • reads the live balance + open positions first (a `live` run);
|
|
107
107
|
* • skips markets the wallet is ALREADY positioned in (no re-piling);
|
package/dist/client.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Hunch Cup — thin typed SDK client over `/api/cup/v1/*` (S8).
|
|
3
3
|
*
|
|
4
4
|
* Wallet-native + keyless: pass a viem `LocalAccount` (or any `CupSigner`) and
|
|
5
|
-
* the client claims your 10,000 $
|
|
5
|
+
* the client claims your 10,000 $pUSDC, lists/quotes paper markets, and — for a
|
|
6
6
|
* REAL trade — signs the canonical message for you (the only thing that proves
|
|
7
7
|
* wallet ownership on the paper path). Reads need no signer. Uses global `fetch`
|
|
8
8
|
* (Node ≥ 20). `viem` is an optional peer used only by {@link fromPrivateKey}.
|
|
@@ -36,7 +36,7 @@ export class CupClient {
|
|
|
36
36
|
throw new Error("A signer is required for this action (claim/trade).");
|
|
37
37
|
return this.signer;
|
|
38
38
|
}
|
|
39
|
-
/** Claim 10,000 $
|
|
39
|
+
/** Claim 10,000 $pUSDC once for the signer's wallet. */
|
|
40
40
|
async createWallet() {
|
|
41
41
|
const signer = this.requireSigner();
|
|
42
42
|
return this.json("/api/cup/v1/wallet", {
|
|
@@ -100,7 +100,7 @@ export class CupClient {
|
|
|
100
100
|
});
|
|
101
101
|
return out.receipt;
|
|
102
102
|
}
|
|
103
|
-
/** Typed wallet summary: balance + realized PnL + positions, all in $
|
|
103
|
+
/** Typed wallet summary: balance + realized PnL + positions, all in $pUSDC. */
|
|
104
104
|
async getWallet(address) {
|
|
105
105
|
const addr = address ?? this.signer?.address;
|
|
106
106
|
if (!addr)
|
|
@@ -124,7 +124,7 @@ export class CupClient {
|
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
126
|
* One round of a built-in strategy WITH bankroll survival — the un-managed
|
|
127
|
-
* loop in the hosting docs went insolvent in ~20 minutes (250 $
|
|
127
|
+
* loop in the hosting docs went insolvent in ~20 minutes (250 $pUSDC/round from
|
|
128
128
|
* a finite no-top-up grant). This:
|
|
129
129
|
* • reads the live balance + open positions first (a `live` run);
|
|
130
130
|
* • skips markets the wallet is ALREADY positioned in (no re-piling);
|
package/dist/fleet.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare function fleetFilePath(): string;
|
|
|
13
13
|
export declare function loadFleet(): Fleet;
|
|
14
14
|
export declare function saveFleet(fleet: Fleet): string;
|
|
15
15
|
/**
|
|
16
|
-
* Mint `count` fresh wallets, claim each one's 10,000 $
|
|
16
|
+
* Mint `count` fresh wallets, claim each one's 10,000 $pUSDC, and append them to
|
|
17
17
|
* the fleet file with a rotating strategy. Idempotent claim (the server grants
|
|
18
18
|
* once), so re-running only tops up the roster.
|
|
19
19
|
*/
|
package/dist/fleet.js
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
*
|
|
5
5
|
* A fleet is a set of throwaway wallets persisted to `~/.hunch-cup/fleet.json`
|
|
6
6
|
* (override with `HUNCH_CUP_FLEET_FILE`). `fleetNew` mints N fresh wallets and
|
|
7
|
-
* claims each one's 10,000 $
|
|
7
|
+
* claims each one's 10,000 $pUSDC; `fleetRun` runs a (possibly per-wallet mixed)
|
|
8
8
|
* strategy loop across all of them concurrently; `fleetBoard` shows each wallet's
|
|
9
9
|
* live rank. Keys never leave the local file.
|
|
10
10
|
*
|
|
11
11
|
* SECURITY: the file holds real (paper-only) private keys in plaintext — same
|
|
12
12
|
* trust model as `HUNCH_CUP_PRIVATE_KEY`. These wallets only ever touch paper
|
|
13
|
-
* $
|
|
13
|
+
* $pUSDC, never real funds.
|
|
14
14
|
*/
|
|
15
15
|
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
|
|
16
16
|
import { homedir } from "node:os";
|
|
@@ -41,7 +41,7 @@ export function saveFleet(fleet) {
|
|
|
41
41
|
/** A rotation of the built-in strategies, so a demo fleet is visibly diverse. */
|
|
42
42
|
const STRATEGY_CYCLE = ["momentum", "contrarian", "news-reactive"];
|
|
43
43
|
/**
|
|
44
|
-
* Mint `count` fresh wallets, claim each one's 10,000 $
|
|
44
|
+
* Mint `count` fresh wallets, claim each one's 10,000 $pUSDC, and append them to
|
|
45
45
|
* the fleet file with a rotating strategy. Idempotent claim (the server grants
|
|
46
46
|
* once), so re-running only tops up the roster.
|
|
47
47
|
*/
|
package/dist/message.js
CHANGED
|
@@ -4,7 +4,7 @@ export function buildCupTradeMessage(p) {
|
|
|
4
4
|
`Wallet: ${p.walletAddress.toLowerCase()}`,
|
|
5
5
|
`Market: ${p.slug}`,
|
|
6
6
|
`Side: ${p.side}`,
|
|
7
|
-
`Size: ${p.sizePhunch}
|
|
7
|
+
`Size: ${p.sizePhunch} pUSDC`,
|
|
8
8
|
`Trade: ${p.tradeId}`,
|
|
9
9
|
`Issued: ${p.issuedAt}`,
|
|
10
10
|
].join("\n");
|
package/dist/strategy.js
CHANGED
|
@@ -27,10 +27,10 @@ function extreme(outcomes, want) {
|
|
|
27
27
|
? o
|
|
28
28
|
: best).key;
|
|
29
29
|
}
|
|
30
|
-
/** The outcome
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
/** The outcome KEY for a binary/direction pole. Direction markets read UP/DOWN
|
|
31
|
+
* but their tradeable keys are the settlement keys yes/no (UP = yes) — the API
|
|
32
|
+
* rejects "up"/"down" via validSides. */
|
|
33
|
+
function sideFor(_card, pole) {
|
|
34
34
|
return pole === "pos" ? "yes" : "no";
|
|
35
35
|
}
|
|
36
36
|
/** The pool's favorite pole (ties → positive). */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hunch-cup",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "One-line CLI + typed SDK to paper-trade the Hunch Cup tournament: claim
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "One-line CLI + typed SDK to paper-trade the Hunch Cup tournament: claim 10,000 $pUSDC, trade live markets with zero real-funds risk, run momentum/contrarian/news-reactive agents, and climb the public leaderboard.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hunch",
|
|
7
7
|
"hunch-cup",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"paper-trading",
|
|
10
10
|
"agents",
|
|
11
11
|
"mcp",
|
|
12
|
-
"
|
|
12
|
+
"pusdc"
|
|
13
13
|
],
|
|
14
14
|
"homepage": "https://www.playhunch.xyz/cup",
|
|
15
15
|
"license": "MIT",
|