slab-cli 0.31.0__tar.gz → 0.32.0__tar.gz
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.
- {slab_cli-0.31.0 → slab_cli-0.32.0}/PKG-INFO +5 -5
- {slab_cli-0.31.0 → slab_cli-0.32.0}/README.md +3 -3
- slab_cli-0.32.0/pyproject.toml +29 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/commands/catalog.py +2 -1
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/commands/collection.py +2 -1
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/commands/export.py +14 -14
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/commands/pricing.py +6 -6
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/commands/registry.py +3 -3
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/display.py +123 -237
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/theme.py +1 -2
- slab_cli-0.31.0/pyproject.toml +0 -33
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/__init__.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/banner.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/browse.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/client.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/commands/__init__.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/commands/breaks.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/commands/custom_sets.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/commands/lots.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/commands/setup.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/commands/update.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/config.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/context.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/flags.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/help.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/main.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/nav.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/paging.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/picker.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/platforms/__init__.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/platforms/base.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/platforms/posix.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/platforms/windows.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/prompts.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/sources.py +0 -0
- {slab_cli-0.31.0 → slab_cli-0.32.0}/src/slab_cli/updates.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: slab-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.32.0
|
|
4
4
|
Summary: CLI for the slab trading-card API — catalog, collect, and track your cards from the terminal.
|
|
5
5
|
Author: dev_jeb
|
|
6
|
-
Requires-Dist: slab-schemas>=0.
|
|
6
|
+
Requires-Dist: slab-schemas>=0.74.0
|
|
7
7
|
Requires-Dist: httpx>=0.27
|
|
8
8
|
Requires-Dist: rich>=13.0
|
|
9
9
|
Requires-Dist: inquirerpy>=0.3
|
|
@@ -24,7 +24,7 @@ This installs the `slab` command.
|
|
|
24
24
|
## Setup
|
|
25
25
|
|
|
26
26
|
The CLI talks to the hosted slab API. You need an **API key** — mint one from the
|
|
27
|
-
[slab portal](https://app.slab.dev-jeb.com) (sign in → **API
|
|
27
|
+
[slab portal](https://app.slab.dev-jeb.com) (sign in → **Account** → **API keys** → create). Then:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
30
|
export SLAB_API_KEY=sk_live_... # your key (required)
|
|
@@ -40,10 +40,10 @@ export SLAB_COLLECTOR=<collector-uuid> # your active collector, reus
|
|
|
40
40
|
slab card search --subject "Connor Bedard" # find cards
|
|
41
41
|
slab card price <card-uuid> # fair-market value from sales comps
|
|
42
42
|
slab card comps <card-uuid> # the underlying recent sales
|
|
43
|
-
slab set "OPC Platinum"
|
|
43
|
+
slab set price "OPC Platinum" # a set's sealed FMV + top cards
|
|
44
44
|
|
|
45
45
|
# Your collection
|
|
46
|
-
slab collector
|
|
46
|
+
slab collector current # the collector your key acts for
|
|
47
47
|
slab collection add # add an owned copy (grade, cost, acquisition)
|
|
48
48
|
slab collection cost # log grading/shipping costs on a copy
|
|
49
49
|
slab break new # record a box/case break
|
|
@@ -12,7 +12,7 @@ This installs the `slab` command.
|
|
|
12
12
|
## Setup
|
|
13
13
|
|
|
14
14
|
The CLI talks to the hosted slab API. You need an **API key** — mint one from the
|
|
15
|
-
[slab portal](https://app.slab.dev-jeb.com) (sign in → **API
|
|
15
|
+
[slab portal](https://app.slab.dev-jeb.com) (sign in → **Account** → **API keys** → create). Then:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
export SLAB_API_KEY=sk_live_... # your key (required)
|
|
@@ -28,10 +28,10 @@ export SLAB_COLLECTOR=<collector-uuid> # your active collector, reus
|
|
|
28
28
|
slab card search --subject "Connor Bedard" # find cards
|
|
29
29
|
slab card price <card-uuid> # fair-market value from sales comps
|
|
30
30
|
slab card comps <card-uuid> # the underlying recent sales
|
|
31
|
-
slab set "OPC Platinum"
|
|
31
|
+
slab set price "OPC Platinum" # a set's sealed FMV + top cards
|
|
32
32
|
|
|
33
33
|
# Your collection
|
|
34
|
-
slab collector
|
|
34
|
+
slab collector current # the collector your key acts for
|
|
35
35
|
slab collection add # add an owned copy (grade, cost, acquisition)
|
|
36
36
|
slab collection cost # log grading/shipping costs on a copy
|
|
37
37
|
slab break new # record a box/case break
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "slab-cli"
|
|
3
|
+
version = "0.32.0"
|
|
4
|
+
description = "CLI for the slab trading-card API — catalog, collect, and track your cards from the terminal."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [{name = "dev_jeb"}]
|
|
7
|
+
requires-python = ">=3.13"
|
|
8
|
+
dependencies = [
|
|
9
|
+
# The floor moves only when CLI code needs a newer contract (a field it reads, a model it
|
|
10
|
+
# parses into), never just to follow a release.
|
|
11
|
+
"slab-schemas>=0.74.0",
|
|
12
|
+
"httpx>=0.27",
|
|
13
|
+
"rich>=13.0",
|
|
14
|
+
"InquirerPy>=0.3",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[dependency-groups]
|
|
18
|
+
dev = ["pytest>=8.0"]
|
|
19
|
+
|
|
20
|
+
[build-system]
|
|
21
|
+
requires = ["uv_build>=0.9.5,<0.10.0"]
|
|
22
|
+
build-backend = "uv_build"
|
|
23
|
+
|
|
24
|
+
[[tool.uv.index]]
|
|
25
|
+
name = "slab-registry"
|
|
26
|
+
url = "https://slab-package-domain-682033488592.d.codeartifact.us-east-1.amazonaws.com/pypi/slab-package-repository/simple/"
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
slab = "slab_cli.main:main"
|
|
@@ -38,7 +38,8 @@ def cmd_search(args: list[str]) -> None:
|
|
|
38
38
|
|
|
39
39
|
Every flag combines with AND; repeat an any-of flag (--team, --brand, --finish…) to widen it.
|
|
40
40
|
|
|
41
|
-
Sort keys: year, card_number, numbered, subject, brand, set (prefix - for
|
|
41
|
+
Sort keys: relevance, release, year, card_number, numbered, subject, brand, set (prefix - for
|
|
42
|
+
descending; the served list is GET /vocab `card_sort_keys`).
|
|
42
43
|
|
|
43
44
|
Results are one row per CARD, however many parallels it has — a player with a 17-finish
|
|
44
45
|
rainbow would otherwise bury his other cards under one of them. In a terminal the browse is
|
|
@@ -649,7 +649,8 @@ def cmd_search(args: list[str]) -> None:
|
|
|
649
649
|
slab collection search --acq pack_pull --sort -fmv
|
|
650
650
|
|
|
651
651
|
Sort keys: acquired_date, acquisition_cost, numbered, year, card_number, brand, set,
|
|
652
|
-
fmv, unrealized, roi (prefix - for descending
|
|
652
|
+
subject, fmv, unrealized, roi, confidence (prefix - for descending; the served list is
|
|
653
|
+
GET /vocab `collection_sort_keys`).
|
|
653
654
|
|
|
654
655
|
In a terminal the browse is set-first, same as `slab card search`: matches are grouped
|
|
655
656
|
into the sets they came from (with each set's copy count, cost basis, FMV, and gain/loss),
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"""Export command — dump your collection to a printable CSV checklist.
|
|
2
2
|
|
|
3
3
|
Built for the physical audit / stock-take: you have a stack of cards and want to reconcile it
|
|
4
|
-
against what's recorded. Run `slab export`, pick one of the sets you own from the list
|
|
5
|
-
need to type an exact name), and you get a CSV with an `in_hand`
|
|
6
|
-
off as you match it, and the one physical card with no row is your
|
|
7
|
-
subset → finish → card number so they walk in the same order you'd
|
|
4
|
+
against what's recorded. Run `slab collection export`, pick one of the sets you own from the list
|
|
5
|
+
(fuzzy — no need to type an exact name) or the whole collection, and you get a CSV with an `in_hand`
|
|
6
|
+
column. Print it, tick each card off as you match it, and the one physical card with no row is your
|
|
7
|
+
gap. Rows are sorted by set → subset → finish → card number so they walk in the same order you'd
|
|
8
|
+
sort a stack.
|
|
8
9
|
"""
|
|
9
10
|
|
|
10
11
|
from __future__ import annotations
|
|
@@ -19,7 +20,7 @@ from ..paging import fetch_all_pages
|
|
|
19
20
|
from ..prompts import select_owned_set
|
|
20
21
|
from .collection import _natural_chunks
|
|
21
22
|
|
|
22
|
-
_COLUMNS = ["in_hand", "subset", "finish", "card_number", "player", "serial", "print_run", "status", "cost_basis"]
|
|
23
|
+
_COLUMNS = ["in_hand", "season", "set", "subset", "finish", "card_number", "player", "serial", "print_run", "status", "cost_basis"]
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
def _num_key(card_number: str | None) -> tuple:
|
|
@@ -60,6 +61,7 @@ def _write_csv(copies: list, out_file: str) -> None:
|
|
|
60
61
|
copies = sorted(
|
|
61
62
|
copies,
|
|
62
63
|
key=lambda cp: (
|
|
64
|
+
(cp.card.set_name or "") if cp.card else "",
|
|
63
65
|
(cp.card.subset or "") if cp.card else "",
|
|
64
66
|
(cp.card.finish or "") if cp.card else "",
|
|
65
67
|
_num_key(cp.card.card_number if cp.card else None),
|
|
@@ -74,6 +76,8 @@ def _write_csv(copies: list, out_file: str) -> None:
|
|
|
74
76
|
players = " / ".join(s.name for s in c.subjects) if c else ""
|
|
75
77
|
writer.writerow([
|
|
76
78
|
"[ ]",
|
|
79
|
+
(c.season if c else "") or "",
|
|
80
|
+
(c.set_name if c else "") or "",
|
|
77
81
|
(c.subset if c else "") or "",
|
|
78
82
|
(c.finish if c else None) or "BASE",
|
|
79
83
|
(c.card_number if c else "") or "",
|
|
@@ -88,10 +92,10 @@ def _write_csv(copies: list, out_file: str) -> None:
|
|
|
88
92
|
def cmd_export(args: list[str]) -> None:
|
|
89
93
|
"""Export your collection to a printable CSV checklist.
|
|
90
94
|
|
|
91
|
-
Usage: slab export [--set <slug>] [--out FILE]
|
|
92
|
-
slab export
|
|
93
|
-
slab export --set <slug>
|
|
94
|
-
slab export --out audit.csv
|
|
95
|
+
Usage: slab collection export [--set <slug>] [--out FILE]
|
|
96
|
+
slab collection export # pick a set from a list (or the whole collection)
|
|
97
|
+
slab collection export --set <slug> # non-interactive (scripting)
|
|
98
|
+
slab collection export --out audit.csv
|
|
95
99
|
"""
|
|
96
100
|
out_file: str | None = None
|
|
97
101
|
set_slug: str | None = None
|
|
@@ -106,7 +110,7 @@ def cmd_export(args: list[str]) -> None:
|
|
|
106
110
|
# Interactive: fetch the collection, let the user pick from the sets they own.
|
|
107
111
|
all_copies = _fetch_all(ctx.collector, None)
|
|
108
112
|
if not all_copies:
|
|
109
|
-
console.print("[yellow]Your collection is empty
|
|
113
|
+
console.print("[yellow]Your collection is empty.[/yellow]")
|
|
110
114
|
return
|
|
111
115
|
picked = select_owned_set(_owned_sets(all_copies), total=len(all_copies))
|
|
112
116
|
set_slug = picked or None # "" → whole collection
|
|
@@ -123,7 +127,3 @@ def cmd_export(args: list[str]) -> None:
|
|
|
123
127
|
_write_csv(copies, out_file)
|
|
124
128
|
|
|
125
129
|
console.print(f"\n[green]Exported {len(copies)} copies[/green] → [bold]{out_file}[/bold]")
|
|
126
|
-
console.print(
|
|
127
|
-
"[dim]Open/print it and tick in_hand as you match each physical card — "
|
|
128
|
-
"the one card with no row is your gap.[/dim]"
|
|
129
|
-
)
|
|
@@ -104,10 +104,9 @@ def _split_desk_flags(args: list[str]) -> tuple[list[str], str | None]:
|
|
|
104
104
|
|
|
105
105
|
|
|
106
106
|
def cmd_grade(args: list[str]) -> None:
|
|
107
|
-
"""
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
grader."""
|
|
107
|
+
"""A card's grading desk. Same player → set → card flow as `price`, then what the card sells
|
|
108
|
+
for raw and at each grade, each price with its sales count — sale prices alone, before fees.
|
|
109
|
+
`--company SGC` switches grader."""
|
|
111
110
|
args, company = _split_desk_flags(args)
|
|
112
111
|
card = _pick_card(args)
|
|
113
112
|
if card is None:
|
|
@@ -116,8 +115,9 @@ def cmd_grade(args: list[str]) -> None:
|
|
|
116
115
|
|
|
117
116
|
|
|
118
117
|
def cmd_grade_sweep(args: list[str]) -> None:
|
|
119
|
-
"""The
|
|
120
|
-
|
|
118
|
+
"""The Grading Desk board: every raw card you hold with raw and graded sales, its raw price
|
|
119
|
+
beside the grader's 10 / 9 / 8 (and any other grader's), highest graded price first. Sale
|
|
120
|
+
prices alone, before fees."""
|
|
121
121
|
args, company = _split_desk_flags(args)
|
|
122
122
|
render_collection_grading_desk(
|
|
123
123
|
ctx.client.get_collection_grading_desk(ctx.collector, company=company)
|
|
@@ -59,7 +59,7 @@ GROUPS: list[Group] = [
|
|
|
59
59
|
Command("search", "Search the catalog (player, set, team…)", catalog.cmd_search, "[query] [flags]"),
|
|
60
60
|
Command("parallels", "Every parallel (the rainbow) of a card", catalog.cmd_rainbow, "<query>"),
|
|
61
61
|
Command("price", "Market price + 7d/30d trend", pricing.cmd_price, "<query>"),
|
|
62
|
-
Command("grade", "
|
|
62
|
+
Command("grade", "What it sells for raw and at each grade", pricing.cmd_grade, "<query> [--company NAME]"),
|
|
63
63
|
Command("comps", "Recent raw sales behind the price", pricing.cmd_comps, "<query>"),
|
|
64
64
|
Command("serials", "Which numbered copies have surfaced (sales + collections)", pricing.cmd_serials, "<query>"),
|
|
65
65
|
Command("history", "Price history over time", pricing.cmd_history, "<query>"),
|
|
@@ -78,10 +78,10 @@ GROUPS: list[Group] = [
|
|
|
78
78
|
Command("sell", "Record a sale (mark sold with price)", collection.cmd_sell),
|
|
79
79
|
Command("remove", "Remove a copy", collection.cmd_remove),
|
|
80
80
|
Command("cost", "Log a cost (grading, shipping) on a copy", collection.cmd_cost),
|
|
81
|
-
Command("export", "Export a set to a
|
|
81
|
+
Command("export", "Export a set or the whole collection to a CSV checklist", export.cmd_export),
|
|
82
82
|
Command("dashboard", "Overview: counts, value, composition", collection.cmd_dashboard),
|
|
83
83
|
Command("portfolio", "Portfolio: cost basis vs FMV, by set, top movers", pricing.cmd_portfolio),
|
|
84
|
-
Command("grade", "Grading
|
|
84
|
+
Command("grade", "Grading Desk: raw and graded prices of your raw cards", pricing.cmd_grade_sweep, "[--company NAME]"),
|
|
85
85
|
]),
|
|
86
86
|
Group("break", "case / box breaks", [
|
|
87
87
|
Command("list", "Your breaks — pick one to see value vs cost + top pulls", breaks.cmd_break_list),
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import math
|
|
6
|
+
|
|
5
7
|
from rich.console import Group
|
|
6
8
|
from rich.text import Text
|
|
7
9
|
|
|
@@ -19,10 +21,10 @@ from slab_schemas.community import (
|
|
|
19
21
|
)
|
|
20
22
|
from slab_schemas.custom_sets import CustomSetDetail, CustomSetOut, CustomSetSearchResult
|
|
21
23
|
from slab_schemas.dashboard import CatalogStats, DashboardStats, HighlightCard, LabeledCount
|
|
22
|
-
from slab_schemas.glossary import MetricInfo
|
|
23
24
|
from slab_schemas.grading_desk import CollectionGradingDesk, GradingDesk
|
|
24
|
-
from slab_schemas.enums import
|
|
25
|
+
from slab_schemas.enums import Grade, LiquidityLabel, SealedFormat
|
|
25
26
|
from slab_schemas.liquidity import Liquidity
|
|
27
|
+
from slab_schemas import metrics
|
|
26
28
|
from slab_schemas.metrics import trend_label
|
|
27
29
|
from slab_schemas.pricing import CardComps, CardMarket, PortfolioSummary, SetTopCards
|
|
28
30
|
from slab_schemas.sealed import SealedPriceHistory, SealedProductOut
|
|
@@ -415,12 +417,10 @@ def browse_collection(result: CollectionResult, *, detail=None) -> None:
|
|
|
415
417
|
static table (pipes, and the quit receipt) stays the flat one-row-per-copy list."""
|
|
416
418
|
if not result.items:
|
|
417
419
|
console.print("[dim]No cards in your collection matching that search.[/dim]")
|
|
418
|
-
if result.total == 0:
|
|
419
|
-
console.print(" [dim]Use `slab collection add` to start cataloging cards.[/dim]")
|
|
420
420
|
return
|
|
421
421
|
matches = f"{result.total} match{'' if result.total == 1 else 'es'}"
|
|
422
422
|
footer = _shown_footer(len(result.items), result.total,
|
|
423
|
-
"narrow your search, or `slab export` for the full list.")
|
|
423
|
+
"narrow your search, or `slab collection export` for the full list.")
|
|
424
424
|
|
|
425
425
|
def copies_page(copies) -> Page:
|
|
426
426
|
rep = next((cp.card for cp in copies if cp.card), None)
|
|
@@ -471,7 +471,6 @@ def browse_breaks(result: BreakSearchResult, *, detail=None) -> None:
|
|
|
471
471
|
break's report card (value vs cost + top pulls); Esc climbs back."""
|
|
472
472
|
if not result.items:
|
|
473
473
|
console.print("[slab.dim]No breaks found.[/]")
|
|
474
|
-
console.print(" [slab.dim]Use `slab break new` to record opening a pack, box, or case.[/]")
|
|
475
474
|
return
|
|
476
475
|
browse(
|
|
477
476
|
BREAK_COLUMNS, [(b, break_cells(b)) for b in result.items],
|
|
@@ -517,19 +516,25 @@ PAGE_NET_SCOPE = "priced copies on this page only; unpriced count as $0"
|
|
|
517
516
|
|
|
518
517
|
|
|
519
518
|
def _net_scope_line(result: CollectionResult, unpriced: int) -> str:
|
|
520
|
-
"""The
|
|
519
|
+
"""The scope label under a break/lot money line: what the total covers and what it skips."""
|
|
521
520
|
parts = [f"Worth today = {PAGE_NET_SCOPE}"]
|
|
522
521
|
if unpriced:
|
|
523
|
-
parts.append(f"{unpriced} unpriced
|
|
522
|
+
parts.append(f"{unpriced} unpriced")
|
|
524
523
|
if result.total > len(result.items):
|
|
525
524
|
parts.append(f"{len(result.items)} of {result.total} copies shown")
|
|
526
525
|
return f" [slab.dim]{' · '.join(parts)}.[/]"
|
|
527
526
|
|
|
528
527
|
|
|
528
|
+
def _money_line(paid, worth, count: int, noun: str) -> str:
|
|
529
|
+
"""A break's or lot's money line as labeled data: paid, what its cards are worth today, the
|
|
530
|
+
net. No reading of it."""
|
|
531
|
+
return (f"\n [slab.label]Paid[/] [slab.value]{money(paid)}[/] · [slab.label]{count} {noun} worth "
|
|
532
|
+
f"today[/] [slab.foil]{money(worth)}[/] · [slab.label]Net[/] {signed_money(worth - paid)}")
|
|
533
|
+
|
|
534
|
+
|
|
529
535
|
def render_break_pulls(brk, result: CollectionResult) -> None:
|
|
530
536
|
"""A break's report card: what you paid vs what the pulls are worth today, then the most
|
|
531
|
-
valuable pulls and the rarest (lowest print run).
|
|
532
|
-
answers "did the box pay for itself?" at a glance. "Worth today" is summed here from the
|
|
537
|
+
valuable pulls and the rarest (lowest print run). "Worth today" is summed here from the
|
|
533
538
|
page's priced copies (`PAGE_NET_SCOPE`), and labeled so."""
|
|
534
539
|
console.print()
|
|
535
540
|
t = Text()
|
|
@@ -539,8 +544,7 @@ def render_break_pulls(brk, result: CollectionResult) -> None:
|
|
|
539
544
|
console.print(t)
|
|
540
545
|
|
|
541
546
|
if not result.items:
|
|
542
|
-
console.print("\n [slab.dim]No pulls cataloged
|
|
543
|
-
"`slab break fill` walks the checklist.[/]\n")
|
|
547
|
+
console.print("\n [slab.dim]No pulls cataloged yet.[/]\n")
|
|
544
548
|
return
|
|
545
549
|
|
|
546
550
|
def _fmv(cp):
|
|
@@ -550,13 +554,7 @@ def render_break_pulls(brk, result: CollectionResult) -> None:
|
|
|
550
554
|
total_fmv = sum(_fmv(cp) * (cp.quantity or 1) for cp in priced)
|
|
551
555
|
unpriced = len(result.items) - len(priced)
|
|
552
556
|
|
|
553
|
-
|
|
554
|
-
net = total_fmv - brk.total_cost
|
|
555
|
-
verdict = "the box has paid for itself" if net >= 0 else "the box hasn't paid for itself (yet)"
|
|
556
|
-
console.print(
|
|
557
|
-
f"\n You paid [slab.value]{money(brk.total_cost)}[/] · your {len(result.items)} pulls are "
|
|
558
|
-
f"worth [slab.foil]{money(total_fmv)}[/] today → {signed_money(net)} — {verdict}."
|
|
559
|
-
)
|
|
557
|
+
console.print(_money_line(brk.total_cost, total_fmv, len(result.items), "pulls"))
|
|
560
558
|
console.print(_net_scope_line(result, unpriced))
|
|
561
559
|
|
|
562
560
|
top = sorted(priced, key=_fmv, reverse=True)[:10]
|
|
@@ -569,7 +567,7 @@ def render_break_pulls(brk, result: CollectionResult) -> None:
|
|
|
569
567
|
key=lambda cp: cp.card.print_run,
|
|
570
568
|
)[:5]
|
|
571
569
|
if rare:
|
|
572
|
-
console.print(heading("Rarest Pulls", "lowest print run
|
|
570
|
+
console.print(heading("Rarest Pulls", "lowest print run"))
|
|
573
571
|
console.print(_pull_table(rare))
|
|
574
572
|
console.print()
|
|
575
573
|
|
|
@@ -596,7 +594,6 @@ def browse_lots(result: LotSearchResult, *, detail=None) -> None:
|
|
|
596
594
|
purchase's report card (value vs cost + its cards); Esc climbs back."""
|
|
597
595
|
if not result.items:
|
|
598
596
|
console.print("[slab.dim]No purchases found.[/]")
|
|
599
|
-
console.print(" [slab.dim]Use `slab lot new` to record a multi-card buy (an eBay bundle, a show pickup).[/]")
|
|
600
597
|
return
|
|
601
598
|
browse(
|
|
602
599
|
LOT_COLUMNS, [(lot, lot_cells(lot)) for lot in result.items],
|
|
@@ -608,8 +605,8 @@ def browse_lots(result: LotSearchResult, *, detail=None) -> None:
|
|
|
608
605
|
|
|
609
606
|
def render_lot_contents(lot, result: CollectionResult) -> None:
|
|
610
607
|
"""A purchase's report card: what you paid vs what the cards are worth today, then the most
|
|
611
|
-
valuable and rarest cards in it
|
|
612
|
-
|
|
608
|
+
valuable and rarest cards in it — the lot counterpart of `render_break_pulls`, same
|
|
609
|
+
`PAGE_NET_SCOPE` label on its total."""
|
|
613
610
|
console.print()
|
|
614
611
|
t = Text()
|
|
615
612
|
t.append(f"Purchase {lot.uuid[:8]}", style="slab.value")
|
|
@@ -617,8 +614,7 @@ def render_lot_contents(lot, result: CollectionResult) -> None:
|
|
|
617
614
|
console.print(t)
|
|
618
615
|
|
|
619
616
|
if not result.items:
|
|
620
|
-
console.print("\n [slab.dim]No cards attached
|
|
621
|
-
"`slab lot fill` adds them one by one.[/]\n")
|
|
617
|
+
console.print("\n [slab.dim]No cards attached yet.[/]\n")
|
|
622
618
|
return
|
|
623
619
|
|
|
624
620
|
def _fmv(cp):
|
|
@@ -628,12 +624,7 @@ def render_lot_contents(lot, result: CollectionResult) -> None:
|
|
|
628
624
|
total_fmv = sum(_fmv(cp) * (cp.quantity or 1) for cp in priced)
|
|
629
625
|
unpriced = len(result.items) - len(priced)
|
|
630
626
|
|
|
631
|
-
|
|
632
|
-
verdict = "the purchase is above water" if net >= 0 else "the purchase is underwater (for now)"
|
|
633
|
-
console.print(
|
|
634
|
-
f"\n You paid [slab.value]{money(lot.total_cost)}[/] · its {len(result.items)} cards are "
|
|
635
|
-
f"worth [slab.foil]{money(total_fmv)}[/] today → {signed_money(net)} — {verdict}."
|
|
636
|
-
)
|
|
627
|
+
console.print(_money_line(lot.total_cost, total_fmv, len(result.items), "cards"))
|
|
637
628
|
console.print(_net_scope_line(result, unpriced))
|
|
638
629
|
|
|
639
630
|
top = sorted(priced, key=_fmv, reverse=True)[:10]
|
|
@@ -646,7 +637,7 @@ def render_lot_contents(lot, result: CollectionResult) -> None:
|
|
|
646
637
|
key=lambda cp: cp.card.print_run,
|
|
647
638
|
)[:5]
|
|
648
639
|
if rare:
|
|
649
|
-
console.print(heading("Rarest", "lowest print run
|
|
640
|
+
console.print(heading("Rarest", "lowest print run"))
|
|
650
641
|
console.print(_pull_table(rare))
|
|
651
642
|
console.print()
|
|
652
643
|
|
|
@@ -735,7 +726,11 @@ def render_dashboard(d: DashboardStats) -> None:
|
|
|
735
726
|
if d.portfolio_value is not None:
|
|
736
727
|
mv = f"[slab.foil]{money(d.portfolio_value)}[/]"
|
|
737
728
|
if d.portfolio_change_7d is not None:
|
|
738
|
-
mv += f" {signed_money(d.portfolio_change_7d)} [slab.dim]appraisal 7d
|
|
729
|
+
mv += f" {signed_money(d.portfolio_change_7d)} [slab.dim]appraisal 7d"
|
|
730
|
+
if d.portfolio_change_7d_coverage is not None:
|
|
731
|
+
# the basket the change describes, as a share of the value (the glossary's rule)
|
|
732
|
+
mv += f" · covers {math.floor(d.portfolio_change_7d_coverage * 100 + 0.5)}%"
|
|
733
|
+
mv += "[/]"
|
|
739
734
|
rows.append(("Market Value", mv))
|
|
740
735
|
if d.total_unrealized_gain_loss is not None:
|
|
741
736
|
roi_str = ""
|
|
@@ -906,15 +901,14 @@ def _hot_trend(e: HotPlayer) -> str:
|
|
|
906
901
|
return f"[slab.dim]→ {pct:+.0f}%[/]"
|
|
907
902
|
|
|
908
903
|
|
|
909
|
-
def _hottest_players_table(entries: list[HotPlayer]
|
|
904
|
+
def _hottest_players_table(entries: list[HotPlayer]) -> Group | None:
|
|
910
905
|
"""The board's counts and dollars are the sales slab SAW (`observed`), so the columns say
|
|
911
|
-
"seen"
|
|
912
|
-
reads as the size of the market."""
|
|
906
|
+
"seen" — never "volume", which reads as the size of the market — over the served window."""
|
|
913
907
|
if not entries:
|
|
914
908
|
return None
|
|
915
909
|
table = slab_table([
|
|
916
910
|
("Player", {"style": "slab.value"}),
|
|
917
|
-
("Sales seen (
|
|
911
|
+
(f"Sales seen ({entries[0].observed.window_days}d)", {"justify": "right", "style": "slab.value"}),
|
|
918
912
|
("$ seen", {"justify": "right"}),
|
|
919
913
|
("Cards", {"justify": "right", "style": "slab.dim"}),
|
|
920
914
|
("Prices", {"justify": "right"}),
|
|
@@ -927,7 +921,7 @@ def _hottest_players_table(entries: list[HotPlayer], seen: MetricInfo | None = N
|
|
|
927
921
|
str(e.observed.cards) if e.observed.cards is not None else "—",
|
|
928
922
|
_hot_trend(e),
|
|
929
923
|
)
|
|
930
|
-
return titled("🔥 Hottest Players", table
|
|
924
|
+
return titled("🔥 Hottest Players", table)
|
|
931
925
|
|
|
932
926
|
|
|
933
927
|
def _rarest_owned_table(entries: list[RarestOwnedCard]) -> Group | None:
|
|
@@ -961,7 +955,7 @@ def render_community_board(b: CommunityBoard) -> None:
|
|
|
961
955
|
_valuable_table("Most Valuable — Graded", b.most_valuable_graded),
|
|
962
956
|
_collected_cards_table(b.most_collected),
|
|
963
957
|
_collected_players_table(b.most_collected_players),
|
|
964
|
-
_hottest_players_table(b.hottest_players
|
|
958
|
+
_hottest_players_table(b.hottest_players),
|
|
965
959
|
_rarest_owned_table(b.rarest_owned),
|
|
966
960
|
):
|
|
967
961
|
if block:
|
|
@@ -1012,7 +1006,6 @@ def browse_custom_sets(
|
|
|
1012
1006
|
items = result.items if isinstance(result, CustomSetSearchResult) else result
|
|
1013
1007
|
if not items:
|
|
1014
1008
|
console.print("[dim]No custom sets found.[/dim]")
|
|
1015
|
-
console.print(" [dim]Use `slab chase create` to make one.[/dim]")
|
|
1016
1009
|
return None
|
|
1017
1010
|
total = result.total if isinstance(result, CustomSetSearchResult) else len(items)
|
|
1018
1011
|
return browse(
|
|
@@ -1147,13 +1140,6 @@ def render_card_market(m: CardMarket) -> None:
|
|
|
1147
1140
|
window = m.price_points[0].window_days
|
|
1148
1141
|
console.print(heading("Market Price", f"{window}-day window, as of {m.as_of_date}"))
|
|
1149
1142
|
console.print(table)
|
|
1150
|
-
if any(pp.liquidity for pp in m.price_points):
|
|
1151
|
-
console.print(
|
|
1152
|
-
" [slab.dim]Sells = how often this exact printing and grade actually sells — the "
|
|
1153
|
-
"typical gap between real sales in the last 90 days, or the past year's count for "
|
|
1154
|
-
"slow movers. A rare seller isn't bad; it means the price is an estimate you may "
|
|
1155
|
-
"wait to realize.[/]"
|
|
1156
|
-
)
|
|
1157
1143
|
console.print()
|
|
1158
1144
|
|
|
1159
1145
|
|
|
@@ -1270,26 +1256,25 @@ def render_set_market(s: SetOut, sealed: list[SealedProductOut], top: SetTopCard
|
|
|
1270
1256
|
)
|
|
1271
1257
|
console.print(heading("Top Cards", f"of {top.total_priced} priced printings"))
|
|
1272
1258
|
console.print(table)
|
|
1273
|
-
console.print(
|
|
1259
|
+
console.print()
|
|
1274
1260
|
|
|
1275
1261
|
|
|
1276
1262
|
def render_serials(s: CardSerials) -> None:
|
|
1277
1263
|
"""Which numbered copies of a printing have surfaced — one row per serial, sales and held
|
|
1278
|
-
copies kept apart (the same transfer can be seen from both sides).
|
|
1279
|
-
from the response's glossary, so the CLI, the site and the API say the same words."""
|
|
1264
|
+
copies kept apart (the same transfer can be seen from both sides)."""
|
|
1280
1265
|
subjects = ", ".join(s.subjects) or "—"
|
|
1281
1266
|
console.print()
|
|
1282
1267
|
console.print(_card_headline(s.card_number, subjects, s.set_name, _slot(s)))
|
|
1283
1268
|
|
|
1284
1269
|
if not s.print_run:
|
|
1285
|
-
console.print("\n [slab.dim]
|
|
1270
|
+
console.print("\n [slab.dim]Not serial-numbered.[/]\n")
|
|
1286
1271
|
return
|
|
1287
1272
|
|
|
1288
1273
|
unseen = max(0, s.print_run - s.serials_seen)
|
|
1289
1274
|
pct = f" ({s.coverage_pct:.0f}%)" if s.coverage_pct is not None else ""
|
|
1290
1275
|
console.print(heading("Serials Seen", f"{s.serials_seen} of /{s.print_run}{pct} · {unseen} never surfaced"))
|
|
1291
1276
|
if not s.serials:
|
|
1292
|
-
console.print(" [slab.dim]No
|
|
1277
|
+
console.print(" [slab.dim]No serials seen yet.[/]\n")
|
|
1293
1278
|
return
|
|
1294
1279
|
|
|
1295
1280
|
table = slab_table([
|
|
@@ -1311,10 +1296,6 @@ def render_serials(s: CardSerials) -> None:
|
|
|
1311
1296
|
sig.last_seen.isoformat() if sig.last_seen else "—",
|
|
1312
1297
|
)
|
|
1313
1298
|
console.print(table)
|
|
1314
|
-
for key in ("serials.coverage", "serials.held"):
|
|
1315
|
-
info = s.glossary.get(key)
|
|
1316
|
-
if info:
|
|
1317
|
-
console.print(f" [slab.dim]{info.label}: {info.summary}[/]")
|
|
1318
1299
|
console.print()
|
|
1319
1300
|
|
|
1320
1301
|
|
|
@@ -1344,7 +1325,7 @@ def render_comps(c: CardComps) -> None:
|
|
|
1344
1325
|
grade = comp.grade_key or "—"
|
|
1345
1326
|
# Grade sanity: "RAW" only means the title named no grade. A raw-labeled sale priced
|
|
1346
1327
|
# like this card's graded copies is probably a graded sale with a terse title.
|
|
1347
|
-
if
|
|
1328
|
+
if comp.grade_unconfirmed:
|
|
1348
1329
|
grade = f"[slab.warn]{grade}?[/]"
|
|
1349
1330
|
flagged += 1
|
|
1350
1331
|
sale_type = comp.sale_type or "—"
|
|
@@ -1354,10 +1335,7 @@ def render_comps(c: CardComps) -> None:
|
|
|
1354
1335
|
console.print(heading("Recent Comps", f"showing {len(c.comps)} of {c.total}"))
|
|
1355
1336
|
console.print(table)
|
|
1356
1337
|
if flagged:
|
|
1357
|
-
console.print(
|
|
1358
|
-
f" [slab.dim]? = grade unconfirmed: no grade in the listing title, but priced like "
|
|
1359
|
-
f"this card's graded copies — likely a graded sale, so don't read it as raw value.[/]"
|
|
1360
|
-
)
|
|
1338
|
+
console.print(" [slab.dim]? = grade unconfirmed[/]")
|
|
1361
1339
|
console.print()
|
|
1362
1340
|
|
|
1363
1341
|
|
|
@@ -1366,14 +1344,6 @@ def _whole_dollars(v) -> str:
|
|
|
1366
1344
|
return f"${float(v):,.0f}"
|
|
1367
1345
|
|
|
1368
1346
|
|
|
1369
|
-
def _signed_whole(v) -> str:
|
|
1370
|
-
"""`+$358` / `−$122`, colored — a gain or loss built on an estimate, whole dollars."""
|
|
1371
|
-
if v is None:
|
|
1372
|
-
return "[slab.dim]—[/]"
|
|
1373
|
-
n = round(float(v))
|
|
1374
|
-
return f"[{'slab.gain' if n >= 0 else 'slab.loss'}]{'+' if n >= 0 else '−'}${abs(n):,}[/]"
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
1347
|
def estimate_caption(estimates) -> str:
|
|
1378
1348
|
"""One line: which grades are estimated, and from what. Same words as the site's
|
|
1379
1349
|
`estimateCaption`."""
|
|
@@ -1383,180 +1353,113 @@ def estimate_caption(estimates) -> str:
|
|
|
1383
1353
|
return f"No {names} of this card has sold yet, so {those} estimated from similar cards."
|
|
1384
1354
|
|
|
1385
1355
|
|
|
1386
|
-
def
|
|
1387
|
-
"""
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
def _desk_reading_line(d: GradingDesk) -> str:
|
|
1394
|
-
"""Where the math lands: a headline and the outcomes, as DATA — never an instruction (grading
|
|
1395
|
-
is subjective and the user is holding the card). Same words as the site's break-even banner."""
|
|
1396
|
-
def name(grade_key: str | None) -> str:
|
|
1397
|
-
return (grade_key or "").replace("-", " ")
|
|
1398
|
-
|
|
1399
|
-
def outcome(grade_key: str | None) -> str | None:
|
|
1400
|
-
"""`a PSA 10 is $358 over raw` / `a PSA 9 is $122 under` — whole dollars when estimated."""
|
|
1401
|
-
lane = next((l for l in d.lanes if l.grade_key == grade_key), None)
|
|
1402
|
-
if lane is None or lane.payoff is None:
|
|
1403
|
-
return None
|
|
1404
|
-
if lane.estimate:
|
|
1405
|
-
n = round(float(lane.payoff))
|
|
1406
|
-
amount = f"${abs(n):,}"
|
|
1407
|
-
else:
|
|
1408
|
-
n = float(lane.payoff)
|
|
1409
|
-
amount = money(abs(n))
|
|
1410
|
-
return (f"a {name(grade_key)} [slab.loss]is {amount} under raw[/]" if n < 0
|
|
1411
|
-
else f"a {name(grade_key)} [slab.gain]is {amount} over raw[/]")
|
|
1412
|
-
|
|
1413
|
-
gem = next((l for l in d.lanes if l.grade_key.startswith(f"{d.grading_company}-")), None)
|
|
1414
|
-
if d.break_even == BreakEvenRegion.not_enough_data:
|
|
1415
|
-
return "[slab.dim]No graded sales to compare yet — nobody has sold a graded copy of this card recently.[/]"
|
|
1416
|
-
if d.break_even == BreakEvenRegion.pays_at_no_grade:
|
|
1417
|
-
top = outcome(gem.grade_key) if gem else None
|
|
1418
|
-
return "[slab.loss]No grade sells above raw[/]" + (f" — even {top}." if top else ".")
|
|
1419
|
-
if d.break_even == BreakEvenRegion.pays_at_any_grade:
|
|
1420
|
-
miss = None if d.miss_grade == "raw value" else outcome(d.miss_grade)
|
|
1421
|
-
return "[slab.gain]Every grade sells above raw[/]" + (f" — even {miss}." if miss else ".")
|
|
1422
|
-
head = (f"Grading breaks even at a {d.ten_confidence_needed:.0%} chance of a {name(gem.grade_key)}"
|
|
1423
|
-
if gem and d.ten_confidence_needed is not None else "Depends on the grade")
|
|
1424
|
-
parts = [outcome(gem.grade_key) if gem else None,
|
|
1425
|
-
"a miss holds about raw value" if d.miss_grade == "raw value" else outcome(d.miss_grade)]
|
|
1426
|
-
tail = "; ".join(p for p in parts if p)
|
|
1427
|
-
return f"[slab.foil]{head}[/]" + (f" — {tail}." if tail else ".")
|
|
1356
|
+
def _toned(text: str, price, raw) -> str:
|
|
1357
|
+
"""A price colored by where it sits against the raw value — green above, red below — the site
|
|
1358
|
+
board's tile tone, nothing more."""
|
|
1359
|
+
if price is None or raw is None or price == raw:
|
|
1360
|
+
return text
|
|
1361
|
+
return f"[{'slab.gain' if price > raw else 'slab.loss'}]{text}[/]"
|
|
1428
1362
|
|
|
1429
1363
|
|
|
1430
1364
|
def render_grading_desk(d: GradingDesk) -> None:
|
|
1431
|
-
"""One card's grading
|
|
1432
|
-
|
|
1433
|
-
entry."""
|
|
1365
|
+
"""One card's grading desk: what it sells for raw and at each grade, each price with its sales
|
|
1366
|
+
count and toned against raw — the data, never a reading of it. Prices are sales alone."""
|
|
1434
1367
|
subjects = ", ".join(d.subjects) or "—"
|
|
1435
1368
|
slot = f"{d.subset or '—'} · {d.finish}" if d.finish else (d.subset or "base")
|
|
1436
1369
|
console.print()
|
|
1437
1370
|
console.print(_card_headline(d.card_number, subjects, d.set_name, slot))
|
|
1438
1371
|
|
|
1439
1372
|
if d.raw is None:
|
|
1440
|
-
console.print("\n [slab.dim]
|
|
1441
|
-
"baseline to grade against.[/]\n")
|
|
1373
|
+
console.print("\n [slab.dim]No raw price yet.[/]\n")
|
|
1442
1374
|
return
|
|
1443
1375
|
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1376
|
+
raw = d.raw.fair_market_value
|
|
1377
|
+
pace = d.raw.liquidity is not None or any(l.liquidity for l in d.lanes)
|
|
1378
|
+
columns = [
|
|
1379
|
+
("Grade", {}),
|
|
1380
|
+
("Sells for", {"justify": "right"}),
|
|
1381
|
+
("Sales", {"justify": "right", "style": "slab.dim"}),
|
|
1382
|
+
]
|
|
1383
|
+
if pace:
|
|
1384
|
+
columns.append(("Sells", {"style": "slab.dim"}))
|
|
1385
|
+
table = slab_table(columns)
|
|
1386
|
+
|
|
1387
|
+
def row(*cells, liquidity=None):
|
|
1388
|
+
table.add_row(*cells, *([_liquidity_text(liquidity)] if pace else []))
|
|
1389
|
+
|
|
1390
|
+
row("RAW", f"[slab.value]{money(raw)}[/]", str(d.raw.sample_size), liquidity=d.raw.liquidity)
|
|
1391
|
+
for l in d.lanes:
|
|
1392
|
+
if l.estimate:
|
|
1393
|
+
# An estimate, not sales: tagged, whole dollars with its range.
|
|
1394
|
+
e = l.estimate
|
|
1395
|
+
row(f"{l.grade_key} [slab.warn]est.[/]",
|
|
1396
|
+
f"{_toned(_whole_dollars(e.fair_market_value), e.fair_market_value, raw)} [slab.dim]range "
|
|
1397
|
+
f"{_whole_dollars(e.range_low)}–{_whole_dollars(e.range_high)}[/]",
|
|
1398
|
+
"—")
|
|
1399
|
+
continue
|
|
1400
|
+
row(l.grade_key, _toned(money(l.fair_market_value), l.fair_market_value, raw),
|
|
1401
|
+
str(l.sample_size), liquidity=l.liquidity)
|
|
1402
|
+
console.print(heading("Price per Grade"))
|
|
1403
|
+
console.print(table)
|
|
1404
|
+
estimates = [l.estimate for l in d.lanes if l.estimate]
|
|
1405
|
+
if estimates:
|
|
1406
|
+
console.print(f" [slab.warn]est.[/] {estimate_caption(estimates)}")
|
|
1407
|
+
console.print()
|
|
1449
1408
|
|
|
1450
|
-
if d.lanes:
|
|
1451
|
-
table = slab_table([
|
|
1452
|
-
("If it grades", {}),
|
|
1453
|
-
("Sells for", {"justify": "right", "style": "slab.foil"}),
|
|
1454
|
-
("Over raw", {"justify": "right"}),
|
|
1455
|
-
("Sales", {"justify": "right", "style": "slab.dim"}),
|
|
1456
|
-
("Sells", {"style": "slab.dim"}),
|
|
1457
|
-
])
|
|
1458
|
-
for l in d.lanes:
|
|
1459
|
-
if l.estimate:
|
|
1460
|
-
# An estimate, not sales: tagged, whole dollars with its range — explained below.
|
|
1461
|
-
e = l.estimate
|
|
1462
|
-
table.add_row(
|
|
1463
|
-
f"{l.grade_key} [slab.warn]est.[/]",
|
|
1464
|
-
f"{_whole_dollars(e.fair_market_value)} [slab.dim]range "
|
|
1465
|
-
f"{_whole_dollars(e.range_low)}–{_whole_dollars(e.range_high)}[/]",
|
|
1466
|
-
_signed_whole(l.payoff), "—", "")
|
|
1467
|
-
continue
|
|
1468
|
-
n = f"{l.sample_size}!" if l.low_confidence else str(l.sample_size)
|
|
1469
|
-
table.add_row(l.grade_key, money(l.fair_market_value), signed_money(l.payoff), n,
|
|
1470
|
-
_liquidity_text(l.liquidity))
|
|
1471
|
-
console.print(heading("Payoff per Grade", "vs staying raw, before fees"))
|
|
1472
|
-
console.print(table)
|
|
1473
|
-
if any(l.low_confidence for l in d.lanes):
|
|
1474
|
-
console.print(" [slab.dim]! = priced off very few sales — an anecdote, "
|
|
1475
|
-
"not a market.[/]")
|
|
1476
|
-
estimates = [l.estimate for l in d.lanes if l.estimate]
|
|
1477
|
-
if estimates:
|
|
1478
|
-
console.print(f" [slab.warn]est.[/] {estimate_caption(estimates)}")
|
|
1479
|
-
for e in estimates:
|
|
1480
|
-
console.print(f" [slab.value]{e.grade_key.replace('-', ' ')} ≈ "
|
|
1481
|
-
f"{_whole_dollars(e.fair_market_value)}[/]")
|
|
1482
|
-
for line in estimate_lines(e):
|
|
1483
|
-
console.print(f" [slab.dim]{line}[/]")
|
|
1484
|
-
if any(l.liquidity for l in d.lanes):
|
|
1485
|
-
console.print(" [slab.dim]Sells = how often that grade actually trades — a payoff "
|
|
1486
|
-
"at a grade that sells twice a year is a longer wait than one that "
|
|
1487
|
-
"sells weekly.[/]")
|
|
1488
1409
|
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
and d.ten_confidence_needed_bad_day is not None and d.bad_day_grade:
|
|
1493
|
-
console.print(
|
|
1494
|
-
f" [slab.dim]If a miss comes back {d.bad_day_grade.replace('-', ' ')}: "
|
|
1495
|
-
f"{d.ten_confidence_needed_bad_day:.0%}.[/]"
|
|
1496
|
-
)
|
|
1497
|
-
if d.thin_data:
|
|
1498
|
-
console.print(" [slab.warn]Thin data[/][slab.dim] — part of this reading rests on "
|
|
1499
|
-
"1-2 sales. Treat it as a hint, not a market reading.[/]")
|
|
1500
|
-
if d.estimated:
|
|
1501
|
-
console.print(" [slab.warn]Uses estimates[/][slab.dim] — a grade above has never sold for "
|
|
1502
|
-
"this card, so this reading is a ballpark too.[/]")
|
|
1503
|
-
console.print()
|
|
1410
|
+
# The grader's grades the board gives a column each (the site's BOARD_GRADES); every other lane rides
|
|
1411
|
+
# along in "Other".
|
|
1412
|
+
_BOARD_GRADES = ("10", "9", "8")
|
|
1504
1413
|
|
|
1505
1414
|
|
|
1506
1415
|
def render_collection_grading_desk(sweep: CollectionGradingDesk) -> None:
|
|
1507
|
-
"""The
|
|
1508
|
-
|
|
1509
|
-
|
|
1416
|
+
"""The Grading Desk board, as the site draws it: every raw card you hold with raw AND graded
|
|
1417
|
+
sales, a row each — Raw, then the grader's 10 / 9 / 8, each price with its sales count and toned
|
|
1418
|
+
against raw, and any other grader's lanes beside them. Real sales only; highest graded price
|
|
1419
|
+
first."""
|
|
1510
1420
|
console.print()
|
|
1511
|
-
|
|
1512
|
-
console.print(heading("Grading Desk", covered))
|
|
1421
|
+
console.print(heading("Grading Desk"))
|
|
1513
1422
|
if not sweep.entries:
|
|
1514
|
-
console.print("\n [slab.dim]
|
|
1515
|
-
"against yet — no market to read. That's the honest answer, not an "
|
|
1516
|
-
"error.[/]\n")
|
|
1423
|
+
console.print("\n [slab.dim]No raw cards with graded sales yet.[/]\n")
|
|
1517
1424
|
return
|
|
1518
1425
|
|
|
1426
|
+
company = sweep.entries[0].desk.grading_company
|
|
1427
|
+
board = [f"{company}-{g}" for g in _BOARD_GRADES]
|
|
1519
1428
|
table = slab_table([
|
|
1520
1429
|
("Card", {"no_wrap": False}),
|
|
1521
|
-
("Raw", {"justify": "right"
|
|
1522
|
-
("
|
|
1523
|
-
("
|
|
1524
|
-
("Break-even", {"justify": "right", "style": "slab.foil"}),
|
|
1430
|
+
("Raw", {"justify": "right"}),
|
|
1431
|
+
*[(key.replace("-", " "), {"justify": "right"}) for key in board],
|
|
1432
|
+
("Other", {"no_wrap": False}),
|
|
1525
1433
|
("Qty", {"justify": "right", "style": "slab.dim"}),
|
|
1526
1434
|
])
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
}
|
|
1435
|
+
|
|
1436
|
+
def cell(lane, raw) -> str:
|
|
1437
|
+
return (f"{_toned(money(lane.fair_market_value), lane.fair_market_value, raw)} "
|
|
1438
|
+
f"[slab.dim]({lane.sample_size})[/]")
|
|
1439
|
+
|
|
1440
|
+
rows = []
|
|
1534
1441
|
for e in sweep.entries:
|
|
1535
1442
|
d = e.desk
|
|
1443
|
+
lanes = [l for l in d.lanes if not l.estimate]
|
|
1444
|
+
top = max((l.fair_market_value for l in lanes), default=None)
|
|
1445
|
+
rows.append((top, e, lanes))
|
|
1446
|
+
rows.sort(key=lambda r: (r[0] is None, -(r[0] or 0)))
|
|
1447
|
+
|
|
1448
|
+
for _, e, lanes in rows:
|
|
1449
|
+
d = e.desk
|
|
1450
|
+
raw = d.raw.fair_market_value if d.raw else None
|
|
1536
1451
|
who = ", ".join(d.subjects) or f"#{d.card_number}"
|
|
1537
1452
|
card = f"{who} · {d.set_name or '—'}" + (f" · {d.finish}" if d.finish else "")
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
None)
|
|
1541
|
-
miss = next((l for l in d.lanes if l.grade_key == d.miss_grade), None)
|
|
1542
|
-
if d.break_even == BreakEvenRegion.depends_on_grade and d.ten_confidence_needed is not None:
|
|
1543
|
-
be = f"{d.ten_confidence_needed:.0%} gem"
|
|
1544
|
-
else:
|
|
1545
|
-
be = BREAK_EVEN_TXT.get(d.break_even, d.break_even.value)
|
|
1546
|
-
thin = " [slab.warn]!" if d.thin_data else ""
|
|
1453
|
+
by_grade = {l.grade_key: l for l in lanes}
|
|
1454
|
+
others = [l for l in lanes if l.grade_key not in board]
|
|
1547
1455
|
table.add_row(
|
|
1548
1456
|
card,
|
|
1549
|
-
money(d.raw.
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1457
|
+
f"{money(raw)} [slab.dim]({d.raw.sample_size})[/]" if d.raw else "[slab.dim]—[/]",
|
|
1458
|
+
*[cell(by_grade[key], raw) if key in by_grade else "[slab.dim]—[/]" for key in board],
|
|
1459
|
+
", ".join(f"{l.grade_key.replace('-', ' ')} {cell(l, raw)}" for l in others) or "[slab.dim]—[/]",
|
|
1460
|
+
str(e.quantity),
|
|
1553
1461
|
)
|
|
1554
1462
|
console.print(table)
|
|
1555
|
-
console.print(" [slab.dim]Sale prices alone — no grading fee is included; subtract what you "
|
|
1556
|
-
"pay. Break-even = the chance of a gem at which grading and staying raw are "
|
|
1557
|
-
"worth the same — below it grading is worth less, above it more; 'any grade' = "
|
|
1558
|
-
"even a miss sells above raw, 'no grade' = even a gem doesn't. You can see each "
|
|
1559
|
-
"card's corners; slab can't — the call is yours. ! = rests on very few sales.[/]")
|
|
1560
1463
|
console.print()
|
|
1561
1464
|
|
|
1562
1465
|
|
|
@@ -1658,52 +1561,37 @@ def render_portfolio(
|
|
|
1658
1561
|
# Price history (cards + sealed share one table shape)
|
|
1659
1562
|
# ---------------------------------------------------------------------------
|
|
1660
1563
|
|
|
1661
|
-
#
|
|
1662
|
-
#
|
|
1663
|
-
#
|
|
1664
|
-
_THIN_NOTE = "⚠
|
|
1564
|
+
# The legend behind the ⚠ marker — a thin-sample FMV renders differently on purpose so a 2-comp
|
|
1565
|
+
# number can't masquerade as a solid one (a single cross-license sale once moved a box's headline by
|
|
1566
|
+
# $30). The count is the registry's, never a copy.
|
|
1567
|
+
_THIN_NOTE = f"⚠ fewer than {metrics.FMV_MIN_COMPS} sales"
|
|
1665
1568
|
|
|
1666
1569
|
|
|
1667
1570
|
def _history_table(points) -> tuple:
|
|
1668
|
-
"""(table, any_thin) for a list of CardPricePoint — the shared body of both history views.
|
|
1571
|
+
"""(table, any_thin) for a list of CardPricePoint — the shared body of both history views. Each
|
|
1572
|
+
row is that day's appraisal; no column differences them (two appraisals share most of their
|
|
1573
|
+
sales, so their difference is appraisal drift, not the market's move)."""
|
|
1669
1574
|
table = slab_table([
|
|
1670
1575
|
("Date", {"style": "slab.dim"}),
|
|
1671
1576
|
("FMV", {"justify": "right", "style": "slab.foil"}),
|
|
1672
1577
|
("Range", {"justify": "right", "style": "slab.dim"}),
|
|
1673
|
-
("Change", {"justify": "right"}),
|
|
1674
1578
|
("Comps", {"justify": "right", "style": "slab.dim"}),
|
|
1675
1579
|
])
|
|
1676
|
-
prev_median = None
|
|
1677
1580
|
any_thin = False
|
|
1678
1581
|
for p in points:
|
|
1679
1582
|
rng = "—"
|
|
1680
1583
|
if p.price_low is not None and p.price_high is not None:
|
|
1681
1584
|
rng = f"${p.price_low:,.0f} – ${p.price_high:,.0f}"
|
|
1682
|
-
change = "[slab.dim]—[/]"
|
|
1683
|
-
if prev_median is not None:
|
|
1684
|
-
change = signed_money(p.price_median - prev_median)
|
|
1685
1585
|
comps = str(p.sample_size)
|
|
1686
1586
|
if p.low_confidence:
|
|
1687
1587
|
comps += " ⚠"
|
|
1688
1588
|
any_thin = True
|
|
1689
|
-
table.add_row(str(p.date), money(p.price_median), rng,
|
|
1690
|
-
prev_median = p.price_median
|
|
1589
|
+
table.add_row(str(p.date), money(p.price_median), rng, comps)
|
|
1691
1590
|
return table, any_thin
|
|
1692
1591
|
|
|
1693
1592
|
|
|
1694
|
-
def _history_summary(points) -> None:
|
|
1695
|
-
"""First-vs-last net change line under a history table."""
|
|
1696
|
-
first, last = points[0], points[-1]
|
|
1697
|
-
total_change = last.price_median - first.price_median
|
|
1698
|
-
pct = (total_change / first.price_median * 100) if first.price_median else 0
|
|
1699
|
-
sign = "+" if total_change >= 0 else ""
|
|
1700
|
-
console.print(
|
|
1701
|
-
f" {signed_money(total_change)} [slab.dim]({sign}{pct:.1f}% over {len(points)} data points)[/]"
|
|
1702
|
-
)
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
1593
|
def render_price_history(h: CardPriceHistory) -> None:
|
|
1706
|
-
"""Display a card's price history as a table
|
|
1594
|
+
"""Display a card's price history as a table of dated appraisals."""
|
|
1707
1595
|
subjects = ", ".join(h.subjects) or "—"
|
|
1708
1596
|
console.print()
|
|
1709
1597
|
console.print(_card_headline(h.card_number, subjects, h.set_name, h.grade_key))
|
|
@@ -1715,7 +1603,6 @@ def render_price_history(h: CardPriceHistory) -> None:
|
|
|
1715
1603
|
table, any_thin = _history_table(h.points)
|
|
1716
1604
|
console.print(heading("Price History", f"{h.grade_key} · {h.start_date} to {h.end_date}"))
|
|
1717
1605
|
console.print(table)
|
|
1718
|
-
_history_summary(h.points)
|
|
1719
1606
|
if any_thin:
|
|
1720
1607
|
console.print(f" [slab.dim]{_THIN_NOTE}[/]")
|
|
1721
1608
|
console.print()
|
|
@@ -1736,7 +1623,6 @@ def render_sealed_price_history(h: SealedPriceHistory) -> None:
|
|
|
1736
1623
|
table, any_thin = _history_table(h.points)
|
|
1737
1624
|
console.print(heading("Price History", f"{h.start_date} to {h.end_date}"))
|
|
1738
1625
|
console.print(table)
|
|
1739
|
-
_history_summary(h.points)
|
|
1740
1626
|
if any_thin:
|
|
1741
1627
|
console.print(f" [slab.dim]{_THIN_NOTE}[/]")
|
|
1742
1628
|
console.print()
|
|
@@ -141,8 +141,7 @@ def break_format(b) -> str:
|
|
|
141
141
|
"""A break's format with its count — 'Blaster Box', or '2× Blaster Box' when it opened two.
|
|
142
142
|
Takes a BreakOut or a dashboard BreakStat (both carry break_type and quantity)."""
|
|
143
143
|
label = (b.break_type or "").replace("_", " ").title() or "—"
|
|
144
|
-
quantity
|
|
145
|
-
return f"{quantity}× {label}" if quantity > 1 else label
|
|
144
|
+
return f"{b.quantity}× {label}" if b.quantity > 1 else label
|
|
146
145
|
|
|
147
146
|
|
|
148
147
|
def money(v) -> str:
|
slab_cli-0.31.0/pyproject.toml
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "slab-cli"
|
|
3
|
-
version = "0.31.0"
|
|
4
|
-
description = "CLI for the slab trading-card API — catalog, collect, and track your cards from the terminal."
|
|
5
|
-
readme = "README.md"
|
|
6
|
-
authors = [{name = "dev_jeb"}]
|
|
7
|
-
requires-python = ">=3.13"
|
|
8
|
-
dependencies = [
|
|
9
|
-
# 0.31: CardSearchQuery.collapse_parallels — `card search` sends it on every query.
|
|
10
|
-
# 0.32 adds CompOut.grade_unconfirmed (the comps table's grade-sanity "?" marker) and the
|
|
11
|
-
# grading-desk models `slab card grade` / `slab collection grade` parse responses into.
|
|
12
|
-
# 0.34 reframes the grading desk from verdicts to break-even readings (BreakEvenRegion,
|
|
13
|
-
# GradingDesk.break_even) — the desk shows data, never tells the user to grade.
|
|
14
|
-
# 0.35 adds Liquidity/LiquidityLabel, which the market view's Sells column renders.
|
|
15
|
-
"slab-schemas>=0.64.0", # 0.64.0: sales velocity removed (the board no longer imports it)
|
|
16
|
-
"httpx>=0.27",
|
|
17
|
-
"rich>=13.0",
|
|
18
|
-
"InquirerPy>=0.3",
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
[dependency-groups]
|
|
22
|
-
dev = ["pytest>=8.0"]
|
|
23
|
-
|
|
24
|
-
[build-system]
|
|
25
|
-
requires = ["uv_build>=0.9.5,<0.10.0"]
|
|
26
|
-
build-backend = "uv_build"
|
|
27
|
-
|
|
28
|
-
[[tool.uv.index]]
|
|
29
|
-
name = "slab-registry"
|
|
30
|
-
url = "https://slab-package-domain-682033488592.d.codeartifact.us-east-1.amazonaws.com/pypi/slab-package-repository/simple/"
|
|
31
|
-
|
|
32
|
-
[project.scripts]
|
|
33
|
-
slab = "slab_cli.main:main"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|