margin

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// https://binance-docs.github.io/apidocs/spot/en/#get-all-cross-margin-pairs-market_data
	EndpointAllMarginPairs = "/sapi/v1/margin/allPairs"
)
View Source
const (
	// https://binance-docs.github.io/apidocs/spot/en/#query-margin-priceindex-market_data
	EndpointPriceIndex = "/sapi/v1/margin/priceIndex"
)
View Source
const (
	// https://binance-docs.github.io/apidocs/spot/en/#query-loan-record-user_data
	EndpointQueryLoanRecord = "/sapi/v1/margin/loan"
)
View Source
const (
	// https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-open-oco-user_data
	EndpointQueryOpenOCO = "/sapi/v1/margin/openOrderList"
)

Variables

This section is empty.

Functions

func AccountDetailsData added in v0.1.0

func AccountDetailsData(connRest ConnectorRest, parm AccountDetailsParam) ([]byte, error)

func AllMarginPairsData added in v0.1.0

func AllMarginPairsData(connRest ConnectorRest) ([]byte, error)

func NewOrderData added in v0.1.0

func NewOrderData(connRest ConnectorRest, parm NewOrderParam) ([]byte, error)

func PriceIndexData added in v0.1.0

func PriceIndexData(connRest ConnectorRest, parm PriceIndexParam) ([]byte, error)

func QueryLoanRecordData added in v0.1.0

func QueryLoanRecordData(connRest ConnectorRest, parm QueryLoanRecordParam) ([]byte, error)

func QueryOpenOCOData added in v0.1.0

func QueryOpenOCOData(connRest ConnectorRest, parm QueryOpenOCOParam) ([]byte, error)

func QueryOrderData added in v0.1.0

func QueryOrderData(connRest ConnectorRest, parm QueryOrderParam) ([]byte, error)

func RepayData added in v0.1.0

func RepayData(connRest ConnectorRest, parm RepayParam) ([]byte, error)

Types

type AccountDetailsParam added in v0.1.0

type AccountDetailsParam struct {
	RecvWindow int // optional
}

type AccountDetailsResp added in v0.1.0

type AccountDetailsResp struct {
	BorrowEnabled       bool   `json:"borrowEnabled"`
	TotalAssetOfBtc     string `json:"totalAssetOfBtc"`
	TotalLiabilityOfBtc string `json:"totalLiabilityOfBtc"`
	TotalNetAssetOfBtc  string `json:"totalNetAssetOfBtc"`
	TradeEnabled        bool   `json:"tradeEnabled"`
	TransferEnabled     bool   `json:"transferEnabled"`
	UserAssets          []struct {
		Asset    string `json:"asset"`
		Borrowed string `json:"borrowed"`
		Free     string `json:"free"`
		Interest string `json:"interest"`
		Locked   string `json:"locked"`
		NetAsset string `json:"netAsset"`
	} `json:"userAssets"`
}

func AccountDetails added in v0.1.0

func AccountDetails(connRest ConnectorRest, parm AccountDetailsParam) (AccountDetailsResp, error)

type AllMarginPairsResp added in v0.1.0

type AllMarginPairsResp []struct {
	Base          string `json:"base"`
	ID            int64  `json:"id"`
	IsBuyAllowed  bool   `json:"isBuyAllowed"`
	IsMarginTrade bool   `json:"isMarginTrade"`
	IsSellAllowed bool   `json:"isSellAllowed"`
	Quote         string `json:"quote"`
	Symbol        string `json:"symbol"`
}

func AllMarginPairs added in v0.1.0

func AllMarginPairs(connRest ConnectorRest) (AllMarginPairsResp, error)

type NewOrderParam

type NewOrderParam struct {
	Symbol           string           `structs:"symbol"`
	IsIsolated       string           `structs:"isIsolated,omitempty"` // optional
	Side             OrderSideType    `structs:"side"`
	Type             OrderType        `structs:"type"`
	Quantity         string           `structs:"quantity,omitempty"`         // optional
	QuoteOrderQty    string           `structs:"quoteOrderQty,omitempty"`    // optional
	Price            string           `structs:"price,omitempty"`            // optional
	StopPrice        string           `structs:"stopPrice,omitempty"`        // optional
	NewClientOrderId string           `structs:"newClientOrderId,omitempty"` // optional
	IcebergQty       float64          `structs:"icebergQty,omitempty"`       // optional
	NewOrderRespType NewOrderRespType `structs:"newOrderRespType,omitempty"` // optional
	SideEffectType   SideEffectType   `structs:"sideEffectType,omitempty"`   // optional
	TimeInForce      TimeInForceType  `structs:"timeInForce,omitempty"`      // optional
	RecvWindow       int              `structs:"-"`                          // optional
}

type NewOrderResp

type NewOrderResp struct {
	Symbol                string `json:"symbol"`
	OrderID               int64  `json:"orderId"`
	ClientOrderID         string `json:"clientOrderId"`
	TransactTime          int64  `json:"transactTime"`
	Price                 string `json:"price"`
	OrigQty               string `json:"origQty"`
	ExecutedQty           string `json:"executedQty"`
	CummulativeQuoteQty   string `json:"cummulativeQuoteQty"`
	Status                string `json:"status"`
	TimeInForce           string `json:"timeInForce"`
	Type                  string `json:"type"`
	Side                  string `json:"side"`
	MarginBuyBorrowAmount string `json:"marginBuyBorrowAmount"`
	MarginBuyBorrowAsset  string `json:"marginBuyBorrowAsset"`
	IsIsolated            bool   `json:"isIsolated"`
	Fills                 []struct {
		Price           string `json:"price"`
		Qty             string `json:"qty"`
		Commission      string `json:"commission"`
		CommissionAsset string `json:"commissionAsset"`
	} `json:"fills"`
}

