bitget

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

bitget\GetAccount.go

do_request.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildGetParams

func BuildGetParams(params map[string]string) string

Types

type BitgetClient

type BitgetClient struct {
	APIKey     string
	APISecret  string
	Passphrase string

	HTTPClient *http.Client
	BaseURL    string // e.g. "https://api.bitget.com"
	// contains filtered or unexported fields
}

BitgetClient holds the credentials and an HTTP client.

func NewBitgetClient

func NewBitgetClient(apiKey, apiSecret, passphrase string) *BitgetClient

NewBitgetClient creates a new BitgetClient.

func (*BitgetClient) BatchCancelOrders

BatchCancelOrders sends a batch cancel order request to Bitget's exchange API. It takes a BatchCancelOrderRequest and API credentials, then returns the parsed BatchCancelOrderResponse or an error.

func (*BitgetClient) BatchPlaceOrder

BatchPlaceOrder sends a batch order request to Bitget's exchange API. It accepts a BatchOrderRequest and API credentials, then returns the parsed BatchPlaceOrderResponse or an error.

func (*BitgetClient) CancelAllOrders

CancelAllOrders sends a cancel-all-orders request to Bitget's API. It accepts a CancelAllOrdersRequest and API credentials, returning a CancelAllOrdersResponse or an error.

func (*BitgetClient) CancelOrder

CancelOrder sends a cancel order request to Bitget's exchange API. It takes a CancelOrderRequest and API credentials, then returns the parsed CancelOrderResponse or an error.

func (*BitgetClient) ClosePositions

ClosePositions sends a request to close positions at market price. It accepts a ClosePositionsRequest and API credentials, returning the parsed response or an error.

func (*BitgetClient) GetAccount

func (*BitgetClient) GetLimiter

func (c *BitgetClient) GetLimiter(uid string) *rate.Limiter

func (*BitgetClient) GetOrderDetail

GetOrderDetail sends a GET request to Bitget's order detail endpoint. It accepts an OrderDetailRequest and API credentials, then returns the parsed OrderDetailResponse or an error.

func (*BitgetClient) GetOrderFillHistory

GetOrderFillHistory sends a GET request to Bitget's historical order fill endpoint. It accepts an OrderFillHistoryRequest and API credentials, then returns the parsed OrderFillHistoryResponse or an error.

func (*BitgetClient) GetOrderFills

GetOrderFills sends a GET request to Bitget's order fills endpoint to retrieve order fill details. It accepts an OrderFillsRequest and API credentials, returning the parsed OrderFillsResponse or an error.

func (*BitgetClient) GetOrdersHistory

GetOrdersHistory sends a GET request to Bitget's "orders-history" endpoint to retrieve historical orders. It accepts an OrdersHistoryRequest and API credentials, and returns the parsed OrdersHistoryResponse or an error.

func (*BitgetClient) GetPendingOrders

GetPendingOrders sends a GET request to Bitget's "orders-pending" endpoint to query all existing pending orders. It accepts an OrdersPendingRequest and API credentials, and returns the parsed OrdersPendingResponse or an error.

func (*BitgetClient) GetSinglePosition

GetSinglePosition sends a GET request to retrieve position information for a single symbol.

func (*BitgetClient) GetTicker

func (*BitgetClient) ModifyOrder

ModifyOrder sends a modify order request to Bitget's exchange API. It takes a ModifyOrderRequest and API credentials, and returns the parsed ModifyOrderResponse or an error.

func (*BitgetClient) PlaceOrder

PlaceOrder sends a place order request to Bitget's exchange API. It takes a PlaceOrderRequest and API credentials, and returns the parsed PlaceOrderResponse or an error.

func (*BitgetClient) PlaceTpslOrder

PlaceTpslOrder sends a stop-profit and stop-loss plan order request to Bitget's API. It accepts a PlaceTpslOrderRequest and returns the parsed PlaceTpslOrderResponse or an error.

func (*BitgetClient) SetLeverage

SetLeverage sends a request to adjust the leverage for a given symbol, productType, and marginCoin.

func (*BitgetClient) SignPayload

func (c *BitgetClient) SignPayload(method, requestPath, body, timestamp string) string

SignPayload implements the Bitget HMAC SHA256 signing process for a request.

func (*BitgetClient) SimultaneousPlacePosTpslOrder

type BitgetWsClient

type BitgetWsClient struct {
	APIKey     string
	APISecret  string
	Passphrase string

	WsConn    *websocket.Conn
	BaseWsURL string // e.g. "wss://ws.bitget.com/v2/ws/public"
	// contains filtered or unexported fields
}

BitgetWsClient holds the credentials (if needed), the WebSocket connection, and endpoint info.

func NewBitgetWsClient

func NewBitgetWsClient(apiKey, apiSecret, passphrase string) *BitgetWsClient

NewBitgetWsClient creates a new BitgetWsClient.

func (*BitgetWsClient) Close

func (c *BitgetWsClient) Close() error

Close closes the WebSocket connection.

func (*BitgetWsClient) Connect

func (c *BitgetWsClient) Connect() error

func (*BitgetWsClient) ListenLoop

func (c *BitgetWsClient) ListenLoop(
	subReq *bitget_models.CandleSubscriptionRequest,
	callback func(pushData bitget_models.CandlePushData),
)

func (*BitgetWsClient) ReadMessage

func (c *BitgetWsClient) ReadMessage() (bitget_models.CandlePushData, error)

GetOrderFillMessage is your existing ReadMessage method adapted for ws client.

func (*BitgetWsClient) Stop

func (c *BitgetWsClient) Stop()

func (*BitgetWsClient) SubscribeCandles

func (c *BitgetWsClient) SubscribeCandles(req *bitget_models.CandleSubscriptionRequest) error

SubscribeCandles sends the subscription message.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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