Opium.Exchange API Reference

Description

Following specification describes the way to connect to opium.exchange relayer of Opium Protocol via REST API and Socket.io endpoint.

REST API allows to fetch login message for authentication, load currently supported products, tokens and maturities, user tokens balance and allowance state, form, sign and cancel orders, etc.

Socket.io endpoint allows to reactively receive updates on current orderbook status and charts. Also using access token it's possible to receive updates on statuses of user's orders, performed trades and current active positions.

Socket.io

socket.io specification which could be found here

Authorization

Some of the HTTP and Socket.io endpoints are protected (user-based), thus require to include access token within a request and connection.

Contact: info@opium.team
Version: 1.0.0

Login

Login related endpoints

Returns login (access token) message to sign

GET /auth/loginData
200 OK

Ok

Aggregator

Right now used only to retrieve last synced block

Returns lastSyncedBlock

GET /aggregator/blockchain/meta
200 OK

Success

Meta

Some meta information about backend

Get current configuration

GET /meta/config
200 OK

OK

Wallet

Crypto wallet related endpoints

Orderbook

Orderbook related endpoints

Form an order, so it can be used for creating a transaction

POST /orderbook/formOrder

To form an EIP712 order message, send order data to /orderbook/formOrder and receive message data and id. Sign EIP712 message and provide id to /orderbook/orders

authAddress: object
in query

(no description)

200 OK

OK

401 Unauthorized

Unauthorized

403 Forbidden

Forbidden

422 Unprocessable Entity

Unprocessable entity

429 Too Many Requests

Too many requests

Accepts signed orders and pushes them to matching engine

POST /orderbook/orders
authAddress: object
in query

(no description)

201 Created

Created

401 Unauthorized

Unauthorized

403 Forbidden

Forbidden

404 Not Found

Not found

409 Conflict

Conflict

412 Precondition Failed

Precondition Failed

422 Unprocessable Entity

Unprocessable entity

429 Too Many Requests

Too many requests

Get information about order

GET /orderbook/preSubmit
authAddress: object
in query

(no description)

ticker: object
in query

(no description)

action: object
in query

(no description)

quantity: object
in query

(no description)

200 OK

OK

401 Unauthorized

Unauthorized

403 Forbidden

Forbidden

422 Unprocessable Entity

Unprocessable entity

Cancel order that was not matched

GET /orderbook/cancel
authAddress: object
in query

(no description)

ids: object
in query

(no description)

201 Created

Accepted

401 Unauthorized

Unauthorized

403 Forbidden

Forbidden

404 Not Found

Not found

422 Unprocessable Entity

Unprocessable entity

Ticker

Tickers related endpoints

Trades

Trades related endpoints

GET /trades/all/address

tokenIds: object
in query

(no description)

200 OK

OK

401 Unauthorized

No Content

403 Forbidden

Forbidden

Orders

Orders related endpoints

GET /orders/all/address

tokenIds: object
in query

(no description)

200 OK

OK

401 Unauthorized

No Content

403 Forbidden

Forbidden

default

Get information about certain type of derivative

GET /meta/tickers/searchParams
type: object
in query

(no description)

200 OK

OK

422 Unprocessable Entity

Query is not provided

Get wallet balance

GET /wallet/balance/tokens
authAddress: object
in query

(no description)

200 OK

OK

204 No Content

No Content

Tickers

GET /tickers

endTime: object
in query

(no description)

margin: object
in query

(no description)

param: object
in query

(no description)

subtype: object
in query

(no description)

type: object
in query

(no description)

searchText: object
in query

(no description)

200 OK

OK

204 No Content

No content

GET /tickers/data/{hash}

hash: object
in path

(no description)

200 OK

OK

404 Not Found

Not found

GET /tickers/derivatives

tokenIds: object
in query

(no description)

200 OK

OK

204 No Content

No Content