realtime

package
v0.0.0-...-4d04529 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENDPOINT                      = "wss://www.bitmex.com/realtime"
	ENDPOINTTESTNET               = "wss://testnet.bitmex.com/realtime"
	READDEADLINE    time.Duration = 300 * time.Second

	AUTHKEY = "auth"
)

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, ch chan Response, channels, symbols []string, l *log.Logger) error

func NewAuth

func NewAuth(isTestnet bool, key, secret string) context.Context

Types

type Auth

type Auth struct {
	IsTestnet bool
	Key       string
	Secret    string
}

type Book

type Book struct {
	Price float64
	Size  float64
}

type Client

type Client struct {
	Auth *Auth
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, l *log.Logger) *Client

func (*Client) Close

func (p *Client) Close() error

type In

type In struct {
}

type OrderBook

type OrderBook struct {
	Symbol    string    `json:"symbol"`
	Timestamp time.Time `json:"timestamp"`
	Bids      []Book    `json:"bids"`
	Asks      []Book    `json:"asks"`
}

func (*OrderBook) UnmarshalJSON

func (p *OrderBook) UnmarshalJSON(b []byte) error

type Request

type Request struct {
	Op   string        `json:"op"`
	Args []interface{} `json:"args"`
	ID   int           `json:"id,omitempty"`
}

type Response

type Response struct {
	Types       Types
	ProductCode string
	Action      string

	Announcement  []bitmex.Announcement
	Chat          []bitmex.Chat
	Connected     []bitmex.ConnectedUsers
	Funding       []bitmex.Funding
	Instrument    []bitmex.Instrument
	Insurance     []bitmex.Insurance
	Settlement    []bitmex.Settlement
	Notifications []bitmex.Notification

	Orderbook  []OrderBook
	OrderbookL []bitmex.OrderBookL2
	Quote      []bitmex.Quote
	Trade      []bitmex.Trade
	TradeBin   []bitmex.TradeBin

	// Private
	Affiliate               []bitmex.Affiliate
	Execution               []bitmex.Execution
	Order                   []bitmex.Order
	Margin                  []bitmex.Margin
	Position                []bitmex.Position
	NotificationsForPrivate []bitmex.Notification
	Transact                []bitmex.Transaction
	Wallet                  []bitmex.Wallet

	Results error
}

type Types

type Types int
const (
	All          Types = iota
	Announcement       // お知らせ
	Chat
	Connected  // 接続ユーザ/Bot統計
	Funding    // 資金調達率
	Instrument // 商品情報
	Insurance  // 保険基金情報
	Liquidation
	Orderbook
	OrderbookL
	Notifications // システム通知
	Quote         // ブック上位レベル
	Settlement    // 決済
	Trade         // 約定
	TradeBin

	// Private
	Affiliate
	Execution
	Order
	Margin
	Position
	NotificationsForPrivate
	Transact // 入出金に関する情報
	Wallet   // アドレス残高

	Undefined
	Error
)

func (Types) String

func (p Types) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL