Skip to content

Instantly share code, notes, and snippets.

@ripper234
Created September 29, 2011 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ripper234/1251429 to your computer and use it in GitHub Desktop.
Save ripper234/1251429 to your computer and use it in GitHub Desktop.
Convert Bitcoin prices to Google Correlate format
import java.util.Date;
String lastDateStr = null;
new File('trades.csv').eachLine({
def columns = it.split(',')
def date = new Date(columns[0].toLong() * 1000)
String dateStr = (1900 + date.getYear()) + "-" + (date.getMonth() + 1) + "-" + date.getDate() ;
if (dateStr != lastDateStr) {
lastDateStr = dateStr;
println dateStr + ", " + columns[1]
// System.exit(0);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment