okex5

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BillsEndPoint           = "/api/v5/account/bills"
	InterestAccruedEndPoint = "/api/v5/account/interest-accrued"
)
View Source
const (
	TransferEndPoint         = "/api/v5/asset/transfer"
	CurrenciesEndPoint       = "/api/v5/asset/currencies"
	AssetBillsEndPoint       = "/api/v5/asset/bills"
	WithdrawlHistoryEndPoint = "/api/v5/asset/withdrawal-history"
)
View Source
const (
	CtTypeNone    CtType = ""
	CtTypeLinear  CtType = "linear"
	CtTypeInverse CtType = "Inverse"

	MgnModeNone     MgnMode = ""
	MgnModeCash     MgnMode = "cash"
	MgnModeCross    MgnMode = "cross"
	MgnModeIsolated MgnMode = "isolated"
	MgnModeEmpty    MgnMode = ""

	ExecTypeMaker ExecType = "M"
	ExecTypeTaker ExecType = "T"

	InstTypeSpot    InstType = "SPOT"
	InstTypeMargin  InstType = "MARGIN"
	InstTypeSwap    InstType = "SWAP"
	InstTypeFutures InstType = "FUTURES"
	InstTypeOption  InstType = "OPTION"
	InstTypeAny     InstType = "ANY"
	InstTypeNone    InstType = ""

	TDModeIsolated TDMode = "isolated"
	TDModeCross    TDMode = "cross"
	TDModeCash     TDMode = "cash"

	OrderSideBuy  OrderSide = "buy"
	OrderSideSell OrderSide = "sell"

	PosSideNone  PosSide = ""
	PosSideLong  PosSide = "long"
	PosSideShort PosSide = "short"
	PosSideNet   PosSide = "net"

	OrdTypeMaket           OrdType = "market"
	OrdTypeLimit           OrdType = "limit"
	OrdTypePostOnly        OrdType = "post_only"
	OrdTypeFOK             OrdType = "fok"
	OrdTypeIOC             OrdType = "ioc"
	OrdTypeOptimalLimitIOC OrdType = "optimal_limit_ioc"

	OrderStateCanceled        OrderState = "canceled"
	OrderStateLive            OrderState = "live"
	OrderStatePartiallyFilled OrderState = "partially_filled"
	OrderStateFilled          OrderState = "filled"

	OrderCategoryUnknown            OrderCategory = ""
	OrderCategoryNormal             OrderCategory = "normal"
	OrderCategoryTwap               OrderCategory = "twap"
	OrderCategoryAdl                OrderCategory = "adl"
	OrderCategoryFullLiquidation    OrderCategory = "full_liquidation"
	OrderCategoryPartialLiquidation OrderCategory = "partial_liquidation"
	OrderCategoryDelivery           OrderCategory = "delivery"
)
View Source
const (
	SubAccountListEndpoint     = "/api/v5/users/subaccount/list"
	SubAccountBillsEndPoint    = "/api/v5/asset/subaccount/bills"
	SubAccountBalancesEndPoint = "/api/v5/account/subaccount/balances"
)
View Source
const (
	CreateOrderEndPoint = "/api/v5/trade/order"
	FetchOrderEndPoint  = CreateOrderEndPoint
	CancelOrderEndPoint = "/api/v5/trade/cancel-order"
	FillsEndPoint       = "/api/v5/trade/fills"
)
View Source
const (
	DepthSnapshot = "snapshot"
	DepthUpdate   = "update"

	BooksChannel      = "books"
	Books5Channel     = "books5"
	Books50TBTChannel = "books50-l2-tbt"
)
View Source
const (
	WebSocketPublicAddr     = "wss://wsaws.okex.com:8443/ws/v5/public"
	WebSocketPrivateAddr    = "wss://wsaws.okex.com:8443/ws/v5/private"
	WebSocketSimPublicAddr  = "wss://wspap.okex.com:8443/ws/v5/public?brokerId=9999"
	WebSocketSimPrivateAdrr = "wss://wspap.okex.com:8443/ws/v5/private?brokerId=9999"

	MethodSubscribe   = "subscribe"
	MethodUnSubscribe = "unsubscribe"
)
View Source
const (
	AccountBalanceEndPoint = "/api/v5/account/balance"
)
View Source
const (
	BooksEndPoint = "/api/v5/market/books"
)
View Source
const (
	CodeOK = "0"
)
View Source
const (
	FundingEndPoint = "/api/v5/public/funding-rate"
)
View Source
const (
	InstrumentEndPoint = "/api/v5/public/instruments"
)
View Source
const (
	PositionsEndPoint = "/api/v5/account/positions"
)
View Source
const (
	TradesChannel = "trades"
)

