ledger: crypto top-10 coins by market cap extraction
This commit is contained in:
1 parent
4794e25ba8
commit
d9d03df549
4 files changed
+49
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import csv
|
||||
|
||||
p = '/root/troupe-standup/wizard-work/ledger/crypto_top10.csv'
|
||||
rows = list(csv.DictReader(open(p)))
|
||||
|
||||
expected_names = ['Bitcoin', 'Ethereum', 'Tether', 'BNB', 'XRP', 'USDC',
|
||||
'Solana', 'TRON', 'Figure Heloc', 'Zcash']
|
||||
expected_ranks = list(range(1, 11))
|
||||
|
||||
assert len(rows) == 10, f'row count = {len(rows)}'
|
||||
assert [r['name'] for r in rows] == expected_names, 'names/order'
|
||||
assert [int(r['rank']) for r in rows] == expected_ranks, 'ranks'
|
||||
assert all(float(r['current_price']) > 0 for r in rows), 'non-positive price'
|
||||
assert all(float(r['market_cap']) > 0 for r in rows), 'non-positive market cap'
|
||||
caps = [float(r['market_cap']) for r in rows]
|
||||
assert caps == sorted(caps, reverse=True), 'market cap not descending'
|
||||
print('CHECK_OK 10 rows, ranks 1-10, names/order/values verified')
|
||||
|
||||
# Cross-check against the raw API snapshot: names present and rank position consistent.
|
||||
raw = __import__('json').load(open('/root/troupe-standup/wizard-work/ledger/raw_crypto.json'))
|
||||
raw_names = [r['name'] for r in raw[:10]]
|
||||
assert raw_names == expected_names, 'raw snapshot rank mismatch'
|
||||
print('CHECK_OK snapshot matches live fetch')
|
||||
@@ -0,0 +1,11 @@
|
||||
rank,name,symbol,current_price,market_cap,market_cap_change_24h_pct,total_volume,circulating_supply,ath,ath_date,atl,atl_date,last_updated
|
||||
1,Bitcoin,btc,77653,1561241457634,,27745541344,20105365.0,126080,2025-10-06T10:57:42.000Z,67.81,2013-07-05T16:00:00.000Z,2026-11-03T13:34:56.000Z
|
||||
2,Ethereum,eth,2300.67,281110166949,,9322563998,122186161.86556138,4946.05,2025-08-24T11:21:03.000Z,0.432979,2015-10-19T16:00:00.000Z,2026-11-03T13:34:56.000Z
|
||||
3,Tether,usdt,0.998656,178874816049,,46336992364,179115594476.11313,1.32,2018-07-23T16:00:00.000Z,0.572521,2015-03-01T16:00:00.000Z,2026-11-03T13:34:56.000Z
|
||||
4,BNB,bnb,701.13,92206203485,,831804618,131511238.59,1369.99,2025-10-13T00:41:24.000Z,0.0398177,2017-10-18T16:00:00.000Z,2026-11-03T13:34:56.000Z
|
||||
5,XRP,xrp,1.29,81546310900,,1677855481,63351197653.0,3.65,2025-07-17T19:40:53.000Z,0.00268621,2014-05-21T16:00:00.000Z,2026-11-03T13:34:56.000Z
|
||||
6,USDC,usdc,0.999357,70833628914,,13134714917,70879197704.356,1.043,2018-11-14T16:00:00.000Z,0.877647,2023-03-11T00:02:13.000Z,2026-11-03T13:34:56.000Z
|
||||
7,Solana,sol,93.38,55118145472,,2473394176,590262007.9215724,293.31,2025-01-19T03:15:27.000Z,0.500801,2020-05-11T11:35:23.000Z,2026-11-03T13:34:56.000Z
|
||||
8,TRON,trx,0.321718,30571028256,,529660739,95024229483.33528,0.431288,2024-12-03T16:10:40.000Z,0.00180434,2017-11-11T16:00:00.000Z,2026-11-03T13:34:56.000Z
|
||||
9,Figure Heloc,figr_heloc,1.032,26855541182,,22046449,26013700802.239,1.076,2026-11-01T13:20:30.000Z,0.155357,2025-10-31T06:27:24.000Z,2026-11-03T13:34:56.000Z
|
||||
10,Zcash,zec,1206.46,20535722566,,1099429451,17021518.9155448,3191.93,2016-10-28T16:00:00.000Z,16.08,2024-07-04T20:22:29.000Z,2026-11-03T13:34:56.000Z
|
||||
|
@@ -0,0 +1,14 @@
|
||||
import json, csv
|
||||
|
||||
raw = json.load(open('/root/troupe-standup/wizard-work/ledger/raw_crypto.json'))
|
||||
cols = ['rank', 'name', 'symbol', 'current_price', 'market_cap',
|
||||
'market_cap_change_24h_pct', 'total_volume', 'circulating_supply',
|
||||
'ath', 'ath_date', 'atl', 'atl_date', 'last_updated']
|
||||
|
||||
with open('/root/troupe-standup/wizard-work/ledger/crypto_top10.csv', 'w', newline='') as f:
|
||||
w = csv.DictWriter(f, fieldnames=cols)
|
||||
w.writeheader()
|
||||
for i, r in enumerate(raw, start=1):
|
||||
w.writerow({**{c: r.get(c) for c in cols}, 'rank': i})
|
||||
|
||||
print('wrote crypto_top10.csv')
|
||||
@@ -0,0 +1 @@
|
||||
[{"id":"bitcoin","symbol":"btc","name":"Bitcoin","image":"https://coin-images.coingecko.com/coins/images/1/large/bitcoin.png?1696501400","current_price":77653,"market_cap":1561241457634,"market_cap_rank":1,"fully_diluted_valuation":1561241457634,"total_volume":27745541344,"high_24h":78037,"low_24h":76303,"price_change_24h":91.98,"price_change_percentage_24h":0.11815,"market_cap_change_24h":1849323112,"market_cap_change_percentage_24h":0.11859,"circulating_supply":20105365.0,"total_supply":20105365.0,"max_supply":21000000.0,"ath":126080,"ath_change_percentage":-38.4097,"ath_date":"2025-10-06T10:57:42.000Z","atl":67.81,"atl_change_percentage":114417.21391,"atl_date":"2013-07-05T16:00:00.000Z","roi":null,"last_updated":"2026-11-03T13:34:56.000Z"},{"id":"ethereum","symbol":"eth","name":"Ethereum","image":"https://coin-images.coingecko.com/coins/images/279/large/ethereum.png?1696501628","current_price":2300.67,"market_cap":281110166949,"market_cap_rank":2,"fully_diluted_valuation":281110166949,"total_volume":9322563998,"high_24h":2295.47,"low_24h":2235.31,"price_change_24h":25.26,"price_change_percentage_24h":1.07658,"market_cap_change_24h":3093388357,"market_cap_change_percentage_24h":1.11266,"circulating_supply":122186161.86556138,"total_supply":122186161.86556138,"max_supply":null,"ath":4946.05,"ath_change_percentage":-53.48463,"ath_date":"2025-08-24T11:21:03.000Z","atl":0.432979,"atl_change_percentage":531259.13424,"atl_date":"2015-10-19T16:00:00.000Z","roi":{"times":43.309089628863546,"currency":"btc","percentage":4330.908962886355},"last_updated":"2026-11-03T13:34:56.000Z"},{"id":"tether","symbol":"usdt","name":"Tether","image":"https://coin-images.coingecko.com/coins/images/325/large/Tether.png?1696501661","current_price":0.998656,"market_cap":178874816049,"market_cap_rank":3,"fully_diluted_valuation":184334415617,"total_volume":46336992364,"high_24h":0.999024,"low_24h":0.998516,"price_change_24h":-0.000300033119177701,"price_change_percentage_24h":-0.02795,"market_cap_change_24h":-1060532490.3317261,"market_cap_change_percentage_24h":-0.5894,"circulating_supply":179115594476.11313,"total_supply":184582543059.9262,"max_supply":null,"ath":1.32,"ath_change_percentage":-24.52125,"ath_date":"2018-07-23T16:00:00.000Z","atl":0.572521,"atl_change_percentage":74.43129,"atl_date":"2015-03-01T16:00:00.000Z","roi":null,"last_updated":"2026-11-03T13:34:56.000Z"},{"id":"binancecoin","symbol":"bnb","name":"BNB","image":"https://coin-images.coingecko.com/coins/images/825/large/bnb-icon2_2x.png?1696501970","current_price":701.13,"market_cap":92206203485,"market_cap_rank":4,"fully_diluted_valuation":92206203485,"total_volume":831804618,"high_24h":704.85,"low_24h":690.77,"price_change_24h":-1.419732618935086,"price_change_percentage_24h":-0.27485,"market_cap_change_24h":-186742290.39483643,"market_cap_change_percentage_24h":-0.20212,"circulating_supply":131511238.59,"total_supply":131511238.59,"max_supply":200000000.0,"ath":1369.99,"ath_change_percentage":-48.82246,"ath_date":"2025-10-13T00:41:24.000Z","atl":0.0398177,"atl_change_percentage":1760745.01898,"atl_date":"2017-10-18T16:00:00.000Z","roi":null,"last_updated":"2026-11-03T13:34:56.000Z"},{"id":"ripple","symbol":"xrp","name":"XRP","image":"https://coin-images.coingecko.com/coins/images/44/large/xrp-symbol-white-128.png?1696501442","current_price":1.29,"market_cap":81546310900,"market_cap_rank":5,"fully_diluted_valuation":128702475475,"total_volume":1677855481,"high_24h":1.29,"low_24h":1.24,"price_change_24h":0.04052742,"price_change_percentage_24h":3.24011,"market_cap_change_24h":2567460612,"market_cap_change_percentage_24h":3.25082,"circulating_supply":63351197653.0,"total_supply":99985589443.0,"max_supply":100000000000.0,"ath":3.65,"ath_change_percentage":-64.69893,"ath_date":"2025-07-17T19:40:53.000Z","atl":0.00268621,"atl_change_percentage":47819.25607,"atl_date":"2014-05-21T16:00:00.000Z","roi":null,"last_updated":"2026-11-03T13:34:56.000Z"},{"id":"usd-coin","symbol":"usdc","name":"USDC","image":"https://coin-images.coingecko.com/coins/images/6319/large/USDC.png?1769615602","current_price":0.999357,"market_cap":70833628914,"market_cap_rank":6,"fully_diluted_valuation":70833910446,"total_volume":13134714917,"high_24h":1.0,"low_24h":0.999183,"price_change_24h":-0.000229929732081136,"price_change_percentage_24h":-0.02073,"market_cap_change_24h":-387161540.21546936,"market_cap_change_percentage_24h":-0.54361,"circulating_supply":70879197704.356,"total_supply":70879479417.69453,"max_supply":null,"ath":1.043,"ath_change_percentage":-4.22702,"ath_date":"2018-11-14T16:00:00.000Z","atl":0.877647,"atl_change_percentage":13.86783,"atl_date":"2023-03-11T00:02:13.000Z","roi":null,"last_updated":"2026-11-03T13:34:56.000Z"},{"id":"solana","symbol":"sol","name":"Solana","image":"https://coin-images.coingecko.com/coins/images/4128/large/solana.png?1718769756","current_price":93.38,"market_cap":55118145472,"market_cap_rank":7,"fully_diluted_valuation":59477333867,"total_volume"Line truncated
|
||||
Reference in new issue
Block a user