Skip to content

Commit c0d6e8f

Browse files
author
metalusmonk
committed
new read me online, merging with local.
2 parents 96e7551 + 92fb718 commit c0d6e8f

1 file changed

Lines changed: 22 additions & 62 deletions

File tree

README.md

Lines changed: 22 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,15 @@ Everything is scriptable and automation-friendly.
6161

6262
## Installation
6363

64-
```bash
64+
6565
pip install -r requirements.txt
6666
For development / tests:
6767

68-
bash
69-
Copy code
68+
7069
pip install -r requirements-dev.txt
7170
Configuration
7271
API Keys (Environment Variables)
73-
bash
74-
Copy code
72+
7573
export COINBASE_API_KEY="..."
7674
export COINBASE_SECRET="..."
7775

@@ -82,48 +80,42 @@ export BINANCEUS_API_KEY="..."
8280
export BINANCEUS_SECRET="..."
8381
Optional config.yaml
8482
yaml
85-
Copy code
83+
8684
exchanges:
8785
- coinbase
8886
- kraken
89-
# - binanceus
87+
- binanceus
88+
9089
Basic Usage
90+
9191
Sync all configured exchanges
92-
bash
93-
Copy code
92+
9493
python3 crypto_pnl_tool.py
9594
Sync only (no calculations)
96-
bash
97-
Copy code
95+
9896
python3 crypto_pnl_tool.py --sync-only
9997
Skip syncing (use local DB only)
100-
bash
101-
Copy code
98+
10299
python3 crypto_pnl_tool.py --no-sync
103100
Inspection & Audit Commands
104101
List deposits (for cost basis overrides)
105-
bash
106-
Copy code
102+
107103
python3 crypto_pnl_tool.py --list-deposits --no-sync
108104
List withdrawals
109-
bash
110-
Copy code
105+
111106
python3 crypto_pnl_tool.py --list-withdrawals --no-sync
112107
List recent trades
113-
bash
114-
Copy code
108+
115109
python3 crypto_pnl_tool.py --list-trades --trade-limit 50 --no-sync
116110
Inspect open FIFO lots (audit view)
117-
bash
118-
Copy code
111+
119112
# Single pair
120113
python3 crypto_pnl_tool.py --open-lots BTC/USD --no-sync
121114

122115
# All quote pairs for a base asset
123116
python3 crypto_pnl_tool.py --open-lots BTC --no-sync
124117
Cost Basis Overrides (External Wallets)
125-
python
126-
Copy code
118+
127119
from decimal import Decimal
128120
from crypto_pnl_tool import get_db_conn, add_cost_basis_override
129121

@@ -139,88 +131,60 @@ add_cost_basis_override(
139131
Overrides create synthetic FIFO lots used in realized P&L.
140132

141133
P&L Output
142-
bash
143-
Copy code
144134
python3 crypto_pnl_tool.py
145135
Example:
146-
147-
makefile
148-
Copy code
149136
BTC/USD: P&L=-8.74 USD, Fees=1.23 USD
150137
ETH/USD: P&L=412.55 USD, Fees=4.10 USD
151-
Portfolio totals:
152138

153-
bash
154-
Copy code
139+
Portfolio totals:
155140
python3 crypto_pnl_tool.py --portfolio
156141
8949-Style Tax Export
142+
157143
Detailed FIFO export
158-
bash
159-
Copy code
160144
python3 crypto_pnl_tool.py \
161145
--tax-year 2025 \
162146
--export-8949 8949_2025.csv
163147
Optional rounding (export only)
164-
bash
165-
Copy code
148+
166149
python3 crypto_pnl_tool.py \
167150
--tax-year 2025 \
168151
--export-8949 8949_2025.csv \
169152
--currency-decimals 2 \
170153
--asset-decimals 8
154+
171155
Summary totals (separate file)
172-
bash
173-
Copy code
174156
python3 crypto_pnl_tool.py \
175157
--tax-year 2025 \
176158
--export-8949-summary 8949_summary_2025.csv
177159
Data Storage
178160
All data is stored locally in:
179-
180-
Copy code
181161
crypto_pnl.sqlite
182-
Benefits:
183162

163+
Benefits:
184164
Full auditability
185-
186165
No repeated historical API calls
187-
188166
Easy inspection with SQLite tools
189-
190167
Testing
191168
Run FIFO unit tests:
192-
193-
bash
194-
Copy code
195169
pytest -q
196-
Tests cover:
197170

171+
Tests cover:
198172
FIFO math
199-
200173
Partial lots
201-
202174
Fees
203-
204175
Deposit overrides
205-
206176
Year filtering
207177

208178
Docker (Optional)
209179
Docker is provided as a convenience only.
210-
211-
bash
212-
Copy code
213180
docker build -t crypto-pnl-tool .
214-
bash
215-
Copy code
216181
docker run --rm \
217182
-e COINBASE_API_KEY="..." \
218183
-e COINBASE_SECRET="..." \
219184
-v "$(pwd):/app" \
220185
crypto-pnl-tool
186+
221187
Project Structure
222-
text
223-
Copy code
224188
crypto-pnl-tool/
225189
├── crypto_pnl_tool.py
226190
├── crypto_pnl.sqlite
@@ -240,13 +204,9 @@ This tool is for accounting and analysis — not tax or legal advice.
240204

241205
Roadmap (Optional)
242206
TurboTax-specific import mapping
243-
244207
USD normalization for non-USD quotes
245-
246208
FastAPI service wrapper
247-
248209
Web dashboard
249-
250210
Multi-year carryover validation
251211

252212
License

0 commit comments

Comments
 (0)