Title: bash script to download all mtgox trade history json data Post by: mizerydearia on August 25, 2011, 08:42:44 PM Here's a simple bash script to download all trade history json data from MtGox.
Update: Code: #!/bin/bash outputfile=data lasttrade=0 while test -n "$lasttrade";do wget --quiet https://mtgox.com/code/data/getTrades.php?since=$lasttrade cat getTrades.php\?since\=* >> $outputfile; echo >> $outputfile; lasttrade=`cat getTrades.php\?since\=*|sed "s/,/\n/g"|grep tid|tail -n 1|cut -d ":" -f 2|cut -d "\"" -f 2`; lasttradets=`cat getTrades.php\?since\=*|sed "s/,/\n/g"|grep date|tail -n 1|cut -d ":" -f 2`; if test -n "$lasttrade"; then echo "$(date -d @$lasttradets) tid $lasttrade"; fi rm getTrades.php\?since\=*; done outputfile=output next=0 while test -n "$next";do wget https://mtgox.com/code/data/getTrades.php?since=$next cat getTrades.php\?since\=* >> $outputfile; echo >> $outputfile; next=`echo "$(cat getTrades.php\?since\=*|sed "s/,/\n/g"|grep tid|tail -n 1|cut -d ":" -f 2|cut -d "\"" -f 2)+1"|bc`; rm getTrades.php\?since\=*; done Here is a list of urls to download trade history from mtgox from very beginning tid 1 until tid 1314315710505672 with timestamp 1314315710 (Fri Aug 26 01:41:50 CEST 2011), each returning 100 results: http://pastebin.com/pmhMXZJu download json data from torrent: http://www.wupload.com/file/124870046/mtgox_trades_json.ts-1314316120.js.torrent Also see https://en.bitcoin.it/wiki/MtGox/API#0.2Fdata.2FgetTrades.php |