bitgetapi

package
v1.53.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: AGPL-3.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponse

type APIResponse = bitgetapi.APIResponse

type Client

type Client struct {
	Client requestgen.AuthenticatedAPIClient
}

func NewClient

func NewClient(client *bitgetapi.RestClient) *Client

func (*Client) NewGetHistoryOrdersRequest

func (c *Client) NewGetHistoryOrdersRequest() *GetHistoryOrdersRequest

func (*Client) NewGetUnfilledOrdersRequest

func (c *Client) NewGetUnfilledOrdersRequest() *GetUnfilledOrdersRequest

type FeeDetail

type FeeDetail struct {
	// NewFees should have a value because when I was integrating, it already prompted,
	// "If there is no 'newFees' field, this data represents earlier historical data."
	NewFees struct {
		// Amount deducted by coupons, unit:currency obtained from the transaction.
		DeductedByCoupon fixedpoint.Value `json:"c"`
		// Amount deducted in BGB (Bitget Coin), unit:BGB
		DeductedInBGB fixedpoint.Value `json:"d"`
		// If the BGB balance is insufficient to cover the fees, the remaining amount is deducted from the
		//currency obtained from the transaction.
		DeductedFromCurrency fixedpoint.Value `json:"r"`
		// The total fee amount to be paid, unit :currency obtained from the transaction.
		ToBePaid fixedpoint.Value `json:"t"`
		// ignored
		Deduction bool `json:"deduction"`
		// ignored
		TotalDeductionFee fixedpoint.Value `json:"totalDeductionFee"`
	} `json:"newFees"`
}

type GetHistoryOrdersRequest

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

func (*GetHistoryOrdersRequest) Do

func (*GetHistoryOrdersRequest) EndTime

func (*GetHistoryOrdersRequest) GetParameters

func (g *GetHistoryOrdersRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetHistoryOrdersRequest) GetParametersJSON

func (g *GetHistoryOrdersRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetHistoryOrdersRequest) GetParametersQuery

func (g *GetHistoryOrdersRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetHistoryOrdersRequest) GetQueryParameters

func (g *GetHistoryOrdersRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetHistoryOrdersRequest) GetSlugParameters

func (g *GetHistoryOrdersRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetHistoryOrdersRequest) GetSlugsMap

func (g *GetHistoryOrdersRequest) GetSlugsMap() (map[string]string, error)

func (*GetHistoryOrdersRequest) IdLessThan

func (g *GetHistoryOrdersRequest) IdLessThan(idLessThan string) *GetHistoryOrdersRequest

func (*GetHistoryOrdersRequest) Limit

func (*GetHistoryOrdersRequest) OrderId

func (*GetHistoryOrdersRequest) StartTime

func (g *GetHistoryOrdersRequest) StartTime(startTime int64) *GetHistoryOrdersRequest

func (*GetHistoryOrdersRequest) Symbol

type GetUnfilledOrdersRequest

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

func (*GetUnfilledOrdersRequest) Do

func (*GetUnfilledOrdersRequest) EndTime

func (*GetUnfilledOrdersRequest) GetParameters

func (g *GetUnfilledOrdersRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetUnfilledOrdersRequest) GetParametersJSON

func (g *GetUnfilledOrdersRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetUnfilledOrdersRequest) GetParametersQuery

func (g *GetUnfilledOrdersRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetUnfilledOrdersRequest) GetQueryParameters

func (g *GetUnfilledOrdersRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetUnfilledOrdersRequest) GetSlugParameters

func (g *GetUnfilledOrdersRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetUnfilledOrdersRequest) GetSlugsMap

func (g *GetUnfilledOrdersRequest) GetSlugsMap() (map[string]string, error)

func (*GetUnfilledOrdersRequest) IdLessThan

func (g *GetUnfilledOrdersRequest) IdLessThan(idLessThan string) *GetUnfilledOrdersRequest

func (*GetUnfilledOrdersRequest) Limit

func (*GetUnfilledOrdersRequest) OrderId

func (*GetUnfilledOrdersRequest) StartTime

func (g *GetUnfilledOrdersRequest) StartTime(startTime int64) *GetUnfilledOrdersRequest

func (*GetUnfilledOrdersRequest) Symbol

type OrderDetail

type OrderDetail struct {
	UserId types.StrInt64 `json:"userId"`
	Symbol string         `json:"symbol"`
	// OrderId are always numeric. It's confirmed with official customer service. https://t.me/bitgetOpenapi/24172
	OrderId       types.StrInt64   `json:"orderId"`
	ClientOrderId string           `json:"clientOid"`
	Price         fixedpoint.Value `json:"price"`
	// Size is base coin when orderType=limit; quote coin when orderType=market
	Size             fixedpoint.Value `json:"size"`
	OrderType        OrderType        `json:"orderType"`
	Side             SideType         `json:"side"`
	Status           OrderStatus      `json:"status"`
	PriceAvg         fixedpoint.Value `json:"priceAvg"`
	BaseVolume       fixedpoint.Value `json:"baseVolume"`
	QuoteVolume      fixedpoint.Value `json:"quoteVolume"`
	EnterPointSource string           `json:"enterPointSource"`
	// The value is json string, so we unmarshal it after unmarshal OrderDetail
	FeeDetailRaw string                     `json:"feeDetail"`
	OrderSource  string                     `json:"orderSource"`
	CTime        types.MillisecondTimestamp `json:"cTime"`
	UTime        types.MillisecondTimestamp `json:"uTime"`

	FeeDetail FeeDetail
}

func (*OrderDetail) UnmarshalJSON

func (o *OrderDetail) UnmarshalJSON(data []byte) error

type OrderForce

type OrderForce string
const (
	OrderForceGTC      OrderForce = "gtc"
	OrderForcePostOnly OrderForce = "post_only"
	OrderForceFOK      OrderForce = "fok"
	OrderForceIOC      OrderForce = "ioc"
)

type OrderStatus

type OrderStatus string
const (
	OrderStatusInit          OrderStatus = "init"
	OrderStatusNew           OrderStatus = "new"
	OrderStatusLive          OrderStatus = "live"
	OrderStatusPartialFilled OrderStatus = "partially_filled"
	OrderStatusFilled        OrderStatus = "filled"
	OrderStatusCancelled     OrderStatus = "cancelled"
)

func (OrderStatus) IsWorking

func (o OrderStatus) IsWorking() bool

type OrderType

type OrderType string
const (
	OrderTypeLimit  OrderType = "limit"
	OrderTypeMarket OrderType = "market"
)

type SideType

type SideType string
const (
	SideTypeBuy  SideType = "buy"
	SideTypeSell SideType = "sell"
)

type UnfilledOrder

type UnfilledOrder struct {
	UserId types.StrInt64 `json:"userId"`
	Symbol string         `json:"symbol"`
	// OrderId are always numeric. It's confirmed with official customer service. https://t.me/bitgetOpenapi/24172
	OrderId       types.StrInt64   `json:"orderId"`
	ClientOrderId string           `json:"clientOid"`
	PriceAvg      fixedpoint.Value `json:"priceAvg"`
	// Size is base coin when orderType=limit; quote coin when orderType=market
	Size             fixedpoint.Value           `json:"size"`
	OrderType        OrderType                  `json:"orderType"`
	Side             SideType                   `json:"side"`
	Status           OrderStatus                `json:"status"`
	BasePrice        fixedpoint.Value           `json:"basePrice"`
	BaseVolume       fixedpoint.Value           `json:"baseVolume"`
	QuoteVolume      fixedpoint.Value           `json:"quoteVolume"`
	EnterPointSource string                     `json:"enterPointSource"`
	OrderSource      string                     `json:"orderSource"`
	CTime            types.MillisecondTimestamp `json:"cTime"`
	UTime            types.MillisecondTimestamp `json:"uTime"`
}

Jump to

Keyboard shortcuts

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