Documentation ¶
Index ¶
- Constants
- Variables
- func GetClient(ctx context.Context) *swagger.APIClient
- func GetConfiguration(ctx context.Context) *swagger.Configuration
- func MakeContext(key string, secret string, host string, timeout int64) context.Context
- type BitMEX
- func (b *BitMEX) AmendOrder(oid string, price float64) (order swagger.Order, err error)
- func (b *BitMEX) AmendOrder2(orderID string, origClOrdID string, clOrdID string, simpleOrderQty float64, ...) (order swagger.Order, err error)
- func (b *BitMEX) CancelAllOrders(symbol string) (orders []swagger.Order, err error)
- func (b *BitMEX) CancelOrder(oid string) (order swagger.Order, err error)
- func (b *BitMEX) CloseOrder(side string, ordType string, price float64, orderQty int32, postOnly bool, ...) (order swagger.Order, err error)
- func (b *BitMEX) CloseWS()
- func (b *BitMEX) ConfirmWithdrawal(token string) (trans swagger.Transaction, err error)
- func (b *BitMEX) Emit(event interface{}, arguments ...interface{}) *emission.Emitter
- func (b *BitMEX) GetBucketed(symbol string, binSize string, partial bool, filter string, columns string, ...) (o []swagger.TradeBin, err error)
- func (b *BitMEX) GetInstrument(symbol string, count int, reverse bool) (result []swagger.Instrument, err error)
- func (b *BitMEX) GetMargin() (margin swagger.Margin, err error)
- func (b *BitMEX) GetOrder(oid string, symbol string) (order swagger.Order, err error)
- func (b *BitMEX) GetOrderBook(depth int, symbol string) (ob OrderBook, err error)
- func (b *BitMEX) GetOrderByClOrdID(clOrdID string, symbol string) (order swagger.Order, err error)
- func (b *BitMEX) GetOrders(symbol string) (orders []swagger.Order, err error)
- func (b *BitMEX) GetOrdersRaw(symbol string, filter string) (orders []swagger.Order, err error)
- func (b *BitMEX) GetPosition(symbol string) (position swagger.Position, err error)
- func (b *BitMEX) GetPositions(symbol string) (positions []swagger.Position, err error)
- func (b *BitMEX) GetPositionsRaw(filter string, columns string, count int32) (positions []swagger.Position, err error)
- func (b *BitMEX) GetRateLimit() RateLimit
- func (b *BitMEX) GetRateLimitPublic() RateLimit
- func (b *BitMEX) GetVersion() (version Version, time time.Duration, err error)
- func (b *BitMEX) GetWallet() (wallet swagger.Wallet, err error)
- func (b *BitMEX) NewOrder(side string, ordType string, price float64, orderQty int32, postOnly bool, ...) (order swagger.Order, err error)
- func (b *BitMEX) Off(event interface{}, listener interface{}) *emission.Emitter
- func (b *BitMEX) On(event interface{}, listener interface{}) *emission.Emitter
- func (b *BitMEX) PlaceOrder(side string, ordType string, stopPx float64, price float64, orderQty int32, ...) (order swagger.Order, err error)
- func (b *BitMEX) PlaceOrder2(side string, ordType string, stopPx float64, price float64, orderQty int32, ...) (order swagger.Order, err error)
- func (b *BitMEX) PositionUpdateLeverage(leverage float64, symbol string) (position swagger.Position, err error)
- func (b *BitMEX) RequestWithdrawal(currency string, amount float32, address string, otpToken string, fee float64) (trans swagger.Transaction, err error)
- func (b *BitMEX) SetHttpProxy(proxyURL string) error
- func (b *BitMEX) SetProxy(socks5Proxy string) error
- func (b *BitMEX) StartWS()
- func (b *BitMEX) Subscribe(subscribeTypes []SubscribeInfo) error
- type Item
- type OrderBook
- type OrderBook10
- type OrderBookData
- type OrderBookDataL2
- type OrderBookL2
- type OrderBookLocal
- type RateLimit
- type Response
- type SubscribeInfo
- type Version
- type WSCmd
Constants ¶
View Source
const ( HostReal = "www.bitmex.com" HostTestnet = "testnet.bitmex.com" )
View Source
const ( // 委托的方向 SIDE_BUY = "Buy" SIDE_SELL = "Sell" // 委托的类型 ORD_TYPE_MARKET = "Market" // 市价 ORD_TYPE_LIMIT = "Limit" // 限价 ORD_TYPE_STOP = "Stop" // 市价止损 ORD_TYPE_STOP_LIMIT = "StopLimit" // 限价止损 ORD_TYPE_MARKET_IF_TOUCHED = "MarketIfTouched" // 市价止盈 ORD_TYPE_LIMIT_IF_TOUCHED = "LimitIfTouched" // 限价止盈 ORD_TYPE_MARKET_WITH_LEFT_OVER_AS_LIMIT = "MarketWithLeftOverAsLimit" // 委托的状态 OS_NEW = "New" OS_PARTIALLY_FILLED = "PartiallyFilled" OS_FILLED = "Filled" OS_CANCELED = "Canceled" OS_REJECTED = "Rejected" )
View Source
const ( // Bitmex websocket op BitmexWSAnnouncement = "announcement" // 网站公告 BitmexWSChat = "chat" // Trollbox 聊天室 BitmexWSConnected = "connected" // 已连接用户/机器人的统计数据 BitmexWSFunding = "funding" // 永续产品的资金费率更新 每个资金时段发送(通常是 8 小时) BitmexWSInstrument = "instrument" // 产品更新,包括交易量以及报价 BitmexWSInsurance = "insurance" // 每日保险基金的更新 BitmexWSLiquidation = "liquidation" // 进入委托列表的强平委托 BitmexWSOrderBookL2_25 = "orderBookL2_25" // 前 25 层的 Level 2 委托列表 BitmexWSOrderBookL2 = "orderBookL2" // 完整的 level 2 委托列表 BitmexWSOrderBook10 = "orderBook10" // 前 10 层的委托列表,用传统的完整委托列表推送 BitmexWSPublicNotifications = "publicNotifications" // 全系统的告示(用于段时间的消息) BitmexWSQuote = "quote" // 最高层的委托列表 BitmexWSQuoteBin1m = "quoteBin1m" // 每分钟报价数据 BitmexWSQuoteBin5m = "quoteBin5m" // 每 5 分钟报价数据 BitmexWSQuoteBin1h = "quoteBin1h" // 每小时报价数据 BitmexWSQuoteBin1d = "quoteBin1d" // 每天报价数据 BitmexWSSettlement = "settlement" // 结算信息 BitmexWSTrade = "trade" // 实时交易 BitmexWSTradeBin1m = "tradeBin1m" // 每分钟交易数据 BitmexWSTradeBin5m = "tradeBin5m" // 每 5 分钟交易数据 BitmexWSTradeBin1h = "tradeBin1h" // 每小时交易数据 BitmexWSTradeBin1d = "tradeBin1d" // 每天交易数据 // Bitmex websocket private op BitmexWSAffiliate = "affiliate" // 邀请人状态,已邀请用户及分红比率 BitmexWSExecution = "execution" // 个别成交,可能是多个成交 BitmexWSOrder = "order" // 你委托的更新 BitmexWSMargin = "margin" // 你账户的余额和保证金要求的更新 BitmexWSPosition = "position" // 你仓位的更新 BitmexWSPrivateNotifications = "privateNotifications" // 个人的通知,现时并未使用 BitmexWSTransact = "transact" // 资金提存更新 BitmexWSWallet = "wallet" // 比特币余额更新及总提款存款 )
Variables ¶
View Source
var (
NotFound = errors.New("not found")
)
Functions ¶
func GetConfiguration ¶
func GetConfiguration(ctx context.Context) *swagger.Configuration
Types ¶
type BitMEX ¶
BitMEX describes the API
func (*BitMEX) AmendOrder ¶
func (*BitMEX) AmendOrder2 ¶
func (*BitMEX) CancelAllOrders ¶
func (*BitMEX) CancelOrder ¶
func (*BitMEX) CloseOrder ¶
func (*BitMEX) ConfirmWithdrawal ¶
func (b *BitMEX) ConfirmWithdrawal(token string) (trans swagger.Transaction, err error)
func (*BitMEX) GetBucketed ¶
func (*BitMEX) GetInstrument ¶
func (*BitMEX) GetOrderBook ¶
func (*BitMEX) GetOrderByClOrdID ¶
func (*BitMEX) GetOrdersRaw ¶
func (*BitMEX) GetPosition ¶
func (*BitMEX) GetPositions ¶
func (*BitMEX) GetPositionsRaw ¶
func (*BitMEX) GetRateLimit ¶
func (*BitMEX) GetRateLimitPublic ¶
func (*BitMEX) GetVersion ¶
func (*BitMEX) PlaceOrder ¶
func (b *BitMEX) PlaceOrder(side string, ordType string, stopPx float64, price float64, orderQty int32, timeInForce string, execInst string, symbol string) (order swagger.Order, err error)
PlaceOrder 放置委托单 execInst: MarkPrice = 标记价格 IndexPrice = 指数价格 LastPrice = 最新成交 ParticipateDoNotInitiate = 被动委托
func (*BitMEX) PlaceOrder2 ¶
func (b *BitMEX) PlaceOrder2(side string, ordType string, stopPx float64, price float64, orderQty int32, displayQty int32, timeInForce string, execInst string, symbol string, clOrdID string, text string) (order swagger.Order, err error)
PlaceOrder 放置委托单 side: Buy/Sell ordType: = Limit/Stop/StopLimit/MarketIfTouched/LimitIfTouched/MarketWithLeftOverAsLimit stopPx: 止损止盈触发价 price: 委托价 orderQty: 委托数量 displayQty: 默认传: -1 execInst: MarkPrice = 标记价格 IndexPrice = 指数价格 LastPrice = 最新成交 ParticipateDoNotInitiate = 被动委托
func (*BitMEX) PositionUpdateLeverage ¶
func (*BitMEX) RequestWithdrawal ¶
func (*BitMEX) SetHttpProxy ¶
SetHttpProxy proxyURL: http://127.0.0.1:1080
func (*BitMEX) StartWS ¶
func (b *BitMEX) StartWS()
StartWS opens the websocket connection, and waits for message events
func (*BitMEX) Subscribe ¶
func (b *BitMEX) Subscribe(subscribeTypes []SubscribeInfo) error
type OrderBook ¶
type OrderBook10 ¶
type OrderBook10 struct { Bids [][]float64 `json:"bids"` Asks [][]float64 `json:"asks"` Timestamp time.Time `json:"timestamp"` Symbol string `json:"symbol"` }
OrderBook10 contains order book 10
type OrderBookData ¶
type OrderBookData []*OrderBookL2
type OrderBookDataL2 ¶
type OrderBookDataL2 struct { RawData []OrderBookL2 Timestamp time.Time }
func (*OrderBookDataL2) OrderBook ¶
func (o *OrderBookDataL2) OrderBook() (ob OrderBook)
type OrderBookL2 ¶
type OrderBookL2 struct { ID int64 `json:"id"` Price float64 `json:"price"` Side string `json:"side"` Size int64 `json:"size"` Symbol string `json:"symbol"` Timestamp time.Time `json:"timestamp"` }
OrderBookL2 contains order book l2
func (*OrderBookL2) Key ¶
func (o *OrderBookL2) Key() string
type OrderBookLocal ¶
type OrderBookLocal struct {
// contains filtered or unexported fields
}
func NewOrderBookLocal ¶
func NewOrderBookLocal() *OrderBookLocal
func (*OrderBookLocal) GetOrderbook ¶
func (o *OrderBookLocal) GetOrderbook() (ob OrderBook)
func (*OrderBookLocal) GetOrderbookL2 ¶
func (o *OrderBookLocal) GetOrderbookL2() (ob OrderBookDataL2)
func (*OrderBookLocal) LoadSnapshot ¶
func (o *OrderBookLocal) LoadSnapshot(newOrderbook []*OrderBookL2) error
func (*OrderBookLocal) Update ¶
func (o *OrderBookLocal) Update(orderbook []*OrderBookL2, action string)
type SubscribeInfo ¶
Directories ¶
Path | Synopsis |
---|---|
Package recws provides websocket client based on gorilla/websocket that will automatically reconnect if the connection is dropped.
|
Package recws provides websocket client based on gorilla/websocket that will automatically reconnect if the connection is dropped. |
Click to show internal directories.
Click to hide internal directories.