func NewOrder

func NewOrder(connRest ConnectorRest, parm NewOrderParam) (NewOrderResp, error)

type PriceIndexParam

type PriceIndexParam struct {
	Symbol string `structs:"symbol"`
}

type PriceIndexResp

type PriceIndexResp struct {
	CalcTime int64  `json:"calcTime"`
	Price    string `json:"price"`
	Symbol   string `json:"symbol"`
}

func PriceIndex

func PriceIndex(connRest ConnectorRest, parm PriceIndexParam) (PriceIndexResp, error)

type QueryLoanRecordParam

type QueryLoanRecordParam struct {
	Asset          string  `structs:"asset"`
	IsolatedSymbol string  `structs:"isolatedSymbol,omitempty"` // optional
	TxId           float64 `structs:"txId,omitempty"`           // optional
	StartTime      float64 `structs:"startTime,omitempty"`      // optional
	EndTime        float64 `structs:"endTime,omitempty"`        // optional
	Current        float64 `structs:"current,omitempty"`        // optional
	Size           float64 `structs:"size,omitempty"`           // optional
	Archived       string  `structs:"archived,omitempty"`       // optional
	RecvWindow     int     `structs:"-"`                        // optional
}

type QueryLoanRecordResp

type QueryLoanRecordResp struct {
	Rows []struct {
		IsolatedSymbol string `json:"isolatedSymbol"`
		TxID           int64  `json:"txId"`
		Asset          string `json:"asset"`
		Principal      string `json:"principal"`
		Timestamp      int64  `json:"timestamp"`
		Status         string `json:"status"`
	} `json:"rows"`
	Total int `json:"total"`
}

func QueryLoanRecord

func QueryLoanRecord(connRest ConnectorRest, parm QueryLoanRecordParam) (QueryLoanRecordResp, error)

type QueryOpenOCOParam

type QueryOpenOCOParam struct {
	IsIsolated string `structs:"isIsolated,omitempty"` // optional
	Symbol     string `structs:"symbol,omitempty"`     // optional
	RecvWindow int    `structs:"-"`                    // optional
}

type QueryOpenOCOResp

type QueryOpenOCOResp []struct {
	OrderListID       int    `json:"orderListId"`
	ContingencyType   string `json:"contingencyType"`
	ListStatusType    string `json:"listStatusType"`
	ListOrderStatus   string `json:"listOrderStatus"`
	ListClientOrderID string `json:"listClientOrderId"`
	TransactionTime   int64  `json:"transactionTime"`
	Symbol            string `json:"symbol"`
	IsIsolated        bool   `json:"isIsolated"`
	Orders            []struct {
		Symbol        string `json:"symbol"`
		OrderID       int    `json:"orderId"`
		ClientOrderID string `json:"clientOrderId"`
	} `json:"orders"`
}

func QueryOpenOCO

func QueryOpenOCO(connRest ConnectorRest, parm QueryOpenOCOParam) (QueryOpenOCOResp, error)

type QueryOrderParam

type QueryOrderParam struct {
	Symbol            string `structs:"symbol"`
	IsIsolated        string `structs:"isIsolated,omitempty"`        // optional
	OrderId           int64  `structs:"orderId,omitempty"`           // optional
	OrigClientOrderId string `structs:"origClientOrderId,omitempty"` // optional
	RecvWindow        int    `structs:"-"`                           // optional
}

type QueryOrderResp

type QueryOrderResp struct {
	ClientOrderID       string                `json:"clientOrderId"`
	CummulativeQuoteQty string                `json:"cummulativeQuoteQty"`
	ExecutedQty         string                `json:"executedQty"`
	IcebergQty          string                `json:"icebergQty"`
	IsWorking           bool                  `json:"isWorking"`
	OrderID             int64                 `json:"orderId"`
	OrigQty             string                `json:"origQty"`
	Price               string                `json:"price"`
	Side                string                `json:"side"`
	Status              enums.OrderStatusType `json:"status"`
	StopPrice           string                `json:"stopPrice"`
	Symbol              string                `json:"symbol"`
	IsIsolated          bool                  `json:"isIsolated"`
	Time                int64                 `json:"time"`
	TimeInForce         string                `json:"timeInForce"`
	Type                string                `json:"type"`
	UpdateTime          int64                 `json:"updateTime"`
}

func QueryOrder

func QueryOrder(connRest ConnectorRest, parm QueryOrderParam) (QueryOrderResp, error)

type RepayParam added in v0.1.0

type RepayParam struct {
	Asset      string `structs:"asset"`
	IsIsolated string `structs:"isIsolated,omitempty"` // optional
	Symbol     string `structs:"symbol,omitempty"`     // optional
	Amount     string `structs:"amount"`
	RecvWindow int    `structs:"-"` // optional
}

type RepayResp added in v0.1.0

type RepayResp struct {
	TranID int `json:"tranId"`
}

func Repay added in v0.1.0

func Repay(connRest ConnectorRest, parm RepayParam) (RepayResp, error)

Jump to

Keyboard shortcuts

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