模擬交易
概覽
Bybit v5 Open API支持模擬交易帳戶, 但是由於模擬交易的主要目的是為了體驗基礎交易功能, 僅支持有限的功能, 所以部分接口不支持使用。
創建API Key
- 您需要登入到Bybit 主網帳戶;
- 切換到
模擬交易
, 注意: 模擬交易擁有自己獨立的帳戶ID; - 懸停鼠標在用戶頭像上, 然後點擊"API" 來創建key和secret;
使用規則
- 基礎交易規則和實盤保持一致
- 模擬盤的訂單僅保留7天
- 默認請求頻率, 無法提頻
域名
主網模擬盤:
Rest API: https://api-demo.bybit.com
Websocket : wss://stream-demo.bybit.com
可用接口列表
目錄 | 接口名 | 路由 |
---|---|---|
公有行情 | 所有 | 所有接口 |
交易 | 創建委託單 | /v5/order/create |
修改委託單 | /v5/order/amend | |
撤銷委託單 | /v5/order/cancel | |
查詢實時委託段 | /v5/order/realtime | |
撤銷所有訂單 | /v5/order/cancel-all | |
查詢歷史訂單 | /v5/order/history | |
查詢成交紀錄 | /v5/execution/list | |
批量創建委託單 | /v5/order/create-batch (期貨/期權) | |
批量修改委託單 | /v5/order/amend-batch (期貨/期權) | |
批量撤銷委託單 | /v5/order/cancel-batch (期貨/期權) | |
持倉 | 查詢持倉 | /v5/position/list |
設置槓桿 | /v5/position/set-leverage | |
切換持倉模式 | /v5/position/switch-mode | |
設置止盈止損 | /v5/position/trading-stop | |
設置自動追加保證金 | /v5/position/set-auto-add-margin | |
手動增加或減少保證金 | /v5/position/add-margin | |
查詢平常盈虧 | /v5/position/closed-pnl | |
帳戶 | 查詢錢包餘額 | /v5/account/wallet-balance |
查詢利息紀錄 | /v5/account/borrow-history | |
設置抵押品幣種 | /v5/account/set-collateral-switch | |
查詢抵押品信息 | /v5/account/collateral-info | |
查詢Greeks信息 | /v5/asset/coin-greeks | |
查詢帳戶配置 | /v5/account/info | |
查詢交易日誌 | /v5/account/transaction-log | |
設置保證金模式 | /v5/account/set-margin-mode | |
設置現貨對衝 | /v5/account/set-hedging-mode | |
資產 | 查詢交割紀錄 | /v5/asset/delivery-record |
查詢USDC結算紀錄 | /v5/asset/settlement-record | |
全倉槓桿 | 全倉槓桿開關 | /v5/spot-margin-trade/switch-mode |
全倉槓桿設置 | /v5/spot-margin-trade/set-leverage | |
查詢開關狀態和倍數 | /v5/spot-margin-uta/status | |
WS私有推送 | order,execution,position,wallet,greeks | /v5/private |
獲取模擬資金接口
HTTP請求
POST /v5/account/demo-apply-money
請求參數
參數 | 是否必需 | 類型 | 說明 |
---|---|---|---|
utaDemoApplyMoney | false | array | |
> coin | false | string | 申請的幣種, 支持 BTC , ETH , USDT , USDC |
> amountStr | false | string | 申請的金額, 每次請求最多支持申請如下金額 BTC : "15"ETH : "200"USDT : "100000"USDC : "100000" |
請求示例
POST /v5/account/demo-apply-money HTTP/1.1
Host: api-demo.bybit.com
X-BAPI-SIGN: XXXXXXX
X-BAPI-API-KEY: XXXXXXX
X-BAPI-TIMESTAMP: 1711420489915
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json
{
"utaDemoApplyMoney": [
{
"coin": "USDT",
"amountStr": "109"
},
{
"coin": "ETH",
"amountStr": "1"
}
]
}