幣安期權API接口和Websocket

2022-09-08 09:41

幣安期權交易API接口已開放:期權API接口

1. 市場數據

以下Github連接對應了不同的請求,提供了接口、參數和返回信息。

請求

描述

接口

Test Connectivity

Test connectivity to the Rest API

GET /eapi/v1/ping

Check Server Time

Test connectivity to the Rest API and get the current server time

GET /eapi/v1/time

Exchange Information

Current exchange trading rules and symbol information

GET /eapi/v1/exchangeInfo

Order Book

Get order book data

GET /eapi/v1/depth

Recent Trades List

Get recent market trades

GET /eapi/v1/trades

Old Trades Lookup (MARKET_DATA)

Get older market historical trades

GET /eapi/v1/historicalTrades

Kline/Candlestick DataCandlestick Data

Kline/candlestick bars for an option symbol. Klines are uniquely identified by their open time.Candlestick bars for an option symbol. Candles are uniquely identified by their open time

GET /eapi/v1/klines

Option Mark Price

Option mark price and greek info

GET /eapi/v1/mark

24hr Ticker Price Change Statistics

24 hour rolling window price change statistics

GET /eapi/v1/ticker

Symbol Price Ticker

Get spot index price for option underlying

GET /eapi/v1/index

Historical Exercise Records

Get historical exercise records

GET /eapi/v1/exerciseHistory

Open Interest

Get open interest for specific underlying asset on specific expiration date.

GET /eapi/v1/openInterest

2. 帳號/交易

以下Github連接對應了不同的請求,提供了接口、參數和返回信息。

請求

描述

接口

Option Account Information (TRADE)

Get current account information

GET /eapi/v1/account (HMAC SHA256)

Funds Transfer (USER_DATA)

Please find details from here.

POST /eapi/v1/transfer (HMAC SHA256)

New Order (TRADE)

Send a new order

POST /eapi/v1/order (HMAC SHA256)

Place Multiple Orders (TRADE)

Send multiple option orders

POST /eapi/v1/batchOrders (HMAC SHA256)

Query Single Order (TRADE)

Check an order status

GET /eapi/v1/order (HMAC SHA256)

Cancel Option Order (TRADE)

Cancel an active order

DELETE /eapi/v1/order (HMAC SHA256)

Cancel Multiple Option Orders (TRADE)

Cancel Multiple active orders

DELETE /eapi/v1/batchOrders (HMAC SHA256)

Cancel all Option orders on a specific symbol (TRADE)

Cancel all active order on a symbol

DELETE /eapi/v1/allOpenOrders (HMAC SHA256)

Cancel All Option Orders By Underlying (TRADE)

Cancel all active orders on specified underlying

DELETE /eapi/v1/allOpenOrdersByUnderlying (HMAC SHA256)

Query Current Open Option Orders (USER_DATA)

Query current all open orders, status: ACCEPTED PARTIALLY_FILLED

GET /eapi/v1/openOrders (HMAC SHA256)

Query Option Order History (TRADE)

Query all finished orders within 5 days, finished status: CANCELLED FILLED REJECTED

GET /eapi/v1/historyOrders (HMAC SHA256)

Option Position Information (USER_DATA)

Get current position information

GET /eapi/v1/position (HMAC SHA256)

Account Trade List (USER_DATA)

Get trades for a specific account and symbol

GET /eapi/v1/userTrades (HMAC SHA256)

User Exercise Record (USER_DATA)

Get account exercise records

GET /eapi/v1/exerciseRecord (HMAC SHA256)

Account Funding Flow (USER_DATA)

Query account funding flows

GET /eapi/v1/bill (HMAC SHA256)

3. Websocket 市場推送

用戶可以通過Websocket專區的請求方式來訂閱或者取消訂閱下列Stream。

Stream

Stream名字

描述

更新頻率

Trade Streams

<symbol>@trade</symbol> or <underlyingAsset>@trade</underlyingAsset>

The Trade Streams push raw trade information for a specific symbol or an underlying asset. e.g., ETH@trade

50ms

Index Stream

<symbol>@index</symbol>

The underlying (e.g., ETHUSDT) index stream

1,000ms

Mark Price

<underlyingAsset>@markPrice</underlyingAsset>

The mark price for all option symbols on a specific underlying asset. e.g., ETH@markPrice

1,000ms

Kline/Candlestick Streams

<symbol>@kline_,<interval></interval></symbol>

The Kline/Candlestick Stream push updates to the current kline/candlestick every 1,000 milliseconds (if existing)

1,000ms

24-hour Ticker

<symbol>@ticker</symbol>

24-hour ticker info for all symbols. Only symbols whose ticker info changed will be sent

1,000ms

24-hour Ticker by underlying asset and expiration date

<underlyingAsset>@ticker@,<expirationDate></expirationDate></underlyingAsset>

24-hour ticker info by underlying asset and expiration date. e.g., ETH@ticker@220930

1,000ms

Open Interest

<underlyingAsset>@openInterest@,<expirationDate></expirationDate></underlyingAsset>

Option open interest for an underlying asset on a specific expiration date. e.g. ETH@openInterest@221125

60s

New Symbol Info

option_pair

New symbol listing stream

50ms

Partial Book Depth Streams

<symbol>@depth,<levels></levels></symbol> or <symbol>@depth,<levels>@100ms or ,<symbol>@depth,<levels>@1000ms</levels></symbol></levels></symbol>

Top bids and asks. Valid levels are 10, 20, 50, 100

100ms, 500ms, or 1,000ms, (default when update speed isn't used)

Diff. Book Depth Streams

<symbol>@depth1000</symbol>

When the depth level is set to 1,000, the stream returns different book depth pushes every 50ms. Please follow the subsequent instructions on how to manage a local order book correctly

50ms

4. WebSocket 帳戶訊息推送

您可透過 WebSocket 帳戶訊息推送所列的 listenKey 存取帳戶訊息數據流。

事件

事件類型

描述

更新頻率

Account Data

ACCOUNT_UPDATE

Update under the following conditions:

Account deposit or withdrawal

Position info change. Includes a P attribute if there are changes, otherwise does not include a P attribute.

Greek update

50ms

Order Update

ORDER_TRADE_UPDATE

Update under the following conditions:

Order fills

Order placed

Order canceled

50ms

5. 做市商接口

以下 API 接口僅開放給造市商。Github連接對應了不同的請求,提供了接口、參數和返回信息。

請求

描述

接口

Option Margin Account Information (USER_DATA)

Get current account information

GET /eapi/v1/marginAccount (HMAC SHA256)

Set Market Maker Protection Config (TRADE)

Set config for MMP. Market Maker Protection (MMP) is a set of protection mechanisms for option market makers. This mechanism can prevent mass trading in a short period of time. Once a market maker's account branches the threshold, MMP will be triggered. All current MMP orders will be canceled, and all new MMP orders will be rejected. Market makers can use this gap to re-evaluate the market and modify order prices.

POST /eapi/v1/mmpSet (HMAC SHA256)

Get Market Maker Protection Config (TRADE)

Get config for MMP.

Get /eapi/v1/mmp (HMAC SHA256)

Reset Market Maker Protection Config (TRADE)

Reset MMP and start MMP orders again.

POST /eapi/v1/mmpReset (HMAC SHA256)

Set Auto-Cancel All Open Orders (Kill-Switch) Config (TRADE)

This endpoint sets the parameters of the auto-cancel feature. If no heartbeat message is sent, it will cancel all open orders (MMP and non-MMP orders) of the underlying symbol at the end of the specified countdown period. After the countdown period, all open orders will be canceled. New orders will be rejected with the error code -2010 until either a heartbeat message is sent or the auto-cancel feature is turned off by setting the countdownTime to 0.

POST /eapi/v1/countdownCancelAll (HMAC SHA256)

Get Auto-Cancel All Open Orders (Kill-Switch) Config (TRADE)

This endpoint returns the auto-cancel parameters for each underlying symbol. Please note that only active auto-cancel parameters will be returned. If the countdownTime is set to 0 (i.e., countdownTime has been turned off), the response won’t return the underlying symbol, and the corresponding countdownTime parameter won’t be returned in the response.

GET /eapi/v1/countdownCancelAll (HMAC SHA256)

Auto-Cancel All Open Orders (Kill-Switch) Heartbeat (TRADE)

This endpoint resets the time from which the countdown will begin to the time this message is received. It should be called repeatedly as heartbeats. Multiple heartbeats can be updated at once by specifying the underlying symbols as a list (except BTCUSDT and ETHUSDT) in the underlying parameter.

POST /eapi/v1/countdownCancelAllHeartBeat (HMAC SHA256)

立即註冊 — 獲得高達 100 USDT 交易手續費折抵 (適用於已通過驗證用戶)