Skip to content

Instantly share code, notes, and snippets.

@yuma300
Created June 23, 2016 13:20
Show Gist options
  • Save yuma300/85e832e671effe035ac0b928e32297a7 to your computer and use it in GitHub Desktop.
Save yuma300/85e832e671effe035ac0b928e32297a7 to your computer and use it in GitHub Desktop.
get_ask: (callback) ->
promise = new Promise (resolve) ->
_public_api.depth('btc_jpy').then (result) ->
resolve(result);
promise.then (result) ->
console.log("#{result}");
@you21979
Copy link

you21979 commented Jun 23, 2016

npm i zaif.jp co

const co = require('co');
const zaif = require('zaif.jp');
const api = zaif.PublicApi;

const main = () => co(function *() {
    let res1 = yield api.depth('btc_jpy');
    console.log(res1);
    let res2 = yield api.ticker('btc_jpy');
    console.log(res2);
})

main().then(() => {
    console.log("success")
}).catch((e) => {
    console.log("error")
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment