Draft ccxt provider
This commit is contained in:
parent
1118adfd1a
commit
2322823075
|
@ -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…
Reference in New Issue