Variables

This section is empty.

Functions

func InitSymbols

func InitSymbols(ctx context.Context) error

func InitTestSymbols added in v0.5.2

func InitTestSymbols(ctx context.Context) error

func NewBooks50TBTChannel

func NewBooks50TBTChannel(instId string) exchange.Channel

func NewBooks5Channel

func NewBooks5Channel(instId string) exchange.Channel

func NewBooksChannel added in v0.5.4

func NewBooksChannel(instId string) exchange.Channel

func ParseMarginSymbol

func ParseMarginSymbol(sym string) (exchange.MarginSymbol, error)

func ParseSpotSymbol

func ParseSpotSymbol(sym string) (exchange.SpotSymbol, error)

func ParseSwapSymbol

func ParseSwapSymbol(sym string) (exchange.SwapSymbol, error)

func ParseTimestamp

func ParseTimestamp(ts string) (time.Time, error)

ParseTimestamp parse okex5 api timestamp

Types

type AccountBalance

type AccountBalance struct {
	UTime       string          `json:"uTime"`
	TotalEq     string          `json:"totalEq"`
	IsoEq       string          `json:"isoEq"`
	AdjEq       string          `json:"adjEq"`
	OrdFroz     string          `json:"ordFroz"`
	Imr         string          `json:"imr"`
	Nmr         string          `json:"nmr"`
	MgnRatio    string          `json:"mgnRatio"`
	NotionalUSD string          `json:"notionalUsd"`
	Details     []AccountDetial `json:"details"`
}

type AccountDetial

type AccountDetial struct {
	Ccy           string `json:"ccy"`
	Eq            string `json:"eq"`
	CashBal       string `json:"cashBal"`
	UTime         string `json:"uTime"`
	IsoEq         string `json:"isoEq"`
	AvailEq       string `json:"availEq"`
	DisEq         string `json:"disEq"`
	AvailBal      string `json:"availBal"`
	FrozenBal     string `json:"frozenBal"`
	OrdFrozen     string `json:"ordFrozen"`
	Liab          string `json:"liab"`
	Upl           string `json:"upl"`
	UplLiab       string `json:"uplLiab"`
	CrossLiab     string `json:"crossLiab"`
	IsoLiab       string `json:"isoLiab"`
	MgnRatio      string `json:"mgnRatio"`
	Interest      string `json:"interest"`
	Twap          string `json:"twap"`
	MaxLoan       string `json:"maxLoan"`
	EqUsd         string `json:"eqUsd"`
	NotionalLever string `json:"notionalLever"`
}

type AssetBillRecord added in v0.5.4

type AssetBillRecord struct {
	BillID string `json:"billId"`
	Ccy    string `json:"ccy"`
	BalChg string `json:"balChg"`
	Bal    string `json:"bal"`
	Type   string `json:"type"`
	Ts     string `json:"ts"`
}

type AssetBillReq added in v0.5.4

type AssetBillReq struct {
	*GetRequest
}

func NewAssetBillReq added in v0.5.4

func NewAssetBillReq() *AssetBillReq

func (*AssetBillReq) AfterTime added in v0.5.4

func (ar *AssetBillReq) AfterTime(ts time.Time) *AssetBillReq

func (*AssetBillReq) BeforeTime added in v0.5.4

func (ar *AssetBillReq) BeforeTime(ts time.Time) *AssetBillReq

func (*AssetBillReq) Ccy added in v0.5.4

func (ar *AssetBillReq) Ccy(ccy string) *AssetBillReq

func (*AssetBillReq) Limit added in v0.5.4

func (ar *AssetBillReq) Limit(l string) *AssetBillReq

func (*AssetBillReq) Type added in v0.5.4

func (ar *AssetBillReq) Type(typ string) *AssetBillReq

type Bill

type Bill struct {
	InstType  InstType `json:"instType"`
	BillID    string   `json:"billId"`
	Type      string   `json:"type"`
	SubType   string   `json:"subType"`
	Ts        string   `json:"ts"`
	BalChg    string   `json:"balChg"`
	PosBalChg string   `json:"posBalChg"`
	Bal       string   `json:"bal"`
	PosBal    string   `json:"posBal"`
	Sz        string   `json:"sz"`
	Ccy       string   `json:"ccy"`
	Pnl       string   `json:"pnl"`
	Fee       string   `json:"fee"`
	MgnMode   MgnMode  `json:"mgnMode"`
	InstID    string   `json:"instId"`
	OrdID     string   `json:"ordId"`
	From      string   `json:"from"`
	To        string   `json:"to"`
	Notes     string   `json:"notes"`
}

func (*Bill) Parse

func (b *Bill) Parse() (*exchange.Finance, error)

type BillReq

type BillReq struct {
	InstType InstType
	Ccy      string
	MgnMode  MgnMode
	CtType   CtType
	Type     string
	SubType  string
	After    string
	Before   string
	Limit    string
}

type CancelOrderReq

type CancelOrderReq struct {
	InstID  string `json:"instId"`
	OrdId   string `json:"ordId"`
	ClOrdID string `json:"clOrdId"`
}

type CancelOrderResp

type CancelOrderResp struct {
	OrdID   string `json:"ordId"`
	ClOrdID string `json:"clOrdId"`
	SCode   string `json:"sCode"`
	SMsg    string `json:"sMsg"`
}

type CodeC

type CodeC struct {
	LastEvent string
}

func NewCodec

func NewCodec() *CodeC

func (*CodeC) Decode

func (cc *CodeC) Decode(raw []byte) (rpc.Response, error)

func (*CodeC) Encode

func (cc *CodeC) Encode(req rpc.Request) ([]byte, error)

type CreateOrderReq

type CreateOrderReq struct {
	InstID     string    `json:"instId"`
	TDMode     TDMode    `json:"tdMode"`
	Ccy        string    `json:"ccy,omitempty"`
	ClOrderID  string    `json:"clOrderId,omitempty"`
	Tag        string    `json:"tag,omitempty"`
	Side       OrderSide `json:"side"`
	PosSide    PosSide   `json:"posSide,omitempty"`
	OrdType    OrdType   `json:"ordType"`
	Sz         string    `json:"sz"`
	Px         string    `json:"px,omitempty"`
	ReduecOnly bool      `json:"reduceOnly"`
}

type CreateOrderResp

type CreateOrderResp struct {
	OrderID   string `json:"ordId"`
	ClOrderID string `json:"clOrdId"`
	Tag       string `json:"tag"`
	SCode     string `json:"sCode"`
	SMsg      string `json:"sMsg"`
}

type CtType

type CtType string

func (*CtType) UnmarshalJSON

func (ct *CtType) UnmarshalJSON(raw []byte) error

type CurrencyResp

type CurrencyResp struct {
	Ccy         string `json:"ccy"`
	Name        string `json:"name"`
	Chain       string `json:"chain"`
	CanDep      bool   `json:"canDep"`
	CanWd       bool   `json:"canWd"`
	CanInternal bool   `json:"canInternal"`
	MinWd       string `json:"minWd"`
	MinFee      string `json:"minFee"`
	MaxFee      string `json:"maxFee"`
}

type Depth

type Depth struct {
	Asks         [][4]string
	Bids         [][4]string
	Ts           string
	Checksum     int32 //checksum recv from okex
	CalcChecskum int32 //checksum calc by bids and asks data
}

type DepthDS

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

DepthDS recv okex5 RawDepth notify and calc depth

func NewDepthDS

func NewDepthDS() *DepthDS

func (*DepthDS) Push

func (ds *DepthDS) Push(raw *RawDepth) (*Depth, error)

Push update depth data accoring raw depth data base on the https://www.okex.com/docs-v5/en/#websocket-api-checksum-merging-incremental-data-into-full-data

type ExecType

type ExecType string

func (*ExecType) UnmarshalJSON

func (et *ExecType) UnmarshalJSON(raw []byte) error

type FetchOrderReq

type FetchOrderReq struct {
	InstID  string `json:"instId"`
	OrdID   string `json:"ordId"`
	ClOrdID string `json:"clOrdId"`
}

type Fill

type Fill struct {
	InstType InstType  `json:"instType"`
	InstID   string    `json:"instId"`
	TradeID  string    `json:"tradeId"`
	OrdID    string    `json:"ordId"`
	ClOrdID  string    `json:"clOrdId"`
	BillID   string    `json:"billId"`
	Tag      string    `json:"tag"`
	FIllPx   string    `json:"fillPx"`
	FillSz   string    `json:"fillSz"`
	Side     OrderSide `json:"side"`
	PosSide  PosSide   `json:"posSide"`
	ExecType ExecType  `json:"execType"`
	FeeCcy   string    `json:"feeCcy"`
	Fee      string    `json:"fee"`
	Ts       string    `json:"ts"`
}

func (*Fill) Parse

func (f *Fill) Parse() (*exchange.Trade, error)

type FillsReq

type FillsReq struct {
	InstType InstType
	InstID   string
	OrdID    string
	Uly      string
	After    string
	Before   string
	Limit    string
}

type FundingRate added in v0.5.2

type FundingRate struct {
	InstType        InstType `json:"InstType"`
	InstID          string   `json:"instId"`
	FundingRate     string   `json:"fundingRate"`
	NextFundingRate string   `json:"nextFundingRate"`
	FundingTime     string   `json:"fundingTime"`
	NextFundingTime string   `json:"nextFundingTime"`
}

type GetRequest added in v0.5.4

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

func NewGetRequest added in v0.5.4

func NewGetRequest() *GetRequest

func (*GetRequest) Add added in v0.5.4

func (gr *GetRequest) Add(key, val string)

func (*GetRequest) Values added in v0.5.4

func (gr *GetRequest) Values() url.Values

type InstType

type InstType string

func (*InstType) UnmarshalJSON

func (it *InstType) UnmarshalJSON(raw []byte) error

type Instrument

type Instrument struct {
	InstType  InstType `json:"instType"`
	InstID    string   `json:"instId"`
	Uly       string   `json:"uly"`
	Category  string   `json:"category"`
	BaseCcy   string   `json:"baseCcy"`
	QuoteCcy  string   `json:"quoteCcy"`
	SettleCcy string   `json:"settleCcy"`
	CtVal     string   `json:"CtVal"`
	CtMul     string   `json:"CtMul"`
	CtValCcy  string   `json:"ctValCcy"`
	OptType   string   `json:"optType"`
	Stk       string   `json:"stk"`
	ListTime  string   `json:"listTime"`
	ExpTime   string   `json:"expTime"`
	Lever     string   `json:"lever"`
	TickSz    string   `json:"tickSz"`
	LotSz     string   `json:"lotSz"`
	MinSz     string   `json:"minSz"`
	CtType    string   `json:"ctType"`
	Alias     string   `json:"alias"`
	State     string   `json:"state"`
}

func (*Instrument) Parse added in v0.5.2

func (it *Instrument) Parse() (exchange.Symbol, error)

type InterestAccrued added in v0.4.0

type InterestAccrued struct {
	InstID       string
	Ccy          string
	MgnMode      MgnMode
	InterestRate string
	Liab         string
	Interest     string
	TS           string
}

type InterestAccruedReq added in v0.4.0

type InterestAccruedReq struct {
	InstID  string
	Ccy     string
	MgnMode MgnMode
	After   string
	Before  string
	Limit   string
}

type MarginSymbol

type MarginSymbol struct {
	*exchange.BaseMarginSymbol
}

func (*MarginSymbol) String

func (ms *MarginSymbol) String() string

type MgnMode

type MgnMode string

func (*MgnMode) UnmarshalJSON

func (mgn *MgnMode) UnmarshalJSON(raw []byte) error

type Okex5Channel

type Okex5Channel struct {
	Channel  string   `json:"channel"`
	InstType InstType `json:"instType,omitempty"`
	Uly      string   `json:"uly,omitempty"`
	InstID   string   `json:"instId,omitempty"`
}

func NewTradesChannel

func NewTradesChannel(instID string) *Okex5Channel

func (*Okex5Channel) String

func (oc *Okex5Channel) String() string

type OrdType

type OrdType string

func (*OrdType) UnmarshalJSON

func (ot *OrdType) UnmarshalJSON(raw []byte) error

type Order

type Order struct {
	InstType    InstType      `json:"instType"`
	InstId      string        `json:"instId"`
	Ccy         string        `json:"ccy"`
	OrderID     string        `json:"ordId"`
	ClOrdID     string        `json:"clOrdId"`
	Tag         string        `json:"tag"`
	Px          string        `json:"px"`
	Sz          string        `json:"sz"`
	Pnl         string        `json:"pnl"`
	OrderType   OrdType       `json:"ordType"`
	Side        OrderSide     `json:"side"`
	PosSide     PosSide       `json:"posSide"`
	TDMode      TDMode        `json:"tdMode"`
	AccFillSZ   string        `json:"accFillSz"`
	FillPx      string        `json:"fillPx"`
	TradeID     string        `json:"tradeId"`
	FillSz      string        `json:"fillSz"`
	FillTime    string        `json:"fillTime"`
	AvgPx       string        `json:"avgPx"`
	State       OrderState    `json:"state"`
	Lever       string        `json:"lever"`
	TpTriggerPx string        `json:"tpTriggerPx"`
	TpOrdPx     string        `json:"tpOrdPx"`
	SlTriggerPx string        `json:"slTriggerPx"`
	SlOrdPx     string        `json:"slOrdPx"`
	FeeCcy      string        `json:"feeCcy"`
	Fee         string        `json:"fee"`
	RebateCcy   string        `json:"rebatCcy"`
	Rebat       string        `json:"rebat"`
	Category    OrderCategory `json:"category"`
	UTime       string        `json:"uTime"`
	CTime       string        `json:"cTime"`
}

type OrderCategory

type OrderCategory string

func (*OrderCategory) UnmarshalJSON

func (oc *OrderCategory) UnmarshalJSON(raw []byte) error

type OrderSide

type OrderSide string

func (*OrderSide) UnmarshalJSON

func (os *OrderSide) UnmarshalJSON(raw []byte) error

type OrderState

type OrderState string

func (*OrderState) UnmarshalJSON

func (os *OrderState) UnmarshalJSON(raw []byte) error

type OrdersHistoryReq added in v0.4.2

type OrdersHistoryReq struct {
	InstType InstType      `json:"instType"`
	Uly      string        `json:"uly"`
	InstID   string        `json:"instId"`
	OrdType  OrdType       `json:"ordType"`
	State    string        `json:"state"`
	Category OrderCategory `json:"category"`
	After    string        `json:"after"`
	Before   string        `json:"before"`
	Limit    string        `json:"limit"`
}

type PosSide

type PosSide string

func (*PosSide) UnmarshalJSON

func (ps *PosSide) UnmarshalJSON(raw []byte) error

type Positions added in v0.5.4

type Positions struct {
	Adl         string `json:"adl"`
	AvailPos    string `json:"availPos"`
	AvgPx       string `json:"avgPx"`
	CTime       string `json:"cTime"`
	Ccy         string `json:"ccy"`
	DeltaBS     string `json:"deltaBS"`
	DeltaPA     string `json:"deltaPA"`
	GammaBS     string `json:"gammaBS"`
	GammaPA     string `json:"gammaPA"`
	IMR         string `json:"imr"`
	InstID      string `json:"instId"`
	InstType    string `json:"instType"`
	Interest    string `json:"interest"`
	Last        string `json:"last"`
	UsdPx       string `json:"usdPx"`
	Lever       string `json:"lever"`
	Liab        string `json:"liab"`
	LiabCcy     string `json:"liabCcy"`
	LiqPx       string `json:"liqPx"`
	MarkPx      string `json:"markPx"`
	Margin      string `json:"margin"`
	MgnMode     string `json:"mgnMode"`
	MgnRatio    string `json:"mgnRatio"`
	NMR         string `json:"nmr"`
	NotionalUsd string `json:"notionalUsd"`
	OptVal      string `json:"optVal"`
	PTime       string `json:"pTime"`
	Pos         string `json:"pos"`
	PosCcy      string `json:"posCcy"`
	PosID       string `json:"posId"`
	PosSide     string `json:"posSide"`
	ThetaBS     string `json:"thetaBS"`
	ThetaPA     string `json:"thetaPA"`
	TradeID     string `json:"tradeId"`
	UTime       string `json:"uTime"`
	Upl         string `json:"upl"`
	UplRatio    string `json:"uplRatio"`
	VegaBS      string `json:"vegaBS"`
	VegaPA      string `json:"vegaPA"`
}

type PositionsReq added in v0.5.4

type PositionsReq struct {
	*GetRequest
}

func NewPositionsReq added in v0.5.4

func NewPositionsReq() *PositionsReq

func (*PositionsReq) InstID added in v0.5.4

func (pr *PositionsReq) InstID(id string) *PositionsReq

func (*PositionsReq) InstType added in v0.5.4

func (pr *PositionsReq) InstType(typ string) *PositionsReq

func (*PositionsReq) PosID added in v0.5.4

func (pr *PositionsReq) PosID(id string) *PositionsReq

type RawDepth

type RawDepth struct {
	Asks     [][4]string `json:"asks"`
	Bids     [][4]string `json:"bids"`
	Ts       string      `json:"ts"`
	Checksum int32       `json:"checksum"`
}

RawDepth incremental depth push

type RestClient

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

func NewRestClient

func NewRestClient(key, secret, pass string) *RestClient

func NewTestRestClient

func NewTestRestClient(key, secret, pass string) *RestClient

func (*RestClient) AccountBalance

func (r *RestClient) AccountBalance(ctx context.Context, currency ...string) (*AccountBalance, error)

func (*RestClient) AssetBills added in v0.5.4

func (c *RestClient) AssetBills(ctx context.Context, req *AssetBillReq) ([]AssetBillRecord, error)

func (*RestClient) Bills

func (rc *RestClient) Bills(ctx context.Context, req *BillReq) ([]Bill, error)

func (*RestClient) Books

func (rc *RestClient) Books(ctx context.Context, instId string, sz string) (*Depth, error)

func (*RestClient) CancelOrder

func (rc *RestClient) CancelOrder(ctx context.Context, req *CancelOrderReq) (*CancelOrderResp, error)

func (*RestClient) CreateOrder

func (rc *RestClient) CreateOrder(ctx context.Context, req *CreateOrderReq) (*CreateOrderResp, error)

func (*RestClient) Currencies

func (c *RestClient) Currencies(ctx context.Context) ([]CurrencyResp, error)

func (*RestClient) FetchOrder

func (rc *RestClient) FetchOrder(ctx context.Context, req *FetchOrderReq) (*Order, error)

func (*RestClient) Fills

func (rc *RestClient) Fills(ctx context.Context, param *FillsReq) ([]Fill, error)

func (*RestClient) Finance

func (*RestClient) FundingRate added in v0.5.2

func (rc *RestClient) FundingRate(ctx context.Context, instID string) ([]FundingRate, error)

func (*RestClient) Instruments

func (rc *RestClient) Instruments(ctx context.Context, typ InstType) ([]Instrument, error)

func (*RestClient) InterestAccrued added in v0.4.0

func (rc *RestClient) InterestAccrued(ctx context.Context, iar *InterestAccruedReq) ([]InterestAccrued, error)

func (*RestClient) MarginSymbols added in v0.5.2

func (rc *RestClient) MarginSymbols(ctx context.Context) ([]exchange.MarginSymbol, error)

func (*RestClient) OrdersHistory added in v0.4.2

func (rc *RestClient) OrdersHistory(ctx context.Context, param *OrdersHistoryReq) ([]Order, error)

func (*RestClient) Positions added in v0.5.4

func (rc *RestClient) Positions(ctx context.Context, req *PositionsReq) ([]Positions, error)

func (*RestClient) Property

func (rc *RestClient) Property() exchange.Property

func (*RestClient) Request

func (rc *RestClient) Request(ctx context.Context, method string, endPoint string, params url.Values, body io.Reader, sign bool, dst interface{}) error

Request do okexv5 rest request. response data field will be store into dst

func (*RestClient) SpotSymbols added in v0.5.2

func (rc *RestClient) SpotSymbols(ctx context.Context) ([]exchange.SpotSymbol, error)

func (*RestClient) SubAccountBalances added in v0.5.4

func (rc *RestClient) SubAccountBalances(ctx context.Context, req *SubAccountBalancesReq) (*SubAccountBalancesResp, error)

func (*RestClient) SubAccountBills added in v0.5.4

func (rc *RestClient) SubAccountBills(ctx context.Context, req *SubAccountBillsReq) ([]SubAccountBill, error)

func (*RestClient) SubAccounts added in v0.5.4

func (rc *RestClient) SubAccounts(ctx context.Context) ([]SubAccount, error)

func (*RestClient) SwapSymbols added in v0.5.2

func (rc *RestClient) SwapSymbols(ctx context.Context) ([]exchange.SwapSymbol, error)

func (*RestClient) Symbols added in v0.5.2

func (rc *RestClient) Symbols(ctx context.Context) ([]exchange.Symbol, error)

Symbols return all spot + margin + swap symbols

func (*RestClient) Trades

func (rc *RestClient) Trades(ctx context.Context, req *exchange.TradeReqParam) ([]exchange.Trade, error)

func (*RestClient) Transfer

func (c *RestClient) Transfer(ctx context.Context, param *TransferParam) (*TransferResp, error)

func (*RestClient) WithdrawlHistory added in v0.5.4

func (c *RestClient) WithdrawlHistory(ctx context.Context, req *WithdrawlHistoryReq) ([]WithdrawlHistory, error)

type RestResponse

