Skip to content

Commit

Permalink
cleaning up tests and coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ivoputzer committed Oct 14, 2023
1 parent db7e409 commit ef957d9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/build-coinbase.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { createReadStream, createWriteStream } from 'node:fs'
import { mkdir } from 'node:fs/promises'
import { readCache, byExchange } from '../lib/cache.mjs'
import { writeJson, writeCsv, parseJsonl } from '../lib/jsonl.mjs'
import { dateReplacerFor } from '../lib/date.mjs'
import { shortDateFor } from '../lib/date.mjs'

for (const file of await readCache(byExchange('coinbase'))) {
const [,, id, interval] = file.split(/[/,.]/)
const source = createReadStream(file) // todo: at some point cache should return streams directly
console.log('bin/build-coinbase @load readCache:', file)

await mkdir(`www/api/${id}`, { recursive: true })
await convertJsonl(writeCsv, source, `www/api/${id}/${interval}.csv`, dateReplacerFor(interval))
await convertJsonl(writeJson, source, `www/api/${id}/${interval}.json`, dateReplacerFor(interval))
await convertJsonl(writeCsv, source, `www/api/${id}/${interval}.csv`, shortDateFor(interval))
await convertJsonl(writeJson, source, `www/api/${id}/${interval}.json`, shortDateFor(interval))
}

function convertJsonl (write, src, dst, replacer) { // todo: this could be maybe better placed in lib/jsonl.mjs or lib/cache.mjs
Expand Down

0 comments on commit ef957d9

Please sign in to comment.