Skip to content

Instantly share code, notes, and snippets.

@puttputt
Created March 19, 2014 01:37
Show Gist options
  • Save puttputt/9633890 to your computer and use it in GitHub Desktop.
Save puttputt/9633890 to your computer and use it in GitHub Desktop.
map = function(){
var quarter;
var mins = this.time.getMinutes();
if(mins <= 14)
quarter = 0;
else if(mins<=29)
quarter = 15;
else if(mins<=44)
quarter = 30;
else
quarter = 45;
var time_at_minute = new Date(this.time.getFullYear(),
this.time.getMonth(),
this.time.getDate(),
this.time.getHours(),
quarter);
emit(time_at_minute, {
count: 1,
price: this.price,
volume: this.amount,
total: this.total,
low: this.price,
high: this.price,
open: this.price,
close: this.price,
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment