propline-cli 0.51.0 → 0.53.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.
package/README.md CHANGED
@@ -82,6 +82,17 @@ propline player-trends baseball_mlb "Aaron Judge" --dfs-odds-type goblin
82
82
  # Bulk CSV export of resolved props (Pro tier)
83
83
  propline export-resolved-props --sport baseball_mlb --since 2026-04-01T00:00:00Z --out mlb-resolved.csv
84
84
 
85
+ # Track bets: we settle them when the games grade (Hobby+)
86
+ propline bets track bets.json # JSON array, same fields as /v1/bets/settle
87
+ propline bets list --status settled
88
+ propline bets get 9012
89
+ propline bets untrack 9012
90
+
91
+ # Verified records: a public pick history at prop-line.com/record/<handle>
92
+ propline record show sharp_guy # anyone can read a record
93
+ propline record create --handle sharp_guy --name "Sharp Guy"
94
+ propline record pick picks.json # before the game, at a real book price
95
+
85
96
  # Manage webhook subscriptions (Streaming tier)
86
97
  propline webhooks list
87
98
  propline webhooks create --url https://example.com/hook --events line_movement,resolution --sport baseball_mlb
package/dist/index.js CHANGED
@@ -1121,6 +1121,154 @@ function cmdExportOddsHistory(flags) {
1121
1121
  process.stdout.write(buf);
1122
1122
  });
1123
1123
  }
