# README
bitmex-api
A Go wrapper to the BitMEX API
Example
package main
import (
"fmt"
"github.com/t2o2/bitmex-api"
"github.com/t2o2/bitmex-api/swagger"
"log"
)
func main() {
b := bitmex.New(nil,
bitmex.HostTestnet, "8K2Oi0bnRRZ7GK4UJnY-38oj", "9EmGvk8mKX5nWa11y1KyPPGn78Lv2ZEiLx3TH0YasE_oE06y", true)
subscribeInfos := []bitmex.SubscribeInfo{
{Op: bitmex.BitmexWSOrderBookL2, Param: "XBTUSD"},
{Op: bitmex.BitmexWSOrder, Param: "XBTUSD"},
{Op: bitmex.BitmexWSPosition, Param: "XBTUSD"},
{Op: bitmex.BitmexWSMargin, Param: "XBTUSD"},
}
err := b.Subscribe(subscribeInfos)
if err != nil {
log.Fatal(err)
}
b.On(bitmex.BitmexWSOrderBookL2, func(m bitmex.OrderBookDataL2, symbol string) {
ob := m.OrderBook()
fmt.Printf("\rOrderbook Asks: %#v Bids: %#v ", ob.Asks[0], ob.Bids[0])
}).On(bitmex.BitmexWSOrder, func(m []*swagger.Order, action string) {
fmt.Printf("Order action=%v orders=%#v\n", action, m)
}).On(bitmex.BitmexWSPosition, func(m []*swagger.Position, action string) {
fmt.Printf("Position action=%v positions=%#v\n", action, m)
}).On(bitmex.BitmexWSMargin, func(m []*swagger.Margin, action string) {
fmt.Printf("Wallet action=%v margins=%#v\n", action, m)
})
b.StartWS()
// Get orderbook by rest api
b.GetOrderBook(10, "XBTUSD")
// Place a limit buy order
b.PlaceOrder(bitmex.SIDE_BUY, bitmex.ORD_TYPE_LIMIT, 0, 6000.0, 1000, "", "", "XBTUSD")
b.GetOrders("XBTUSD")
b.GetOrder("{OrderID}", "XBTUSD")
b.AmendOrder("{OrderID}", 6000.5)
b.CancelOrder("{OrderID}")
b.CancelAllOrders("XBTUSD")
b.GetPosition("XBTUSD")
b.GetMargin()
forever := make(chan bool)
<-forever
}
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
New allows the use of the public or private and websocket api.
No description provided by the author
# Constants
邀请人状态,已邀请用户及分红比率.
网站公告.
Trollbox 聊天室.
已连接用户/机器人的统计数据.
个别成交,可能是多个成交.
永续产品的资金费率更新 每个资金时段发送(通常是 8 小时).
产品更新,包括交易量以及报价.
每日保险基金的更新.
进入委托列表的强平委托.
你账户的余额和保证金要求的更新.
你委托的更新.
前 10 层的委托列表,用传统的完整委托列表推送.
完整的 level 2 委托列表.
前 25 层的 Level 2 委托列表.
你仓位的更新.
个人的通知,现时并未使用.
全系统的告示(用于段时间的消息).
最高层的委托列表.
每天报价数据.
每小时报价数据.
每分钟报价数据.
每 5 分钟报价数据.
结算信息.
实时交易.
每天交易数据.
每小时交易数据.
每分钟交易数据.
每 5 分钟交易数据.
资金提存更新.
比特币余额更新及总提款存款.
No description provided by the author
No description provided by the author
限价.
限价止盈.
市价.
市价止盈.
No description provided by the author
市价止损.
限价止损.
No description provided by the author
No description provided by the author
委托的状态.
No description provided by the author
No description provided by the author
委托的方向.
No description provided by the author
# Variables
No description provided by the author
# Structs
BitMEX describes the API.
Item stores the amount and price values.
No description provided by the author
OrderBook10 contains order book 10.
No description provided by the author
OrderBookL2 contains order book l2.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
{"name":"BitMEX API","version":"1.2.0","timestamp":1554709447283}.
No description provided by the author
# Type aliases
No description provided by the author