Skip to content

Commit

Permalink
update tradeblock file structure
Browse files Browse the repository at this point in the history
  • Loading branch information
shekenahglory committed Jan 4, 2017
1 parent b57800b commit eb05883
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/tradeblock.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function checkStatus() {
.subtract(1, 'hour')

var filename = 'file_date=' + time.format('YYYYMMDD') +
'/XBT|USD/STMP/' + time.format('HH') + '.csv'
'/pair=XBT_USD/source=STMP/' + time.format('HH') + '.csv'

console.log('checking for file: ' + filename)

Expand All @@ -34,10 +34,10 @@ function checkStatus() {
* appendFile
*/

function appendFile(pair, market, time, data) {
function appendFile(pair, source, time, data) {
var filename = 'file_date=' + time.format('YYYYMMDD') +
'/' + pair.replace('/', '|') +
'/' + market +
'/pair=' + pair.replace('/', '_') +
'/source=' + source +
'/' + time.format('HH') + '.csv'
console.log('appending file: ' + filename)

Expand All @@ -57,15 +57,15 @@ function appendFile(pair, market, time, data) {
*/

function saveBuffer(time) {
var market
var source
var pair

console.log('save buffer')

for (pair in buffer) {
for (market in buffer[pair]) {
appendFile(pair, market, time, buffer[pair][market])
delete buffer[pair][market]
for (source in buffer[pair]) {
appendFile(pair, source, time, buffer[pair][source])
delete buffer[pair][source]
}
}

Expand Down

0 comments on commit eb05883

Please sign in to comment.