Skip to content

amis47/max-exchange-api-node

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MAX Exchange API for Node.js

A node.js implementation of MAX exchange API

  • REST API V2
  • Websocket API

Documentations

Installation

npm install max-exchange-api-node

see /docs for MAX and RESTV2 methods.

Usage

MAX constructor will return a client manager to support REST API.

const MAX = require('max-exchange-api-node')

const max = new MAX({
  accessKey: 'YOUR_ACCESS_KEY',
  secretKey: 'YOUR_SECRET_KEY'
})

MAX object will cache client by versions.

const rest = max.rest() // default version is 2
const rest2 = max.rest(2) // the same client as rest
const ws = max.ws()

// get current markets
rest.markets()
  .then((data) => {
    console.log(data)
  })
  .catch((error) => {
    console.log(error.message)
  })


// connect to websocket
ws.open().then(() => {
  ws.once('open', () => {
    ws.subscribeTicker('btctwd') // subscribe to public channel
  })

  ws.once('challenged', () => {
    ws.subscribeAccount() // subscribe to private channel
  })

  ws.on('ticker', (message) => {
    console.log(message)
  })

  ws.on('account', (message) => {
    console.log(message)
  })
})

About

MAX Exchange API for Node.js

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%