mexc

package
v0.0.0-...-41d977e Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelSpotOrderBook   = "/spotMarket/level2Depth5:"
	ChannelSpotTicker      = "/market/ticker:"
	ChannelSpotPublicTrade = "/market/match:"
)

spot channels

View Source
const (
	Subscribe   = "SUBSCRIPTION"
	UnSubscribe = "UNSUBSCRIPTION"
)

Variables

This section is empty.

Functions

func ComputeHmac256

func ComputeHmac256(Message string, sec_key string) string

加密

Types

type ApiResponse

type ApiResponse struct {
	Code    string `json:"code"`
	Message string `json:"msg"`
}

返回的数据结构

type BaseWsResp

type BaseWsResp struct {
	Channel string          `json:"c,omitempty"`
	Data    json.RawMessage `json:"d"`
	Symbol  string          `json:"s"`
	Time    int64           `json:"t"`
	Price   string          `json:"price"`
}

type Mexc

type Mexc struct {
	// contains filtered or unexported fields
}

func New

func New(client *http.Client, accesskey, secretkey string) *Mexc

func (*Mexc) CancelOrder

func (m *Mexc) CancelOrder(orderId string, currencyPair CurrencyPair) (bool, error)

func (*Mexc) CreateListerKey

func (m *Mexc) CreateListerKey() (string, error)

create Listen Key

func (*Mexc) GetAccount

func (m *Mexc) GetAccount() (*Account, error)

func (*Mexc) GetBestTicker

func (m *Mexc) GetBestTicker(currencyPair CurrencyPair) (*BestTicker, error)

func (*Mexc) GetCurrencyPairs

func (m *Mexc) GetCurrencyPairs() ([]CurrencyPair, error)

获取所有交易对

func (*Mexc) GetDepth

func (m *Mexc) GetDepth(size int, currencyPair CurrencyPair) (*Depth, error)

func (*Mexc) GetExchangeName

func (g *Mexc) GetExchangeName() string

func (*Mexc) GetKlineRecords

func (m *Mexc) GetKlineRecords(currencyPair CurrencyPair, period KlinePeriod, size int, optional ...OptionalParameter) ([]Kline, error)

func (*Mexc) GetListerKey

func (m *Mexc) GetListerKey() (string, error)

get all valid listenKey

func (*Mexc) GetOneOrder

func (m *Mexc) GetOneOrder(orderId string, currencyPair CurrencyPair) (*Order, error)

func (*Mexc) GetOrderHistorys

func (m *Mexc) GetOrderHistorys(currencyPair CurrencyPair, optional ...OptionalParameter) ([]Order, error)

func (*Mexc) GetSubAccount

func (m *Mexc) GetSubAccount(coin Currency) (*SubAccount, error)

func (*Mexc) GetSubAccounts

func (m *Mexc) GetSubAccounts() ([]SubAccount, error)

func (*Mexc) GetTicker

func (m *Mexc) GetTicker(currencyPair CurrencyPair) (*Ticker, error)

func (*Mexc) GetTradeFee

func (m *Mexc) GetTradeFee(currencyPair CurrencyPair) (*TradeFee, error)

私有权限

func (*Mexc) GetTrades

func (m *Mexc) GetTrades(currencyPair CurrencyPair, size int64) ([]Trade, error)

非个人,整个交易所的交易记录,

func (*Mexc) GetUnfinishOrders

func (m *Mexc) GetUnfinishOrders(currencyPair CurrencyPair) ([]Order, error)

查询指定交易对所有挂单

func (*Mexc) LimitBuy

func (m *Mexc) LimitBuy(amount, price string, currencyPair CurrencyPair, optional ...LimitOrderOptionalParameter) (*Order, error)

限价买单

func (*Mexc) LimitSell

func (m *Mexc) LimitSell(amount, price string, currencyPair CurrencyPair, optional ...LimitOrderOptionalParameter) (*Order, error)

func (*Mexc) MarketBuy

func (m *Mexc) MarketBuy(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Mexc) MarketSell

func (m *Mexc) MarketSell(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Mexc) PlaceOrder

func (m *Mexc) PlaceOrder(amount, price string, currencyPair CurrencyPair, orderType, orderSide string) (*Order, error)

限价买单

func (*Mexc) PrivateDelete

func (m *Mexc) PrivateDelete(uri string, param url.Values) ([]byte, error)

私有delete请求

func (*Mexc) PrivateGet

func (m *Mexc) PrivateGet(uri string, param url.Values) ([]byte, error)

私有get请求

func (*Mexc) PrivatePost

func (m *Mexc) PrivatePost(uri string, param url.Values) ([]byte, error)

私有post请求

func (*Mexc) PrivatePut

func (m *Mexc) PrivatePut(uri string, param url.Values) ([]byte, error)

私有put请求

func (*Mexc) PublicGet

func (m *Mexc) PublicGet(uri string, param url.Values) ([]byte, error)

公共get请求

func (*Mexc) PutListerKey

func (m *Mexc) PutListerKey() (string, error)

Keep-alive a ListenKey

func (*Mexc) ServerTime

func (m *Mexc) ServerTime() float64

type SpotWs

type SpotWs struct {
	// contains filtered or unexported fields
}

func NewSpotWs

func NewSpotWs(mc *Mexc, accesskey, secretkey, proxy string) *SpotWs

func (*SpotWs) BestTickerCallback

func (s *SpotWs) BestTickerCallback(f func(ticker *gocoinex.BestTicker, exchange string))

func (*SpotWs) DepthCallback

func (s *SpotWs) DepthCallback(f func(depth *gocoinex.Depth, exchange string))

func (*SpotWs) HeartbeatData

func (s *SpotWs) HeartbeatData() []byte

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 (s *SpotWs) SubscribeUserBalance() error

func (*SpotWs) SubscribeUserOrder

func (s *SpotWs) SubscribeUserOrder() error

func (*SpotWs) TickerCallback

func (s *SpotWs) TickerCallback(f func(ticker *gocoinex.Ticker, exchange string))

func (*SpotWs) TradeCallback

func (s *SpotWs) TradeCallback(f func(trade *gocoinex.Trade, exchange string))

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 (s *SpotWs) UnSubscribeUserBalance() error

func (*SpotWs) UnSubscribeUserOrder

func (s *SpotWs) UnSubscribeUserOrder() error

func (*SpotWs) UserBalanceCallback

func (s *SpotWs) UserBalanceCallback(f func(trade *gocoinex.SubAccount, exchange string))

func (*SpotWs) UserOrderCallback

func (s *SpotWs) UserOrderCallback(f func(ticker *gocoinex.Order, exchange string))

type WsReq

type WsReq struct {
	Method string   `json:"method"`
	Params []string `json:"params"`
}

type WsSubscribeBaseResponse

type WsSubscribeBaseResponse struct {
	Id      string `json:"id"`
	Code    string `json:"code"`
	Message string `json:"msg"`
}

webSocket 请求结构

Jump to

Keyboard shortcuts

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