logo

Finex Websocket API

Websocke API is mounted at /api/v2/open_finance. If you pass a JWT header, your connection will be authenticated, otherwise it will be considered anonymous.

#Subscribe to streams

Example

[1, 2, "subscribe", ["private", ["order", "trade", "balances"]]]

#Get your open orders

[1, 2, "list_orders", ["btcusd"]]
[
  2,
  2,
  "list_orders",
  [
    [
      "btcusd",
      97,
      "6dcc2c8e-c295-11ea-b7ad-1831bf9834b0",
      "sell",
      "w",
      "l",
      "9120",
      "0",
      "0.25",
      "0.25",
      "0",
      0,
      1594386563
    ]
  ]
]

Order response schema

FieldExample
Market"btcusd"
ID97
UUID"6dcc2c8e-c295-11ea-b7ad-1831bf9834b0"
Side"sell"
State"w"
Type"l"
Price"9120"
Avg. Price"0"
Volume"0.25"
Orig. Volume"0.25"
Executed Volume"0"
Trades Count0
Timestamp1594386563

#Get order by uuids

[
  1,
  3,
  "get_orders",
  [
    "6dcc2c8e-c295-11ea-b7ad-1831bf9834b0",
    "4fec493d-c2a2-11ea-b670-1831bf9834b0"
  ]
]
[
  2,
  3,
  "get_orders",
  [
    [
      "btcusd",
      97,
      "6dcc2c8e-c295-11ea-b7ad-1831bf9834b0",
      "sell",
      "w",
      "l",
      "9120",
      "0",
      "0.25",
      "0.25",
      "0",
      0,
      1594386563
    ],
    [
      "btcusd",
      98,
      "4fec493d-c2a2-11ea-b670-1831bf9834b0",
      "sell",
      "c",
      "m",
      "0",
      "0",
      "0.25",
      "0.25",
      "0",
      0,
      1594392096
    ]
  ]
]

#Get order trades

[1, 42, "get_order_trades", ["ab224fef-c2a2-11ea-b670-1831bf9834b0"]]
[
  2,
  42,
  "get_order_trades",
  [
    [
      "btcusd",
      33,
      "9120",
      "0.25",
      "2280",
      100,
      "ab224fef-c2a2-11ea-b670-1831bf9834b0",
      "buy",
      "buy",
      "0.0005",
      "btc",
      1594392250
    ]
  ]
]

Trade response schema

FieldExample
Market"btcusd"
ID33
Price"9120"
Amount"0.25"
Total"2280"
OrderID100
OrderUUID"ab224fef-c2a2-11ea-b670-1831bf9834b0"
OrderSide"buy"
TakerSide"buy"
Fee"0.0005"
Fee Unit"btc"
Timestamp1594392250

#Create order

Arguments:

ArgComment
Market
TypeM is Market L is Limit P is PostOnly
Sidebuy or sell
amountsting, int, float
priceignored for market order

Responds with ok and uuid of new order if order is pushed to engine. Response with error and short description in case of failure.

Example

[1, 42, "create_order", ["btcusd", "m", "sell", "0.250000", "9120.00"]]

Response

[2, 42, "create_order", ["4fec493d-c2a2-11ea-b670-1831bf9834b0"]]

#Cancel order

Arguments:

ArgDesc
Modeid, uuid, market, all(any market)
IDID, UUID or market ID respectively

NOTE: cancels multiple orders for "market" and "all"

Example

[1, 42, "cancel_order", ["market", "btcusd"]]

Response

[2, 42, "cancel_order", null]

#Bulk order create

Arguments: array or Create order params

Responds with array of:

  • uuid for crated order
  • "error" if some error ocurred

Example

[
  1,
  42,
  "create_bulk",
  [
    ["btcusd", "l", "buy", "0.250000", "9120.00"],
    ["btcusd", "l", "sell", "0.250000", "9120.00"]
  ]
]

Response

[
  2,
  42,
  "create_bulk",
  [
    "04852bd8-c2a3-11ea-b670-1831bf9834b0",
    "04855535-c2a3-11ea-b670-1831bf9834b0"
  ]
]

#Bulk order cancel

Arguments:

ArgDesc
Modeid or uuid
[ID]List of IDs or UUIDs respectively

Echoes argument or puts error for argument which could not be parsed.

Example

[1, 42, "cancel_bulk", ["id", [12, "13", "abv"]]]

Response

[2, 42, "cancel_bulk", [12, 13, "error"]]