baseclient

package
v0.0.0-...-6869d6d Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RSASign

func RSASign(src []byte, priKey []byte, hash crypto.Hash) ([]byte, error)

Types

type OkxRestBaseClient

type OkxRestBaseClient struct {
	HttpClient http.Client
	Signer     *Signer
	Config     *config.OkxConfig
	Auth       bool
}

func (*OkxRestBaseClient) DoGet

func (p *OkxRestBaseClient) DoGet(uri string, params map[string]string) (string, error)

func (*OkxRestBaseClient) DoGetNoAuth

func (p *OkxRestBaseClient) DoGetNoAuth(uri string, params map[string]string) (string, error)

func (*OkxRestBaseClient) DoPost

func (p *OkxRestBaseClient) DoPost(uri string, params string) (string, error)

func (*OkxRestBaseClient) Init

type OkxWsBaseClient

type OkxWsBaseClient struct {
	NeedLogin        bool
	Connection       bool
	LoginStatus      bool
	Listener         OnReceive
	ErrorListener    OnReceive
	Ticker           *time.Ticker
	SendMutex        *sync.Mutex
	WebSocketClient  *websocket.Conn
	LastReceivedTime time.Time
	AllSuribe        *model.Set
	Signer           *Signer
	ScribeMap        map[model.SubscribeReq]OnReceive
	Config           *config.OkxConfig
}

func (*OkxWsBaseClient) Connect

func (p *OkxWsBaseClient) Connect()

func (*OkxWsBaseClient) ConnectWebSocket

func (p *OkxWsBaseClient) ConnectWebSocket()

func (*OkxWsBaseClient) ExecuterPing

func (p *OkxWsBaseClient) ExecuterPing()

func (*OkxWsBaseClient) GetListener

func (p *OkxWsBaseClient) GetListener(argJson interface{}) OnReceive

func (*OkxWsBaseClient) Init

func (p *OkxWsBaseClient) Init(config *config.OkxConfig) *OkxWsBaseClient

func (*OkxWsBaseClient) Login

func (p *OkxWsBaseClient) Login()

func (*OkxWsBaseClient) ReadLoop

func (p *OkxWsBaseClient) ReadLoop()

func (*OkxWsBaseClient) Send

func (p *OkxWsBaseClient) Send(data string)

func (*OkxWsBaseClient) SendByType

func (p *OkxWsBaseClient) SendByType(req model.WsBaseReq)

func (*OkxWsBaseClient) SetListener

func (p *OkxWsBaseClient) SetListener(msgListener OnReceive, errorListener OnReceive)

func (*OkxWsBaseClient) StartReadLoop

func (p *OkxWsBaseClient) StartReadLoop()

type OnReceive

type OnReceive func(message string)

type Signer

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

func (*Signer) Init

func (p *Signer) Init(key string) *Signer

func (*Signer) Sign

func (p *Signer) Sign(method string, requestPath string, body string, timesStamp string) string

func (*Signer) SignByRSA

func (p *Signer) SignByRSA(method string, requestPath string, body string, timesStamp string) string

Jump to

Keyboard shortcuts

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