Browse Source

Draft ccxt provider

master
dig 3 years ago
parent
commit
2322823075
  1. 25
      providers/ccxt.js

25
providers/ccxt.js

@ -0,0 +1,25 @@
import ccxt from 'ccxt'
//console.log (ccxt.exchanges)
export default async (...args)=>
{
let b = new ccxt.bitmex({ verbose: false })
// console.log( b.id, Object.keys(await b.loadMarkets()) )
// console.log( b.id, await b.fetchTicker ('BTC/USD') )
let BTCUSD = await b.fetchTicker('BTC/USD')
console.log( BTCUSD.close )
}
export var args = args=> console.log( args )
export var bitmex = async sym=>
{
let ex = new ccxt.bitmex({ verbose: false })
//console.log(sym, typeof sym)
if( !sym )
return Object.keys( await ex.loadMarkets() ).join('\n')
let tick = await ex.fetchTicker( sym )
return `H: ${tick.high} O: ${tick.open} C: ${tick.close} L: ${tick.low}`
}
Loading…
Cancel
Save