slab-cli 0.30.2__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.30.2 → slab_cli-0.32.0}/PKG-INFO +5 -5
- {slab_cli-0.30.2 → slab_cli-0.32.0}/README.md +3 -3
- {slab_cli-0.30.2 → slab_cli-0.32.0}/pyproject.toml +4 -8
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/commands/catalog.py +2 -1
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/commands/collection.py +2 -1
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/commands/export.py +14 -14
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/commands/pricing.py +6 -6
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/commands/registry.py +3 -3
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/display.py +129 -272
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/theme.py +1 -2
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/__init__.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/banner.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/browse.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/client.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/commands/__init__.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/commands/breaks.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/commands/custom_sets.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/commands/lots.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/commands/setup.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/commands/update.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/config.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/context.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/flags.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/help.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/main.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/nav.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/paging.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/picker.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/platforms/__init__.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/platforms/base.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/platforms/posix.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/platforms/windows.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/prompts.py +0 -0
- {slab_cli-0.30.2 → slab_cli-0.32.0}/src/slab_cli/sources.py +0 -0
- {slab_cli-0.30.2 → 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
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "slab-cli"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.32.0"
|
|
4
4
|
description = "CLI for the slab trading-card API — catalog, collect, and track your cards from the terminal."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{name = "dev_jeb"}]
|
|
7
7
|
requires-python = ">=3.13"
|
|
8
8
|
dependencies = [
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
|
|
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.62.0", # sales velocity heat (hot / warm / cold)
|
|
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",
|
|
16
12
|
"httpx>=0.27",
|
|
17
13
|
"rich>=13.0",
|
|
18
14
|
"InquirerPy>=0.3",
|
|
@@ -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,11 +21,11 @@ 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
|
|
26
|
-
from slab_schemas
|
|
27
|
+
from slab_schemas import metrics
|
|
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
|
|
29
31
|
from slab_schemas.serials import CardSerials
|
|
@@ -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 = ""
|
|
@@ -884,41 +879,14 @@ def _collected_players_table(entries: list[CollectedPlayer]) -> Group | None:
|
|
|
884
879
|
return titled("Most Collected Players", table)
|
|
885
880
|
|
|
886
881
|
|
|
887
|
-
# The hottest-players
|
|
888
|
-
#
|
|
889
|
-
#
|
|
890
|
-
#
|
|
891
|
-
#
|
|
882
|
+
# The hottest-players price badge renders the label the SERVER computed (`HotPlayer.trend`). The
|
|
883
|
+
# threshold that turns a price move into "up" is the API's metric definition
|
|
884
|
+
# (`slab_schemas.metrics`), not the CLI's to copy: three clients once each carried their own ±2%
|
|
885
|
+
# band and disagreed. When an older server omits the label, the fallback is the registry's own
|
|
886
|
+
# function, imported — the same rule, never a restated literal.
|
|
892
887
|
# `tests/test_hot_labels.py` asserts no threshold number lives in this module.
|
|
893
888
|
|
|
894
889
|
|
|
895
|
-
def _ratio_text(ratio: float | None) -> str | None:
|
|
896
|
-
""""2×", "2.3×", "0.5×", "12×" — the same trimming as the collection app's velocity badge."""
|
|
897
|
-
if ratio is None:
|
|
898
|
-
return None
|
|
899
|
-
digits = 0 if ratio >= 10 else 1 if ratio >= 1 else 2
|
|
900
|
-
text = f"{ratio:.{digits}f}"
|
|
901
|
-
return (text.rstrip("0").rstrip(".") if "." in text else text) + "×"
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
_HEAT_TONE = {"hot": "slab.loss", "warm": "slab.dim", "cold": "slab.accent"}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
def _hot_velocity(e: HotPlayer) -> str:
|
|
908
|
-
"""Sales velocity, read as everywhere: "hot 2× (2 → 4)" — the served heat (the site draws it
|
|
909
|
-
as a gauge), then the ratio and the earlier window's count and the newer one's. A block from an
|
|
910
|
-
older server without `heat`, or no block at all, reads the registry's own heat and ratio."""
|
|
911
|
-
v = e.velocity
|
|
912
|
-
if v is None:
|
|
913
|
-
sales, prior = e.observed.sales, e.observed_prior.sales
|
|
914
|
-
heat, ratio = velocity_heat(sales, prior), velocity_ratio(sales, prior)
|
|
915
|
-
else:
|
|
916
|
-
sales, prior, ratio = v.sales, v.sales_prior, v.ratio
|
|
917
|
-
heat = v.heat or velocity_heat(sales, prior)
|
|
918
|
-
numbers = " ".join(x for x in (_ratio_text(ratio), f"({prior} → {sales})") if x)
|
|
919
|
-
return f"[{_HEAT_TONE[heat]}]{heat}[/] [slab.dim]{numbers}[/]"
|
|
920
|
-
|
|
921
|
-
|
|
922
890
|
def _hot_trend(e: HotPlayer) -> str:
|
|
923
891
|
"""Price direction arrow — how to tell a breakout (selling up) from a sell-off (selling down).
|
|
924
892
|
The direction is served; the percent beside it is the served `price_trend_pct`."""
|
|
@@ -933,16 +901,14 @@ def _hot_trend(e: HotPlayer) -> str:
|
|
|
933
901
|
return f"[slab.dim]→ {pct:+.0f}%[/]"
|
|
934
902
|
|
|
935
903
|
|
|
936
|
-
def _hottest_players_table(entries: list[HotPlayer]
|
|
904
|
+
def _hottest_players_table(entries: list[HotPlayer]) -> Group | None:
|
|
937
905
|
"""The board's counts and dollars are the sales slab SAW (`observed`), so the columns say
|
|
938
|
-
"seen"
|
|
939
|
-
reads as the size of the market."""
|
|
906
|
+
"seen" — never "volume", which reads as the size of the market — over the served window."""
|
|
940
907
|
if not entries:
|
|
941
908
|
return None
|
|
942
909
|
table = slab_table([
|
|
943
910
|
("Player", {"style": "slab.value"}),
|
|
944
|
-
("Sales seen (
|
|
945
|
-
("Velocity", {"justify": "right"}),
|
|
911
|
+
(f"Sales seen ({entries[0].observed.window_days}d)", {"justify": "right", "style": "slab.value"}),
|
|
946
912
|
("$ seen", {"justify": "right"}),
|
|
947
913
|
("Cards", {"justify": "right", "style": "slab.dim"}),
|
|
948
914
|
("Prices", {"justify": "right"}),
|
|
@@ -951,12 +917,11 @@ def _hottest_players_table(entries: list[HotPlayer], seen: MetricInfo | None = N
|
|
|
951
917
|
table.add_row(
|
|
952
918
|
e.name,
|
|
953
919
|
str(e.observed.sales),
|
|
954
|
-
_hot_velocity(e),
|
|
955
920
|
money(e.observed.dollars),
|
|
956
921
|
str(e.observed.cards) if e.observed.cards is not None else "—",
|
|
957
922
|
_hot_trend(e),
|
|
958
923
|
)
|
|
959
|
-
return titled("🔥 Hottest Players", table
|
|
924
|
+
return titled("🔥 Hottest Players", table)
|
|
960
925
|
|
|
961
926
|
|
|
962
927
|
def _rarest_owned_table(entries: list[RarestOwnedCard]) -> Group | None:
|
|
@@ -990,7 +955,7 @@ def render_community_board(b: CommunityBoard) -> None:
|
|
|
990
955
|
_valuable_table("Most Valuable — Graded", b.most_valuable_graded),
|
|
991
956
|
_collected_cards_table(b.most_collected),
|
|
992
957
|
_collected_players_table(b.most_collected_players),
|
|
993
|
-
_hottest_players_table(b.hottest_players
|
|
958
|
+
_hottest_players_table(b.hottest_players),
|
|
994
959
|
_rarest_owned_table(b.rarest_owned),
|
|
995
960
|
):
|
|
996
961
|
if block:
|
|
@@ -1041,7 +1006,6 @@ def browse_custom_sets(
|
|
|
1041
1006
|
items = result.items if isinstance(result, CustomSetSearchResult) else result
|
|
1042
1007
|
if not items:
|
|
1043
1008
|
console.print("[dim]No custom sets found.[/dim]")
|
|
1044
|
-
console.print(" [dim]Use `slab chase create` to make one.[/dim]")
|
|
1045
1009
|
return None
|
|
1046
1010
|
total = result.total if isinstance(result, CustomSetSearchResult) else len(items)
|
|
1047
1011
|
return browse(
|
|
@@ -1176,13 +1140,6 @@ def render_card_market(m: CardMarket) -> None:
|
|
|
1176
1140
|
window = m.price_points[0].window_days
|
|
1177
1141
|
console.print(heading("Market Price", f"{window}-day window, as of {m.as_of_date}"))
|
|
1178
1142
|
console.print(table)
|
|
1179
|
-
if any(pp.liquidity for pp in m.price_points):
|
|
1180
|
-
console.print(
|
|
1181
|
-
" [slab.dim]Sells = how often this exact printing and grade actually sells — the "
|
|
1182
|
-
"typical gap between real sales in the last 90 days, or the past year's count for "
|
|
1183
|
-
"slow movers. A rare seller isn't bad; it means the price is an estimate you may "
|
|
1184
|
-
"wait to realize.[/]"
|
|
1185
|
-
)
|
|
1186
1143
|
console.print()
|
|
1187
1144
|
|
|
1188
1145
|
|
|
@@ -1299,26 +1256,25 @@ def render_set_market(s: SetOut, sealed: list[SealedProductOut], top: SetTopCard
|
|
|
1299
1256
|
)
|
|
1300
1257
|
console.print(heading("Top Cards", f"of {top.total_priced} priced printings"))
|
|
1301
1258
|
console.print(table)
|
|
1302
|
-
console.print(
|
|
1259
|
+
console.print()
|
|
1303
1260
|
|
|
1304
1261
|
|
|
1305
1262
|
def render_serials(s: CardSerials) -> None:
|
|
1306
1263
|
"""Which numbered copies of a printing have surfaced — one row per serial, sales and held
|
|
1307
|
-
copies kept apart (the same transfer can be seen from both sides).
|
|
1308
|
-
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)."""
|
|
1309
1265
|
subjects = ", ".join(s.subjects) or "—"
|
|
1310
1266
|
console.print()
|
|
1311
1267
|
console.print(_card_headline(s.card_number, subjects, s.set_name, _slot(s)))
|
|
1312
1268
|
|
|
1313
1269
|
if not s.print_run:
|
|
1314
|
-
console.print("\n [slab.dim]
|
|
1270
|
+
console.print("\n [slab.dim]Not serial-numbered.[/]\n")
|
|
1315
1271
|
return
|
|
1316
1272
|
|
|
1317
1273
|
unseen = max(0, s.print_run - s.serials_seen)
|
|
1318
1274
|
pct = f" ({s.coverage_pct:.0f}%)" if s.coverage_pct is not None else ""
|
|
1319
1275
|
console.print(heading("Serials Seen", f"{s.serials_seen} of /{s.print_run}{pct} · {unseen} never surfaced"))
|
|
1320
1276
|
if not s.serials:
|
|
1321
|
-
console.print(" [slab.dim]No
|
|
1277
|
+
console.print(" [slab.dim]No serials seen yet.[/]\n")
|
|
1322
1278
|
return
|
|
1323
1279
|
|
|
1324
1280
|
table = slab_table([
|
|
@@ -1340,10 +1296,6 @@ def render_serials(s: CardSerials) -> None:
|
|
|
1340
1296
|
sig.last_seen.isoformat() if sig.last_seen else "—",
|
|
1341
1297
|
)
|
|
1342
1298
|
console.print(table)
|
|
1343
|
-
for key in ("serials.coverage", "serials.held"):
|
|
1344
|
-
info = s.glossary.get(key)
|
|
1345
|
-
if info:
|
|
1346
|
-
console.print(f" [slab.dim]{info.label}: {info.summary}[/]")
|
|
1347
1299
|
console.print()
|
|
1348
1300
|
|
|
1349
1301
|
|
|
@@ -1373,7 +1325,7 @@ def render_comps(c: CardComps) -> None:
|
|
|
1373
1325
|
grade = comp.grade_key or "—"
|
|
1374
1326
|
# Grade sanity: "RAW" only means the title named no grade. A raw-labeled sale priced
|
|
1375
1327
|
# like this card's graded copies is probably a graded sale with a terse title.
|
|
1376
|
-
if
|
|
1328
|
+
if comp.grade_unconfirmed:
|
|
1377
1329
|
grade = f"[slab.warn]{grade}?[/]"
|
|
1378
1330
|
flagged += 1
|
|
1379
1331
|
sale_type = comp.sale_type or "—"
|
|
@@ -1383,10 +1335,7 @@ def render_comps(c: CardComps) -> None:
|
|
|
1383
1335
|
console.print(heading("Recent Comps", f"showing {len(c.comps)} of {c.total}"))
|
|
1384
1336
|
console.print(table)
|
|
1385
1337
|
if flagged:
|
|
1386
|
-
console.print(
|
|
1387
|
-
f" [slab.dim]? = grade unconfirmed: no grade in the listing title, but priced like "
|
|
1388
|
-
f"this card's graded copies — likely a graded sale, so don't read it as raw value.[/]"
|
|
1389
|
-
)
|
|
1338
|
+
console.print(" [slab.dim]? = grade unconfirmed[/]")
|
|
1390
1339
|
console.print()
|
|
1391
1340
|
|
|
1392
1341
|
|
|
@@ -1395,14 +1344,6 @@ def _whole_dollars(v) -> str:
|
|
|
1395
1344
|
return f"${float(v):,.0f}"
|
|
1396
1345
|
|
|
1397
1346
|
|
|
1398
|
-
def _signed_whole(v) -> str:
|
|
1399
|
-
"""`+$358` / `−$122`, colored — a gain or loss built on an estimate, whole dollars."""
|
|
1400
|
-
if v is None:
|
|
1401
|
-
return "[slab.dim]—[/]"
|
|
1402
|
-
n = round(float(v))
|
|
1403
|
-
return f"[{'slab.gain' if n >= 0 else 'slab.loss'}]{'+' if n >= 0 else '−'}${abs(n):,}[/]"
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
1347
|
def estimate_caption(estimates) -> str:
|
|
1407
1348
|
"""One line: which grades are estimated, and from what. Same words as the site's
|
|
1408
1349
|
`estimateCaption`."""
|
|
@@ -1412,180 +1353,113 @@ def estimate_caption(estimates) -> str:
|
|
|
1412
1353
|
return f"No {names} of this card has sold yet, so {those} estimated from similar cards."
|
|
1413
1354
|
|
|
1414
1355
|
|
|
1415
|
-
def
|
|
1416
|
-
"""
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
def _desk_reading_line(d: GradingDesk) -> str:
|
|
1423
|
-
"""Where the math lands: a headline and the outcomes, as DATA — never an instruction (grading
|
|
1424
|
-
is subjective and the user is holding the card). Same words as the site's break-even banner."""
|
|
1425
|
-
def name(grade_key: str | None) -> str:
|
|
1426
|
-
return (grade_key or "").replace("-", " ")
|
|
1427
|
-
|
|
1428
|
-
def outcome(grade_key: str | None) -> str | None:
|
|
1429
|
-
"""`a PSA 10 is $358 over raw` / `a PSA 9 is $122 under` — whole dollars when estimated."""
|
|
1430
|
-
lane = next((l for l in d.lanes if l.grade_key == grade_key), None)
|
|
1431
|
-
if lane is None or lane.payoff is None:
|
|
1432
|
-
return None
|
|
1433
|
-
if lane.estimate:
|
|
1434
|
-
n = round(float(lane.payoff))
|
|
1435
|
-
amount = f"${abs(n):,}"
|
|
1436
|
-
else:
|
|
1437
|
-
n = float(lane.payoff)
|
|
1438
|
-
amount = money(abs(n))
|
|
1439
|
-
return (f"a {name(grade_key)} [slab.loss]is {amount} under raw[/]" if n < 0
|
|
1440
|
-
else f"a {name(grade_key)} [slab.gain]is {amount} over raw[/]")
|
|
1441
|
-
|
|
1442
|
-
gem = next((l for l in d.lanes if l.grade_key.startswith(f"{d.grading_company}-")), None)
|
|
1443
|
-
if d.break_even == BreakEvenRegion.not_enough_data:
|
|
1444
|
-
return "[slab.dim]No graded sales to compare yet — nobody has sold a graded copy of this card recently.[/]"
|
|
1445
|
-
if d.break_even == BreakEvenRegion.pays_at_no_grade:
|
|
1446
|
-
top = outcome(gem.grade_key) if gem else None
|
|
1447
|
-
return "[slab.loss]No grade sells above raw[/]" + (f" — even {top}." if top else ".")
|
|
1448
|
-
if d.break_even == BreakEvenRegion.pays_at_any_grade:
|
|
1449
|
-
miss = None if d.miss_grade == "raw value" else outcome(d.miss_grade)
|
|
1450
|
-
return "[slab.gain]Every grade sells above raw[/]" + (f" — even {miss}." if miss else ".")
|
|
1451
|
-
head = (f"Grading breaks even at a {d.ten_confidence_needed:.0%} chance of a {name(gem.grade_key)}"
|
|
1452
|
-
if gem and d.ten_confidence_needed is not None else "Depends on the grade")
|
|
1453
|
-
parts = [outcome(gem.grade_key) if gem else None,
|
|
1454
|
-
"a miss holds about raw value" if d.miss_grade == "raw value" else outcome(d.miss_grade)]
|
|
1455
|
-
tail = "; ".join(p for p in parts if p)
|
|
1456
|
-
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}[/]"
|
|
1457
1362
|
|
|
1458
1363
|
|
|
1459
1364
|
def render_grading_desk(d: GradingDesk) -> None:
|
|
1460
|
-
"""One card's grading
|
|
1461
|
-
|
|
1462
|
-
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."""
|
|
1463
1367
|
subjects = ", ".join(d.subjects) or "—"
|
|
1464
1368
|
slot = f"{d.subset or '—'} · {d.finish}" if d.finish else (d.subset or "base")
|
|
1465
1369
|
console.print()
|
|
1466
1370
|
console.print(_card_headline(d.card_number, subjects, d.set_name, slot))
|
|
1467
1371
|
|
|
1468
1372
|
if d.raw is None:
|
|
1469
|
-
console.print("\n [slab.dim]
|
|
1470
|
-
"baseline to grade against.[/]\n")
|
|
1373
|
+
console.print("\n [slab.dim]No raw price yet.[/]\n")
|
|
1471
1374
|
return
|
|
1472
1375
|
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
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()
|
|
1478
1408
|
|
|
1479
|
-
if d.lanes:
|
|
1480
|
-
table = slab_table([
|
|
1481
|
-
("If it grades", {}),
|
|
1482
|
-
("Sells for", {"justify": "right", "style": "slab.foil"}),
|
|
1483
|
-
("Over raw", {"justify": "right"}),
|
|
1484
|
-
("Sales", {"justify": "right", "style": "slab.dim"}),
|
|
1485
|
-
("Sells", {"style": "slab.dim"}),
|
|
1486
|
-
])
|
|
1487
|
-
for l in d.lanes:
|
|
1488
|
-
if l.estimate:
|
|
1489
|
-
# An estimate, not sales: tagged, whole dollars with its range — explained below.
|
|
1490
|
-
e = l.estimate
|
|
1491
|
-
table.add_row(
|
|
1492
|
-
f"{l.grade_key} [slab.warn]est.[/]",
|
|
1493
|
-
f"{_whole_dollars(e.fair_market_value)} [slab.dim]range "
|
|
1494
|
-
f"{_whole_dollars(e.range_low)}–{_whole_dollars(e.range_high)}[/]",
|
|
1495
|
-
_signed_whole(l.payoff), "—", "")
|
|
1496
|
-
continue
|
|
1497
|
-
n = f"{l.sample_size}!" if l.low_confidence else str(l.sample_size)
|
|
1498
|
-
table.add_row(l.grade_key, money(l.fair_market_value), signed_money(l.payoff), n,
|
|
1499
|
-
_liquidity_text(l.liquidity))
|
|
1500
|
-
console.print(heading("Payoff per Grade", "vs staying raw, before fees"))
|
|
1501
|
-
console.print(table)
|
|
1502
|
-
if any(l.low_confidence for l in d.lanes):
|
|
1503
|
-
console.print(" [slab.dim]! = priced off very few sales — an anecdote, "
|
|
1504
|
-
"not a market.[/]")
|
|
1505
|
-
estimates = [l.estimate for l in d.lanes if l.estimate]
|
|
1506
|
-
if estimates:
|
|
1507
|
-
console.print(f" [slab.warn]est.[/] {estimate_caption(estimates)}")
|
|
1508
|
-
for e in estimates:
|
|
1509
|
-
console.print(f" [slab.value]{e.grade_key.replace('-', ' ')} ≈ "
|
|
1510
|
-
f"{_whole_dollars(e.fair_market_value)}[/]")
|
|
1511
|
-
for line in estimate_lines(e):
|
|
1512
|
-
console.print(f" [slab.dim]{line}[/]")
|
|
1513
|
-
if any(l.liquidity for l in d.lanes):
|
|
1514
|
-
console.print(" [slab.dim]Sells = how often that grade actually trades — a payoff "
|
|
1515
|
-
"at a grade that sells twice a year is a longer wait than one that "
|
|
1516
|
-
"sells weekly.[/]")
|
|
1517
1409
|
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
and d.ten_confidence_needed_bad_day is not None and d.bad_day_grade:
|
|
1522
|
-
console.print(
|
|
1523
|
-
f" [slab.dim]If a miss comes back {d.bad_day_grade.replace('-', ' ')}: "
|
|
1524
|
-
f"{d.ten_confidence_needed_bad_day:.0%}.[/]"
|
|
1525
|
-
)
|
|
1526
|
-
if d.thin_data:
|
|
1527
|
-
console.print(" [slab.warn]Thin data[/][slab.dim] — part of this reading rests on "
|
|
1528
|
-
"1-2 sales. Treat it as a hint, not a market reading.[/]")
|
|
1529
|
-
if d.estimated:
|
|
1530
|
-
console.print(" [slab.warn]Uses estimates[/][slab.dim] — a grade above has never sold for "
|
|
1531
|
-
"this card, so this reading is a ballpark too.[/]")
|
|
1532
|
-
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")
|
|
1533
1413
|
|
|
1534
1414
|
|
|
1535
1415
|
def render_collection_grading_desk(sweep: CollectionGradingDesk) -> None:
|
|
1536
|
-
"""The
|
|
1537
|
-
|
|
1538
|
-
|
|
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."""
|
|
1539
1420
|
console.print()
|
|
1540
|
-
|
|
1541
|
-
console.print(heading("Grading Desk", covered))
|
|
1421
|
+
console.print(heading("Grading Desk"))
|
|
1542
1422
|
if not sweep.entries:
|
|
1543
|
-
console.print("\n [slab.dim]
|
|
1544
|
-
"against yet — no market to read. That's the honest answer, not an "
|
|
1545
|
-
"error.[/]\n")
|
|
1423
|
+
console.print("\n [slab.dim]No raw cards with graded sales yet.[/]\n")
|
|
1546
1424
|
return
|
|
1547
1425
|
|
|
1426
|
+
company = sweep.entries[0].desk.grading_company
|
|
1427
|
+
board = [f"{company}-{g}" for g in _BOARD_GRADES]
|
|
1548
1428
|
table = slab_table([
|
|
1549
1429
|
("Card", {"no_wrap": False}),
|
|
1550
|
-
("Raw", {"justify": "right"
|
|
1551
|
-
("
|
|
1552
|
-
("
|
|
1553
|
-
("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}),
|
|
1554
1433
|
("Qty", {"justify": "right", "style": "slab.dim"}),
|
|
1555
1434
|
])
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
}
|
|
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 = []
|
|
1563
1441
|
for e in sweep.entries:
|
|
1564
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
|
|
1565
1451
|
who = ", ".join(d.subjects) or f"#{d.card_number}"
|
|
1566
1452
|
card = f"{who} · {d.set_name or '—'}" + (f" · {d.finish}" if d.finish else "")
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
None)
|
|
1570
|
-
miss = next((l for l in d.lanes if l.grade_key == d.miss_grade), None)
|
|
1571
|
-
if d.break_even == BreakEvenRegion.depends_on_grade and d.ten_confidence_needed is not None:
|
|
1572
|
-
be = f"{d.ten_confidence_needed:.0%} gem"
|
|
1573
|
-
else:
|
|
1574
|
-
be = BREAK_EVEN_TXT.get(d.break_even, d.break_even.value)
|
|
1575
|
-
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]
|
|
1576
1455
|
table.add_row(
|
|
1577
1456
|
card,
|
|
1578
|
-
money(d.raw.
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
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),
|
|
1582
1461
|
)
|
|
1583
1462
|
console.print(table)
|
|
1584
|
-
console.print(" [slab.dim]Sale prices alone — no grading fee is included; subtract what you "
|
|
1585
|
-
"pay. Break-even = the chance of a gem at which grading and staying raw are "
|
|
1586
|
-
"worth the same — below it grading is worth less, above it more; 'any grade' = "
|
|
1587
|
-
"even a miss sells above raw, 'no grade' = even a gem doesn't. You can see each "
|
|
1588
|
-
"card's corners; slab can't — the call is yours. ! = rests on very few sales.[/]")
|
|
1589
1463
|
console.print()
|
|
1590
1464
|
|
|
1591
1465
|
|
|
@@ -1687,52 +1561,37 @@ def render_portfolio(
|
|
|
1687
1561
|
# Price history (cards + sealed share one table shape)
|
|
1688
1562
|
# ---------------------------------------------------------------------------
|
|
1689
1563
|
|
|
1690
|
-
#
|
|
1691
|
-
#
|
|
1692
|
-
#
|
|
1693
|
-
_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"
|
|
1694
1568
|
|
|
1695
1569
|
|
|
1696
1570
|
def _history_table(points) -> tuple:
|
|
1697
|
-
"""(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)."""
|
|
1698
1574
|
table = slab_table([
|
|
1699
1575
|
("Date", {"style": "slab.dim"}),
|
|
1700
1576
|
("FMV", {"justify": "right", "style": "slab.foil"}),
|
|
1701
1577
|
("Range", {"justify": "right", "style": "slab.dim"}),
|
|
1702
|
-
("Change", {"justify": "right"}),
|
|
1703
1578
|
("Comps", {"justify": "right", "style": "slab.dim"}),
|
|
1704
1579
|
])
|
|
1705
|
-
prev_median = None
|
|
1706
1580
|
any_thin = False
|
|
1707
1581
|
for p in points:
|
|
1708
1582
|
rng = "—"
|
|
1709
1583
|
if p.price_low is not None and p.price_high is not None:
|
|
1710
1584
|
rng = f"${p.price_low:,.0f} – ${p.price_high:,.0f}"
|
|
1711
|
-
change = "[slab.dim]—[/]"
|
|
1712
|
-
if prev_median is not None:
|
|
1713
|
-
change = signed_money(p.price_median - prev_median)
|
|
1714
1585
|
comps = str(p.sample_size)
|
|
1715
1586
|
if p.low_confidence:
|
|
1716
1587
|
comps += " ⚠"
|
|
1717
1588
|
any_thin = True
|
|
1718
|
-
table.add_row(str(p.date), money(p.price_median), rng,
|
|
1719
|
-
prev_median = p.price_median
|
|
1589
|
+
table.add_row(str(p.date), money(p.price_median), rng, comps)
|
|
1720
1590
|
return table, any_thin
|
|
1721
1591
|
|
|
1722
1592
|
|
|
1723
|
-
def _history_summary(points) -> None:
|
|
1724
|
-
"""First-vs-last net change line under a history table."""
|
|
1725
|
-
first, last = points[0], points[-1]
|
|
1726
|
-
total_change = last.price_median - first.price_median
|
|
1727
|
-
pct = (total_change / first.price_median * 100) if first.price_median else 0
|
|
1728
|
-
sign = "+" if total_change >= 0 else ""
|
|
1729
|
-
console.print(
|
|
1730
|
-
f" {signed_money(total_change)} [slab.dim]({sign}{pct:.1f}% over {len(points)} data points)[/]"
|
|
1731
|
-
)
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
1593
|
def render_price_history(h: CardPriceHistory) -> None:
|
|
1735
|
-
"""Display a card's price history as a table
|
|
1594
|
+
"""Display a card's price history as a table of dated appraisals."""
|
|
1736
1595
|
subjects = ", ".join(h.subjects) or "—"
|
|
1737
1596
|
console.print()
|
|
1738
1597
|
console.print(_card_headline(h.card_number, subjects, h.set_name, h.grade_key))
|
|
@@ -1744,7 +1603,6 @@ def render_price_history(h: CardPriceHistory) -> None:
|
|
|
1744
1603
|
table, any_thin = _history_table(h.points)
|
|
1745
1604
|
console.print(heading("Price History", f"{h.grade_key} · {h.start_date} to {h.end_date}"))
|
|
1746
1605
|
console.print(table)
|
|
1747
|
-
_history_summary(h.points)
|
|
1748
1606
|
if any_thin:
|
|
1749
1607
|
console.print(f" [slab.dim]{_THIN_NOTE}[/]")
|
|
1750
1608
|
console.print()
|
|
@@ -1765,7 +1623,6 @@ def render_sealed_price_history(h: SealedPriceHistory) -> None:
|
|
|
1765
1623
|
table, any_thin = _history_table(h.points)
|
|
1766
1624
|
console.print(heading("Price History", f"{h.start_date} to {h.end_date}"))
|
|
1767
1625
|
console.print(table)
|
|
1768
|
-
_history_summary(h.points)
|
|
1769
1626
|
if any_thin:
|
|
1770
1627
|
console.print(f" [slab.dim]{_THIN_NOTE}[/]")
|
|
1771
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:
|
|
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
|