Coder Social home page Coder Social logo

max-websocket-docs's Introduction

MAX Exchange WebSocket API

Introduction

Official documentation for the new redesign MAX Exchange websocket service

Endpoint: wss://max-stream.maicoin.com/ws

Important note

  • price and volume should be string
  • timestamp and depth should be number
  • rate limit when your request message over 20 per second
  • rate limit when your request message over 200 per minute
  • rate limit when your ip connection over 1440 per day

Keep connection

You need to use ping frame to keep connection with server. If server doesn't receive your ping for 130 seconds, the connection will be closed by server side. Some libraries will do this for you, so please check your library first.

const WebSocket = require('ws');
const url = "wss://max-stream.maicoin.com/ws"
const ws = new WebSocket(url);

ws.on('open', function open() {
  setInterval(() => {
    ws.ping("test")
  }, 30000);
})
ws.on('pong', function incoming(data) {
  // it will show "server pong test" on the screen
  console.log('server pong', data.toString());
});

Response key alias

We use short keys to reduce response size, please check out mappings below.

abbr meaning comment
e event
E errors
c channel
i id
s subscription
T at // or created_at
TU updated_at
ST startTime
ET endTime
k kline
a asks
b bids
M market
ms markets
m maker
p price
v volume
O open
C close
H high
L low
V volume in BTC
tk ticker
o orders
t trades
sd side
ot ord_type
sp stop_price
ap avg_price
aps
ps
tc trade_count
B balances
rv remaining_volume
ev executed_volume or filled
qv quote_volume quote volume used in kline
S state
R resolution kline resolution
cu currency
fc fee currency
fd fee discounted fee is discounted or not (e.g. use MAX TOKEN to pay fee)
av available
l locked
f fee
oi order id in trade
ti trade id
ci client oid
gi group id
tr trend
co code
_q
_t

Error response

If you get any error response, it will be concentrated in an array.

{
  "e": "error",
  "E": ["...."],
  "i": "client1",
  "T": 1234567890000
}

Example

When you send a command with invalid action, you will get following error message:

{
  "e": "error",
  "E": [ "E-1004: invalid action"],
  "i": "client1",
  "T": 1678096431125
}

Error type

code error message description
1004 invalid action The action in action field is not supported.
1005 invalid json The command is not in a valid JSON format.
1006 invalid nonce (difference of 30 seconds or more) The difference between the nonce you provided and the server's nonce is more than 30 seconds.
1007 authentication failed Not authenticated. Might need to check your api key/secret or the way you send auth command.
1012 nonce has already been used The nonce you provided has already been used.

max-websocket-docs's People

Contributors

bailantaotao avatar c9s avatar chunghe avatar dependabot[bot] avatar kbearxd avatar narumiruna avatar vicky-sunshine avatar ycdesu avatar yhsiang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

max-websocket-docs's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.