1124
+ function readStdin() {
1125
+ return new Promise((resolve, reject) => {
1126
+ let buf = "";
1127
+ process.stdin.setEncoding("utf8");
1128
+ process.stdin.on("data", (c) => buf += c);
1129
+ process.stdin.on("end", () => resolve(buf));
1130
+ process.stdin.on("error", reject);
1131
+ });
1132
+ }
1133
+ function printTrackedBets(bets2) {
1134
+ const cols = [
1135
+ { label: "ID", value: (r) => r.bet_id === null ? "" : String(r.bet_id), numeric: true },
1136
+ { label: "REF", value: (r) => truncate(r.ref ?? "", 20) },
1137
+ { label: "STATUS", value: (r) => r.status },
1138
+ { label: "RESULT", value: (r) => r.result ?? r.reason ?? "" },
1139
+ {
1140
+ label: "BET",
1141
+ value: (r) => r.parlay ? `${r.legs.length}-leg parlay` : truncate(
1142
+ r.legs[0] ? `${r.legs[0].selection} ${r.legs[0].market} ${formatPoint(r.legs[0].point)}`.trim() : "",
1143
+ 44
1144
+ )
1145
+ },
1146
+ { label: "PRICE", value: (r) => formatPrice(r.price), numeric: true },
1147
+ { label: "PROFIT", value: (r) => r.profit == null ? "" : r.profit.toFixed(2), numeric: true },
1148
+ { label: "SETTLED", value: (r) => formatTime(r.settled_at) }
1149
+ ];
1150
+ printTable(bets2, cols);
1151
+ }
1152
+ function cmdBetsTrack(file, flags) {
1153
+ return runCommand(async () => {
1154
+ const client = buildClient(flags);
1155
+ const raw = file === "-" ? await readStdin() : await readFile(file, "utf8");
1156
+ const bets2 = JSON.parse(raw);
1157
+ if (!Array.isArray(bets2)) throw new Error("the file must hold a JSON array of bets");
1158
+ const res = await client.trackBets(bets2);
1159
+ if (flags.json) return printJson(res);
1160
+ printTrackedBets(res.bets);
1161
+ process.stdout.write(
1162
+ `open bets: ${res.open_bets} of ${res.open_bet_limit}` + (res.push ? "\n" : " (no webhook push on this plan; use `propline bets list`)\n")
1163
+ );
1164
+ });
1165
+ }
1166
+ function cmdBetsList(flags) {
1167
+ return runCommand(async () => {
1168
+ const client = buildClient(flags);
1169
+ const res = await client.listTrackedBets({
1170
+ status: flags.status,
1171
+ since: flags.since,
1172
+ limit: flags.limit,
1173
+ beforeId: flags.beforeId
1174
+ });
1175
+ if (flags.json) return printJson(res);
1176
+ printTrackedBets(res.bets);
1177
+ process.stdout.write(`open bets: ${res.open_bets} of ${res.open_bet_limit}
1178
+ `);
1179
+ });
1180
+ }
1181
+ function betId(id) {
1182
+ const numeric = Number(id);
1183
+ if (!Number.isFinite(numeric)) throw new Error(`bet id must be numeric: ${id}`);
1184
+ return numeric;
1185
+ }
1186
+ function cmdBetsGet(id, flags) {
1187
+ return runCommand(async () => {
1188
+ const client = buildClient(flags);
1189
+ const bet = await client.getTrackedBet(betId(id));
1190
+ if (flags.json) return printJson(bet);
1191
+ printTrackedBets([bet]);
1192
+ });
1193
+ }
1194
+ function cmdBetsUntrack(id, flags) {
1195
+ return runCommand(async () => {
1196
+ const client = buildClient(flags);
1197
+ const numeric = betId(id);
1198
+ await client.untrackBet(numeric);
1199
+ if (flags.json) return printJson({ ok: true, bet_id: numeric });
1200
+ process.stdout.write(`bet ${numeric} is no longer tracked.
1201
+ `);
1202
+ });
1203
+ }
1204
+ function cmdRecordShow(handle, flags) {
1205
+ return runCommand(async () => {
1206
+ const client = buildClient(flags);
1207
+ const rec = await client.getRecord(handle, { limit: flags.limit });
1208
+ if (flags.json) return printJson(rec);
1209
+ const line = (label, s) => `${label}: ${s.won}-${s.lost}${s.push_or_void ? `-${s.push_or_void}` : ""} ${s.units_profit > 0 ? "+" : ""}${s.units_profit.toFixed(2)}u ROI ${s.roi_pct == null ? "n/a" : `${s.roi_pct}%`}
1210
+ `;
1211
+ process.stdout.write(`${rec.display_name} (@${rec.handle})
1212
+ `);
1213
+ process.stdout.write(line("all time ", rec.all_time));
1214
+ process.stdout.write(line("last 30 days", rec.last_30_days));
1215
+ process.stdout.write(
1216
+ `pending: ${rec.pending} not yet started (hidden): ${rec.not_yet_started}
1217
+
1218
+ `
1219
+ );
1220
+ const cols = [
1221
+ { label: "GAME DAY", value: (r) => formatTime(r.starts_at) },
1222
+ {
1223
+ label: "PICK",
1224
+ value: (r) => r.parlay ? `${r.legs.length}-leg parlay` : truncate(
1225
+ r.legs[0] ? `${r.legs[0].selection ?? ""} ${r.legs[0].side ?? ""} ${formatPoint(r.legs[0].point)} ${r.legs[0].market ?? ""}`.replace(/\s+/g, " ").trim() : "",
1226
+ 48
1227
+ )
1228
+ },
1229
+ { label: "PRICE", value: (r) => r.parlay ? "" : formatPrice(r.legs[0]?.price), numeric: true },
1230
+ { label: "UNITS", value: (r) => String(r.stake), numeric: true },
1231
+ { label: "RESULT", value: (r) => r.result },
1232
+ { label: "+/-", value: (r) => r.profit == null ? "" : r.profit.toFixed(2), numeric: true }
1233
+ ];
1234
+ printTable(rec.picks, cols);
1235
+ });
1236
+ }
1237
+ function cmdRecordCreate(flags) {
1238
+ return runCommand(async () => {
1239
+ const client = buildClient(flags);
1240
+ const prof = await client.createRecord({
1241
+ handle: flags.handle,
1242
+ display_name: flags.name,
1243
+ bio: flags.bio
1244
+ });
1245
+ if (flags.json) return printJson(prof);
1246
+ process.stdout.write(`${prof.display_name} (@${prof.handle})
1247
+ ${prof.url}
1248
+ `);
1249
+ });
1250
+ }
1251
+ function cmdRecordMe(flags) {
1252
+ return runCommand(async () => {
1253
+ const client = buildClient(flags);
1254
+ const prof = await client.getMyRecord();
1255
+ if (flags.json) return printJson(prof);
1256
+ process.stdout.write(`${prof.display_name} (@${prof.handle})
1257
+ ${prof.url}
1258
+ `);
1259
+ });
1260
+ }
1261
+ function cmdRecordPick(file, flags) {
1262
+ return runCommand(async () => {
1263
+ const client = buildClient(flags);
1264
+ const raw = file === "-" ? await readStdin() : await readFile(file, "utf8");
1265
+ const picks = JSON.parse(raw);
1266
+ if (!Array.isArray(picks)) throw new Error("the file must hold a JSON array of picks");
1267
+ const res = await client.addVerifiedPicks(picks);
1268
+ if (flags.json) return printJson(res);
1269
+ printTrackedBets(res.bets);
1270
+ });
1271
+ }
1124
1272
  function cmdWebhooksList(flags) {
1125
1273
  return runCommand(async () => {
1126
1274
  const client = buildClient(flags);
@@ -1519,18 +1667,18 @@ function cmdClv(file, flags) {
1519
1667
  process.stdin.on("end", () => resolve(buf));
1520
1668
  process.stdin.on("error", reject);
1521
1669
  }) : await readFile(file, "utf8");
1522
- let bets;
1670
+ let bets2;
1523
1671
  try {
1524
- bets = JSON.parse(raw);
1672
+ bets2 = JSON.parse(raw);
1525
1673
  } catch (e) {
1526
1674
  throw new Error(
1527
1675
  `Could not parse ${file === "-" ? "stdin" : file} as JSON: ${e.message}`
1528
1676
  );
1529
1677
  }
1530
- if (!Array.isArray(bets)) {
1678
+ if (!Array.isArray(bets2)) {
1531
1679
  throw new Error("Expected a JSON array of bet objects.");
1532
1680
  }
1533
- const res = await client.gradeClv(bets);
1681
+ const res = await client.gradeClv(bets2);
1534
1682
  if (flags.json) return printJson(res);
1535
1683
  const s = res.summary;
1536
1684
  process.stdout.write(
@@ -1635,18 +1783,18 @@ function cmdSettle(file, flags) {
1635
1783
  process.stdin.on("end", () => resolve(buf));
1636
1784
  process.stdin.on("error", reject);
1637
1785
  }) : await readFile(file, "utf8");
1638
- let bets;
1786
+ let bets2;
1639
1787
  try {
1640
- bets = JSON.parse(raw);
1788
+ bets2 = JSON.parse(raw);
1641
1789
  } catch (e) {
1642
1790
  throw new Error(
1643
1791
  `Could not parse ${file === "-" ? "stdin" : file} as JSON: ${e.message}`
1644
1792
  );
1645
1793
  }
1646
- if (!Array.isArray(bets)) {
1794
+ if (!Array.isArray(bets2)) {
1647
1795
  throw new Error("Expected a JSON array of bet objects.");
1648
1796
  }
1649
- const res = await client.settleBets(bets);
1797
+ const res = await client.settleBets(bets2);
1650
1798
  if (flags.json) return printJson(res);
1651
1799
  const s = res.summary;
1652
1800
  process.stdout.write(
@@ -1752,7 +1900,7 @@ function cmdParlay(file, flags) {
1752
1900
  }
1753
1901
 
1754
1902
  // src/index.ts
1755
- var VERSION = "0.51.0";
1903
+ var VERSION = "0.53.0";
1756
1904
  var program = new Command();
1757
1905
  program.name("propline").description(
1758
1906
  "PropLine CLI \u2014 query live odds, scores, +EV plays, prop resolution, and webhooks from the terminal."
@@ -2039,6 +2187,32 @@ program.command("export-odds-history").requiredOption("--sport <key>", "sport ke
2039
2187
  ).action(function() {
2040
2188
  return cmdExportOddsHistory(gather(this));
2041
2189
  });
2190
+ var bets = program.command("bets").description("Track bets: PropLine settles them when the games grade (Hobby+)");
2191
+ bets.command("track").argument("<file>", "JSON file holding an array of bets ('-' for stdin)").description("Register bets to be settled (and pushed as bet_settled webhooks)").action(function(file) {
2192
+ return cmdBetsTrack(file, gather(this));
2193
+ });
2194
+ bets.command("list").option("--status <status>", "open | settled | expired").option("--since <iso>", "only bets settled or regraded at or after this time").option("-l, --limit <n>", "max bets (default 100, max 500)", (v) => parseInt(v, 10)).option("--before-id <id>", "page backwards from this bet id", (v) => parseInt(v, 10)).description("List tracked bets, newest first").action(function() {
2195
+ return cmdBetsList(gather(this));
2196
+ });
2197
+ bets.command("get").argument("<id>", "bet id").description("Show one tracked bet").action(function(id) {
2198
+ return cmdBetsGet(id, gather(this));
2199
+ });
2200
+ bets.command("untrack").argument("<id>", "bet id").description("Stop tracking a bet").action(function(id) {
2201
+ return cmdBetsUntrack(id, gather(this));
2202
+ });
2203
+ var record = program.command("record").description("Verified records: a public, graded pick history");
2204
+ record.command("show").argument("<handle>", "the record's handle").option("-l, --limit <n>", "picks to show (default 100, max 200)", (v) => parseInt(v, 10)).description("Show a tipster's public verified record").action(function(handle) {
2205
+ return cmdRecordShow(handle, gather(this));
2206
+ });
2207
+ record.command("create").option("--handle <handle>", "3-30 chars, a-z 0-9 _ - (required the first time, then fixed)").option("--name <name>", "display name").option("--bio <text>", "one line, up to 160 characters").description("Create your record, or edit its name / bio (Hobby+)").action(function() {
2208
+ return cmdRecordCreate(gather(this));
2209
+ });
2210
+ record.command("me").description("Show your record profile and link").action(function() {
2211
+ return cmdRecordMe(gather(this));
2212
+ });
2213
+ record.command("pick").argument("<file>", "JSON file holding an array of picks ('-' for stdin)").description("Add verified picks to your record (cannot be undone)").action(function(file) {
2214
+ return cmdRecordPick(file, gather(this));
2215
+ });
2042
2216
  var webhooks = program.command("webhooks").description("Manage webhook subscriptions (Streaming tier)");
2043
2217
  webhooks.command("list").description("List your webhook subscriptions").action(function() {
2044
2218
  return cmdWebhooksList(gather(this));