transport

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Mainnet base url:
	MainBaseUrl = "https://api.bybit.com"

	// Mainnet base bytick url:
	MainBaseByTickUrl = "https://api.bytick.com"

	// Mainnet base websocket url:
	MainBaseWsUrl = "wss://stream.bybit.com"

	// Mainnet base bytick websocket url:
	MainBaseByTickWsUrl = "wss://stream.bytick.com"
)

Variables

This section is empty.

Functions

func JsonUnmarshal

func JsonUnmarshal[V any](jsonBlob []byte) V

func ParseProxy

func ParseProxy(proxy string) (*url.URL, error)

Types

type Client

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

func NewClient

func NewClient() *Client

func (*Client) Delete

func (o *Client) Delete(path string, param any, ret any) error

func (*Client) Get

func (o *Client) Get(path string, param any, ret any) error

func (*Client) GetPublic

func (o *Client) GetPublic(path string, param any, ret any) error

func (*Client) HasProxy

func (o *Client) HasProxy() bool

func (*Client) Key

func (o *Client) Key() string

func (*Client) Post

func (o *Client) Post(path string, param any, ret any) error

func (*Client) Request

func (o *Client) Request(method string, path string, param any, ret any, sign bool) (err error)

func (*Client) RequestPrivate

func (o *Client) RequestPrivate(method string, path string, param any, ret any) error

func (*Client) RequestPublic

func (o *Client) RequestPublic(method string, path string, param any, ret any) error

func (*Client) Secret

func (o *Client) Secret() string

func (*Client) WithAuth

func (o *Client) WithAuth(key, secret string) *Client

func (*Client) WithByTickUrl

func (o *Client) WithByTickUrl() *Client

func (*Client) WithLog

func (o *Client) WithLog(log *ulog.Log) *Client

func (*Client) WithLogRequest

func (o *Client) WithLogRequest(logRequest bool) *Client

func (*Client) WithLogResponse

func (o *Client) WithLogResponse(logResponse bool) *Client

func (*Client) WithLogUri

func (o *Client) WithLogUri(logUri bool) *Client

func (*Client) WithOnTransportError added in v0.3.2

func (o *Client) WithOnTransportError(f OnTransportError) *Client

func (*Client) WithProxy

func (o *Client) WithProxy(proxy string) *Client

func (*Client) WithTimeout

func (o *Client) WithTimeout(timeout time.Duration) *Client

func (*Client) WithUrl

func (o *Client) WithUrl(url string) *Client

type Err

type Err struct {
	Code int
	Text string
}

func (*Err) Empty

func (o *Err) Empty() bool

func (*Err) Error

func (o *Err) Error() string

type Error

type Error struct {
	Err
}

type Float64

type Float64 float64

func (Float64) IsNotZero

func (o Float64) IsNotZero() bool

func (Float64) IsZero

func (o Float64) IsZero() bool

func (Float64) Ptr

func (o Float64) Ptr() *float64

func (*Float64) UnmarshalJSON

func (o *Float64) UnmarshalJSON(b []byte) error

func (Float64) Value

func (o Float64) Value() float64

type HeaderSign

type HeaderSign struct {
}

type OnTransportError added in v0.3.2

type OnTransportError func(err error, statusCode int, attempt int) bool

type Param

type Param struct {
	IsJson     bool
	HeaderSign bool
	// contains filtered or unexported fields
}

func NewParam

func NewParam() Param

func (*Param) Add

func (o *Param) Add(name string, val any)

func (Param) From

func (o Param) From(v any) Param

func (Param) Make

func (o Param) Make() url.Values

type ParamTag

type ParamTag struct {
	Name   string
	IsPtr  bool
	IsJson bool
	Ok     bool
}

func GetParamTag

func GetParamTag(f reflect.StructField) (tag ParamTag)

type PreRateLimitError

type PreRateLimitError struct {
	Limit  int
	Status int
}

func (*PreRateLimitError) Error

func (o *PreRateLimitError) Error() string

type TimeMs

type TimeMs time.Time

func (TimeMs) Std

func (o TimeMs) Std() time.Time

func (*TimeMs) UnmarshalJSON

func (o *TimeMs) UnmarshalJSON(b []byte) error

type WsClient

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

func NewWsClient

func NewWsClient(url string) *WsClient

func (*WsClient) Conf

func (o *WsClient) Conf() *WsConf

func (*WsClient) Connected

func (o *WsClient) Connected() bool

func (*WsClient) Run

func (o *WsClient) Run()

func (*WsClient) Send

func (o *WsClient) Send(cmd any) bool

func (*WsClient) SetOnConnected

func (o *WsClient) SetOnConnected(onConnected func())

func (*WsClient) SetOnDialError

func (o *WsClient) SetOnDialError(onDialError func(error) bool)

func (*WsClient) SetOnDisconnected

func (o *WsClient) SetOnDisconnected(onDisconnected func())

func (*WsClient) SetOnMessage

func (o *WsClient) SetOnMessage(onMessage func(string, []byte))

func (*WsClient) Shutdown

func (o *WsClient) Shutdown()

func (*WsClient) WithByTickUrl

func (o *WsClient) WithByTickUrl() *WsClient

func (*WsClient) WithLog

func (o *WsClient) WithLog(log *ulog.Log) *WsClient

func (*WsClient) WithProxy

func (o *WsClient) WithProxy(proxy string) *WsClient

func (*WsClient) WithUrl

func (o *WsClient) WithUrl(url string) *WsClient

type WsConf

type WsConf struct {
	Proxy            *url.URL
	HandshakeTimeout time.Duration
	ReadTimeout      time.Duration
	WriteTimeout     time.Duration
	LogRecv          bool
	LogSent          bool
}

func NewWsConf

func NewWsConf() *WsConf

func (*WsConf) HasProxy

func (o *WsConf) HasProxy() bool

func (*WsConf) SetProxy

func (o *WsConf) SetProxy(proxy string)

type WsConn

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

func NewWsConn

func NewWsConn(method string) *WsConn

func (*WsConn) Conf

func (o *WsConn) Conf() *WsConf

func (*WsConn) Connected

func (o *WsConn) Connected() bool

func (*WsConn) Do

func (o *WsConn) Do() bool

func (*WsConn) ID

func (o *WsConn) ID() string

func (*WsConn) Run

func (o *WsConn) Run()

func (*WsConn) Send

func (o *WsConn) Send(v any) bool

func (*WsConn) SetOnConnected

func (o *WsConn) SetOnConnected(onConnected func())

func (*WsConn) SetOnDialError

func (o *WsConn) SetOnDialError(onDialError func(error) bool)

func (*WsConn) SetOnDisconnected

func (o *WsConn) SetOnDisconnected(onDisconnected func())

func (*WsConn) SetOnMessage

func (o *WsConn) SetOnMessage(onMessage func([]byte))

func (*WsConn) Shutdown

func (o *WsConn) Shutdown()

func (*WsConn) Sleep

func (o *WsConn) Sleep(duration time.Duration)

func (*WsConn) WithByTickUrl

func (o *WsConn) WithByTickUrl() *WsConn

func (*WsConn) WithLog

func (o *WsConn) WithLog(log *ulog.Log) *WsConn

func (*WsConn) WithUrl

func (o *WsConn) WithUrl(url string) *WsConn

Jump to

Keyboard shortcuts

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