Documentation ¶
Index ¶
- Constants
- func BuildGetParams(params map[string]string) string
- func BuildJsonParams(params map[string]string) (string, error)
- func Headers(request *http.Request, apikey string, timestamp string, sign string, ...)
- func NewParams() map[string]string
- func RSASign(src []byte, priKey []byte, hash crypto.Hash) ([]byte, error)
- func TimesStamp() string
- func TimesStampSec() string
- type ApiResponse
- type Bitget
- func (p *Bitget) CancelOrder(orderId string, currencyPair CurrencyPair) (bool, error)
- func (p *Bitget) DoGet(uri string, params map[string]string) ([]byte, error)
- func (p *Bitget) DoPost(uri string, params string) ([]byte, error)
- func (p *Bitget) GetAccount() (*Account, error)
- func (p *Bitget) GetBestTicker(currencyPair CurrencyPair) (*BestTicker, error)
- func (p *Bitget) GetCurrencyPairs() ([]CurrencyPair, error)
- func (p *Bitget) GetDepth(size int, currencyPair CurrencyPair) (*Depth, error)
- func (g *Bitget) GetExchangeName() string
- func (p *Bitget) GetKlineRecords(currencyPair CurrencyPair, period KlinePeriod, size int, ...) ([]Kline, error)
- func (p *Bitget) GetOneOrder(orderId string, currencyPair CurrencyPair) (*Order, error)
- func (p *Bitget) GetOrderHistorys(currencyPair CurrencyPair, optional ...OptionalParameter) ([]Order, error)
- func (p *Bitget) GetSubAccount(coin Currency) (*SubAccount, error)
- func (p *Bitget) GetSubAccounts() ([]SubAccount, error)
- func (p *Bitget) GetTicker(currencyPair CurrencyPair) (*Ticker, error)
- func (p *Bitget) GetTradeFee(currencyPair CurrencyPair) (*TradeFee, error)
- func (p *Bitget) GetTrades(currencyPair CurrencyPair, size int64) ([]Trade, error)
- func (p *Bitget) GetUnfinishOrders(currencyPair CurrencyPair) ([]Order, error)
- func (p *Bitget) LimitBuy(amount, price string, currencyPair CurrencyPair, ...) (*Order, error)
- func (p *Bitget) LimitSell(amount, price string, currencyPair CurrencyPair, ...) (*Order, error)
- func (p *Bitget) MarketBuy(amount, price string, currencyPair CurrencyPair) (*Order, error)
- func (p *Bitget) MarketSell(amount, price string, currencyPair CurrencyPair) (*Order, error)
- func (p *Bitget) PlaceOrder(amount, price string, currencyPair CurrencyPair, orderType, orderSide string) (*Order, error)
- type KLineModel
- type KLinesModel
- type PartOrderBookModel
- type Signer
- type SpotWs
- func (s *SpotWs) Auth()
- func (s *SpotWs) BestTickerCallback(f func(ticker *gocoinex.BestTicker, exchange string))
- func (s *SpotWs) DepthCallback(f func(depth *gocoinex.Depth, exchange string))
- func (s *SpotWs) HeartbeatData() []byte
- func (s *SpotWs) SubscribeBestTicker(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) SubscribeDepth(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) SubscribeTicker(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) SubscribeTrade(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) SubscribeUserBalance() error
- func (s *SpotWs) SubscribeUserOrder() error
- func (s *SpotWs) TickerCallback(f func(ticker *gocoinex.Ticker, exchange string))
- func (s *SpotWs) TradeCallback(f func(trade *gocoinex.Trade, exchange string))
- func (s *SpotWs) UnSubscribeBestTicker(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) UnSubscribeDepth(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) UnSubscribeTicker(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) UnSubscribeTrade(pair gocoinex.CurrencyPair) error
- func (s *SpotWs) UnSubscribeUserBalance() error
- func (s *SpotWs) UnSubscribeUserOrder() error
- func (s *SpotWs) UserBalanceCallback(f func(trade *gocoinex.SubAccount, exchange string))
- func (s *SpotWs) UserOrderCallback(f func(ticker *gocoinex.Order, exchange string))
- type SubscribeReq
- type WsBaseReq
- type WsBaseResponse
- type WsLoginBaseReq
- type WsLoginReq
- type WsSubscribeBaseReq
- type WsSubscribeBaseResponse
Constants ¶
View Source
const ( ChannelSpotOrderBook = "/spotMarket/level2Depth5:" ChannelSpotTicker = "/market/ticker:" ChannelSpotPublicTrade = "/market/match:" )
spot channels
View Source
const ( Login = "login" Subscribe = "subscribe" UnSubscribe = "unsubscribe" )
View Source
const ( /* * http headers */ ContentType = "Content-Type" BgAccessKey = "ACCESS-KEY" BgAccessSign = "ACCESS-SIGN" BgAccessTimestamp = "ACCESS-TIMESTAMP" BgAccessPassphrase = "ACCESS-PASSPHRASE" ApplicationJson = "application/json" EN_US = "en_US" ZH_CN = "zh_CN" LOCALE = "locale=" /* * websocket */ WsAuthMethod = "GET" WsAuthPath = "/user/verify" WsOpLogin = "login" WsOpUnsubscribe = "unsubscribe" WsOpSubscribe = "subscribe" TimerIntervalSecond = 5 ReconnectWaitSecond = 60 /* * SignType */ RSA = "RSA" SHA256 = "SHA256" )
View Source
const ( BaseUrl = "https://api.bitget.com" WsUrl = "wss://ws.bitget.com/mix/v1/stream" ApiKey = "" SecretKey = "" PASSPHRASE = "" TimeoutSecond = 30 SignType = SHA256 )
Variables ¶
This section is empty.
Functions ¶
func BuildGetParams ¶
func Headers ¶
func Headers(request *http.Request, apikey string, timestamp string, sign string, passphrase string)
*
- get header
func TimesStamp ¶
func TimesStamp() string
func TimesStampSec ¶
func TimesStampSec() string
Types ¶
type ApiResponse ¶
type ApiResponse struct { Code string `json:"code"` RawData json.RawMessage `json:"data"` // delay parsing Message string `json:"msg"` }
返回的数据结构
type Bitget ¶
type Bitget struct { Accesskey string Secretkey string Passphrase string Signer *Signer // contains filtered or unexported fields }
func (*Bitget) CancelOrder ¶
func (*Bitget) GetAccount ¶
func (*Bitget) GetBestTicker ¶
func (*Bitget) GetCurrencyPairs ¶
获取所有交易对
func (*Bitget) GetExchangeName ¶
func (*Bitget) GetKlineRecords ¶
func (*Bitget) GetOneOrder ¶
func (*Bitget) GetOrderHistorys ¶
func (*Bitget) GetSubAccount ¶
func (*Bitget) GetSubAccounts ¶
func (*Bitget) GetTradeFee ¶
私有权限,交易手续费用在V2版本未见此接口,用回V1版本接口
func (*Bitget) GetUnfinishOrders ¶
查询指定交易对所有挂单
func (*Bitget) LimitBuy ¶
func (p *Bitget) LimitBuy(amount, price string, currencyPair CurrencyPair, optional ...LimitOrderOptionalParameter) (*Order, error)
限价买单
func (*Bitget) MarketSell ¶
type KLineModel ¶
type KLineModel []string
KLineModel represents the k lines for a symbol. Rates are returned in grouped buckets based on requested type.
type PartOrderBookModel ¶
type PartOrderBookModel struct { Time string `json:"ts"` Bids [][]string `json:"bids"` Asks [][]string `json:"asks"` }
A PartOrderBookModel represents a list of open orders for a symbol, a part of Order Book within 100 depth for each side(ask or bid).
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
type SpotWs ¶
type SpotWs struct { Signer *Signer // contains filtered or unexported fields }
func (*SpotWs) BestTickerCallback ¶
func (s *SpotWs) BestTickerCallback(f func(ticker *gocoinex.BestTicker, exchange string))
func (*SpotWs) DepthCallback ¶
func (*SpotWs) HeartbeatData ¶
func (*SpotWs) SubscribeBestTicker ¶
func (s *SpotWs) SubscribeBestTicker(pair gocoinex.CurrencyPair) error
func (*SpotWs) SubscribeDepth ¶
func (s *SpotWs) SubscribeDepth(pair gocoinex.CurrencyPair) error
func (*SpotWs) SubscribeTicker ¶
func (s *SpotWs) SubscribeTicker(pair gocoinex.CurrencyPair) error
func (*SpotWs) SubscribeTrade ¶
func (s *SpotWs) SubscribeTrade(pair gocoinex.CurrencyPair) error
func (*SpotWs) SubscribeUserBalance ¶
func (*SpotWs) SubscribeUserOrder ¶
func (*SpotWs) TickerCallback ¶
func (*SpotWs) TradeCallback ¶
func (*SpotWs) UnSubscribeBestTicker ¶
func (s *SpotWs) UnSubscribeBestTicker(pair gocoinex.CurrencyPair) error
func (*SpotWs) UnSubscribeDepth ¶
func (s *SpotWs) UnSubscribeDepth(pair gocoinex.CurrencyPair) error
func (*SpotWs) UnSubscribeTicker ¶
func (s *SpotWs) UnSubscribeTicker(pair gocoinex.CurrencyPair) error
func (*SpotWs) UnSubscribeTrade ¶
func (s *SpotWs) UnSubscribeTrade(pair gocoinex.CurrencyPair) error
func (*SpotWs) UnSubscribeUserBalance ¶
func (*SpotWs) UnSubscribeUserOrder ¶
func (*SpotWs) UserBalanceCallback ¶
func (s *SpotWs) UserBalanceCallback(f func(trade *gocoinex.SubAccount, exchange string))
type SubscribeReq ¶
type WsBaseReq ¶
type WsBaseReq struct { Op string `json:"op"` Args []interface{} `json:"args"` }
webSocket 请求结构
type WsBaseResponse ¶
type WsBaseResponse struct { Event string `json:"event"` Code string `json:"code"` //错误码,错误时才会返回 Message string `json:"msg"` Args []interface{} `json:"args"` }
webSocket 返回数据结构
type WsLoginBaseReq ¶
type WsLoginBaseReq struct { Op string `json:"op"` Args []WsLoginReq `json:"args"` }
type WsLoginReq ¶
type WsSubscribeBaseReq ¶
type WsSubscribeBaseReq struct { Op string `json:"op"` Args []SubscribeReq `json:"args"` }
type WsSubscribeBaseResponse ¶
type WsSubscribeBaseResponse struct { Action string `json:"action"` Arg SubscribeReq `json:"arg"` // contains filtered or unexported fields }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.