feat(machine): persist exchange rate and currency in transactions
Add exchange_rate (sats per fiat unit) and currency columns to the transactions table so transaction economics can be audited after the fact. Includes schema migration v2 (fee columns) and v3 (rate/currency), updated IPC types, and atm-transactions CLI output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d64f6cd9ab
commit
310d0edb99
5 changed files with 65 additions and 4 deletions
|
|
@ -81,6 +81,7 @@ if $SUMMARY; then
|
|||
COUNT(*) AS 'Count',
|
||||
SUM(fiat_cents) / 100 AS 'Total Fiat',
|
||||
SUM(sats) AS 'Total Sats',
|
||||
SUM(fee_sats) AS 'Total Fee Sats',
|
||||
MIN(fiat_cents) / 100 AS 'Min Fiat',
|
||||
MAX(fiat_cents) / 100 AS 'Max Fiat'
|
||||
FROM transactions
|
||||
|
|
@ -129,8 +130,12 @@ fi
|
|||
sql "SELECT
|
||||
t.txid AS 'TX ID',
|
||||
t.type AS 'Type',
|
||||
t.currency AS 'Cur',
|
||||
t.fiat_cents / 100 AS 'Fiat',
|
||||
t.sats AS 'Sats',
|
||||
t.fee_sats AS 'Fee Sats',
|
||||
printf('%.1f%%', t.fee_percent * 100) AS 'Fee %',
|
||||
CASE WHEN t.exchange_rate > 0 THEN printf('%.0f', t.exchange_rate) ELSE '-' END AS 'Rate',
|
||||
datetime(t.created_at / 1000, 'unixepoch') AS 'Time (UTC)',
|
||||
group_concat('Q' || tb.denomination || 'x' || tb.count) AS 'Bills'
|
||||
FROM transactions t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue