Skip to content

Instantly share code, notes, and snippets.

@YasunoriMATSUOKA
Created April 4, 2020 00:22
Show Gist options
  • Save YasunoriMATSUOKA/e58fd0a34cc3eb10c021d861ee8fc540 to your computer and use it in GitHub Desktop.
Save YasunoriMATSUOKA/e58fd0a34cc3eb10c021d861ee8fc540 to your computer and use it in GitHub Desktop.
const axios = require("axios")
const baseUrl = "https://api.zaif.jp/api/1/"
const fetchTicker = async (method, cc, lc) => {
const url = `${baseUrl}${method}/${cc}_${lc}`
console.log(url)
const ticker = await axios.get(url)
.then(res => res.data)
.catch(error => {
console.error(error)
return undefined
})
return ticker
}
(async () => {
const ticker = await fetchTicker("depth", "xem", "jpy")
console.log(ticker)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment