bitstamp apiから取引履歴の取得

https://www.bitstamp.net/api/

https://www.bitstamp.net/api/v2/transactions/{currency_pair}/
で取る

ビットコインとUSDだと
btcusd

https://www.bitstamp.net/api/v2/transactions/btcusd/

これで取得すると一日分取れる
time=minute で取得結果は

[{‘date’: ‘1634087276’, ‘tid’: ‘202144437’, ‘amount’: ‘0.00090000’, ‘type’: ‘0’, ‘price’: ‘56399.19’}, {‘date’: ‘1634087261’, ‘tid’: ‘202144431’, ‘amount’: ‘0.00200000’, ‘type’: ‘1’, ‘price’: ‘56394.83’}, {‘date’: ‘1634087259’, ‘tid’: ‘202144428’, ‘amount’: ‘0.01000000’, ‘type’: ‘1’, ‘price’: ‘56394.83’}, {‘date’: ‘1634087254’, ‘tid’: ‘202144420’, ‘amount’: ‘0.04068000’, ‘type’: ‘0’, ‘price’: ‘56431.75’}, {‘date’: ‘1634087251’, ‘tid’: ‘202144417’, ‘amount’: ‘0.02000000’, ‘type’: ‘0’, ‘price’: ‘56418.64’}, {‘date’: ‘1634087248’, ‘tid’: ‘202144416’, ‘amount’: ‘0.01600000’, ‘type’: ‘0’, ‘price’: ‘56439.76’}, {‘date’: ‘1634087241’, ‘tid’: ‘202144412’, ‘amount’: ‘0.01300000’, ‘type’: ‘0’, ‘price’: ‘56454.85’}]

date がunix のtimestampなんだ

type が
0 (buy) or 1 (sell).

いろいろ面倒だ。。。

コメントを残す