type RestResponse struct {
	Code string      `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

type SpotSymbol

type SpotSymbol struct {
	*exchange.BaseSpotSymbol
}

func (*SpotSymbol) String

func (ss *SpotSymbol) String() string

type SubAccount added in v0.5.4

type SubAccount struct {
	Enable  bool   `json:"enable"`
	SubAcct string `json:"subAcct"`
	Label   string `json:"label"`
	Mobile  string `json:"mobile"`
	GAuth   bool   `json:"gAuth"`
	TS      string `json:"ts"`
}

type SubAccountBalanceDetail added in v0.5.4

type SubAccountBalanceDetail struct {
	Ccy           string `json:"ccy"`
	Eq            string `json:"eq"`
	CashBal       string `json:"cashBal"`
	UTime         string `json:"uTime"`
	IsoEq         string `json:"isoEq"`
	AvailEq       string `json:"availEq"`
	DisEq         string `json:"disEq"`
	AvailBal      string `json:"availBal"`
	FrozenBal     string `json:"frozenBal"`
	OrdFrozen     string `json:"ordFrozen"`
	Liab          string `json:"liab"`
	Upl           string `json:"uplLiab"`
	CrossLiab     string `json:"crossLiab"`
	IsoLiab       string `json:"isoLiab"`
	MgnRatio      string `json:"mgnRatio"`
	Interest      string `json:"interest"`
	Twap          string `json:"twap"`
	MaxLoan       string `json:"maxLoan"`
	EqUsd         string `json:"eqUsd"`
	NotionalLever string `json:"notionalLever"`
}

type SubAccountBalancesReq added in v0.5.4

type SubAccountBalancesReq struct {
	*GetRequest
}

func NewBalancesReq added in v0.5.4

func NewBalancesReq(subAcct string) *SubAccountBalancesReq

type SubAccountBalancesResp added in v0.5.4

type SubAccountBalancesResp struct {
	AdjEq       string                    `json:"adjEq"`
	TotalEq     string                    `json:"totalEq"`
	IsoEq       string                    `json:"isoEq"`
	OrdFroz     string                    `json:"ordFroz"`
	Imr         string                    `json:"imr"`
	Mmr         string                    `json:"mmr"`
	MgnRatio    string                    `json:"mgnRatio"`
	NotionalUsd string                    `json:"notionalUsd"`
	UTime       string                    `json:"uTime"`
	Details     []SubAccountBalanceDetail `json:"details"`
}

type SubAccountBill added in v0.5.4

type SubAccountBill struct {
	BillID  string `json:"billId"`
	Type    string `json:"type"`
	Ccy     string `json:"ccy"`
	Amt     string `json:"amt"`
	SubAcct string `json:"subAcct"`
	TS      string `json:"ts"`
}

type SubAccountBillsReq added in v0.5.4

type SubAccountBillsReq struct {
	*GetRequest
}

func NewBillsReq added in v0.5.4

func NewBillsReq() *SubAccountBillsReq

func (*SubAccountBillsReq) AfterTime added in v0.5.4

func (br *SubAccountBillsReq) AfterTime(ts time.Time) *SubAccountBillsReq

func (*SubAccountBillsReq) BeforeTime added in v0.5.4

func (br *SubAccountBillsReq) BeforeTime(ts time.Time) *SubAccountBillsReq

func (*SubAccountBillsReq) Ccy added in v0.5.4

func (*SubAccountBillsReq) Limit added in v0.5.4

func (br *SubAccountBillsReq) Limit(lmt int) *SubAccountBillsReq

func (*SubAccountBillsReq) SubAcct added in v0.5.4

func (br *SubAccountBillsReq) SubAcct(at string) *SubAccountBillsReq

func (*SubAccountBillsReq) Type added in v0.5.4

type SwapSymbol

type SwapSymbol struct {
	*exchange.BaseSwapSymbol
}

func (*SwapSymbol) String

func (ss *SwapSymbol) String() string

type TDMode

type TDMode string

func (*TDMode) UnmarshalJSON

func (tm *TDMode) UnmarshalJSON(raw []byte) error

type Trade

type Trade struct {
	InstID  string    `json:"instId"`
	TradeID string    `json:"tradeId"`
	Px      string    `json:"px"`
	Sz      string    `json:"sz"`
	Side    OrderSide `json:"side"`
	Ts      string    `json:"ts"`
}

type TransferParam

type TransferParam struct {
	Ccy      string `json:"ccy"`
	Amt      string `json:"amt"`
	Type     string `json:"type"`
	From     string `json:"from"`
	To       string `json:"to"`
	SubAcct  string `json:"subAcct"`
	InstID   string `json:"instId"`
	ToInstID string `json:"toInstId"`
}

type TransferResp

type TransferResp struct {
	TransID string `json:"transId"`
	Ccy     string `json:"ccy"`
	From    string `json:"from"`
	Amt     string `json:"amt"`
	To      string `json:"to"`
}

type WSClient

type WSClient struct {
	*exchange.WSClient
	// contains filtered or unexported fields
}

func NewTestWSPublicClient

func NewTestWSPublicClient(data chan interface{}) *WSClient

func NewWSPublicClient

func NewWSPublicClient(data chan interface{}) *WSClient

func (*WSClient) Handle

func (ws *WSClient) Handle(ctx context.Context, notify *rpc.Notify)

func (*WSClient) Run

func (ws *WSClient) Run(ctx context.Context) error

func (*WSClient) Subscirbe

func (ws *WSClient) Subscirbe(ctx context.Context, channels ...exchange.Channel) error

func (*WSClient) UnSubscribe

func (ws *WSClient) UnSubscribe(ctx context.Context, channels ...exchange.Channel) error

type WithdrawlHistory added in v0.5.4

type WithdrawlHistory struct {
	Chain string `json:"chain"`
	Fee   string `json:"fee"`
	Ccy   string `json:"ccy"`
	Amt   string `json:"amt"`
	TxID  string `json:"txId"`
	From  string `json:"from"`
	To    string `json:"to"`
	State string `json:"state"`
	TS    string `json:"ts"`
	WdID  string `json:"wdId"`
}

type WithdrawlHistoryReq added in v0.5.4

type WithdrawlHistoryReq struct {
	*GetRequest
}

func NewWithdrawlHistoryReq added in v0.5.4

func NewWithdrawlHistoryReq() *WithdrawlHistoryReq

func (*WithdrawlHistoryReq) AfterTime added in v0.5.4

func (wr *WithdrawlHistoryReq) AfterTime(ts time.Time) *WithdrawlHistoryReq

func (*WithdrawlHistoryReq) Ccy added in v0.5.4

Jump to

Keyboard shortcuts

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