Documentation ¶
Index ¶
- Constants
- Variables
- type AccDetails
- type AccInfo
- type Account
- type AccountCategory
- type AccountType
- type BaseResponse
- type Borrow
- type BorrowItem
- type BorrowRes
- type CoinDetails
- type CoinGreekItem
- type CoinGreekRes
- type CoinGreeks
- type CollateralCoin
- type CollateralData
- type CollateralInfoResponse
- type CollateralResult
- type CollateralSwitch
- type EndpointsStruct
- type FeeRate
- type FeeRates
- type FeeRatesResponse
- type Info
- type LogEntry
- type LogResponse
- type MMPParams
- type MMPResponse
- type MMPStateItem
- type MMPStateResponse
- type Margin
- type SetMarginModeResponse
- type TimeInterval
- type TransactionLog
- type UnifiedUpdateMsg
- type UpgradeToUnified
- type UpgradeToUnifiedResponse
- type Wallet
- func (w Wallet) GetAllContractWalletBalance() (*WalletBalance, error)
- func (w Wallet) GetAllSpotWalletBalance() (*WalletBalance, error)
- func (w Wallet) GetAllUnifiedWalletBalance() (*WalletBalance, error)
- func (w Wallet) GetContractWalletBalance(coins ...string) (*WalletBalance, error)
- func (w Wallet) GetSpotWalletBalance(coins ...string) (*WalletBalance, error)
- func (w Wallet) GetUnifiedWalletBalance(coins ...string) (*WalletBalance, error)
- type WalletBalance
Constants ¶
const FeeRatesEndpoint = "/v5/account/fee-rate"
Variables ¶
var Endpoints = EndpointsStruct{
Borrow: "/v5/account/borrow-history",
CoinGreek: "/v5/asset/coin-greeks",
Collateral: "/v5/account/set-collateral-switch",
UpgradeToUnified: "/v5/account/upgrade-to-uta",
Wallet: "/v5/account/wallet-balance",
}
Functions ¶
This section is empty.
Types ¶
type AccDetails ¶
type AccDetails struct { TotalEquity string `json:"totalEquity"` AccountIMRate string `json:"accountIMRate"` TotalMarginBalance string `json:"totalMarginBalance"` TotalInitialMargin string `json:"totalInitialMargin"` AccountType string `json:"accountType"` TotalAvailableBalance string `json:"totalAvailableBalance"` AccountMMRate string `json:"accountMMRate"` TotalPerpUPL string `json:"totalPerpUPL"` TotalWalletBalance string `json:"totalWalletBalance"` AccountLTV string `json:"accountLTV"` TotalMaintenanceMargin string `json:"totalMaintenanceMargin"` Coin []CoinDetails `json:"coin"` }
type AccInfo ¶
type AccInfo struct { UnifiedMarginStatus int `json:"unifiedMarginStatus"` MarginMode string `json:"marginMode"` DcpStatus string `json:"dcpStatus"` TimeWindow int `json:"timeWindow"` SmpGroup int `json:"smpGroup"` IsMasterTrader bool `json:"isMasterTrader"` UpdatedTime string `json:"updatedTime"` }
AccInfo represents the response from the /v5/account/info endpoint.
type Account ¶
type Account interface { Wallet() *Wallet UpgradeToUnified() *UpgradeToUnified Borrow() *Borrow Collateral() *CollateralCoin CoinGreek() *CoinGreeks FeeRates() *FeeRates Info() *Info TransactionLog() *TransactionLog Margin() *Margin }
type AccountCategory ¶
type AccountCategory int
func (AccountCategory) String ¶
func (a AccountCategory) String() string
type AccountType ¶
type AccountType string
const ( Unified AccountType = "UNIFIED" Contract AccountType = "CONTRACT" Spot AccountType = "SPOT" )
type BaseResponse ¶
type BaseResponse struct { RetCode int `json:"retCode"` RetMsg string `json:"retMsg"` Time int64 `json:"time"` RetExtInfo map[string]interface{} `json:"retExtInfo"` }
BaseResponse is a generic struct used to parse the common response received from Bybit API
type BorrowItem ¶
type BorrowRes ¶
type BorrowRes struct { BaseResponse Result struct { NextPageCursor string `json:"nextPageCursor"` List []BorrowItem `json:"list"` } }
type CoinDetails ¶
type CoinDetails struct { AvailableToBorrow string `json:"availableToBorrow"` Bonus string `json:"bonus"` AccruedInterest string `json:"accruedInterest"` AvailableToWithdraw string `json:"availableToWithdraw"` TotalOrderIM string `json:"totalOrderIM"` Equity string `json:"equity"` TotalPositionMM string `json:"totalPositionMM"` UsdValue string `json:"usdValue"` UnrealisedPnl string `json:"unrealisedPnl"` CollateralSwitch bool `json:"collateralSwitch"` BorrowAmount string `json:"borrowAmount"` TotalPositionIM string `json:"totalPositionIM"` WalletBalance string `json:"walletBalance"` CumRealisedPnl string `json:"cumRealisedPnl"` Locked string `json:"locked"` MarginCollateral bool `json:"marginCollateral"` Coin string `json:"coin"` }
type CoinGreekItem ¶
type CoinGreekRes ¶
type CoinGreekRes struct { BaseResponse Result struct { List []CoinGreekItem `json:"list"` } }
type CoinGreeks ¶
type CoinGreeks struct {
// contains filtered or unexported fields
}
func NewCoinGreeks ¶
func NewCoinGreeks(client_ *client.Client) *CoinGreeks
func (*CoinGreeks) Get ¶
func (cg *CoinGreeks) Get(coin string) (*CoinGreekRes, error)
type CollateralCoin ¶
type CollateralCoin struct {
// contains filtered or unexported fields
}
func NewSetCollateralCoin ¶
func NewSetCollateralCoin(c *client.Client) *CollateralCoin
func (*CollateralCoin) GetInfo ¶
func (s *CollateralCoin) GetInfo(currency string) (*CollateralInfoResponse, error)
func (*CollateralCoin) Set ¶
func (s *CollateralCoin) Set(coin string, collateralSwitch CollateralSwitch) (*CollateralInfoResponse, error)
type CollateralData ¶
type CollateralData struct { CollateralSwitch bool `json:"collateralSwitch"` BorrowAmount string `json:"borrowAmount"` AvailableToBorrow string `json:"availableToBorrow"` FreeBorrowingAmount string `json:"freeBorrowingAmount"` Borrowable bool `json:"borrowable"` Currency string `json:"currency"` MaxBorrowingAmount string `json:"maxBorrowingAmount"` HourlyBorrowRate string `json:"hourlyBorrowRate"` BorrowUsageRate string `json:"borrowUsageRate"` MarginCollateral bool `json:"marginCollateral"` CollateralRatio string `json:"collateralRatio"` }
type CollateralInfoResponse ¶
type CollateralInfoResponse struct { BaseResponse Result CollateralResult }
type CollateralResult ¶
type CollateralResult struct {
List []CollateralData `json:"list"`
}
type CollateralSwitch ¶
type CollateralSwitch string
const ( ON CollateralSwitch = "ON" OFF CollateralSwitch = "OFF" )
AccountCategory constants using iota
type EndpointsStruct ¶
type FeeRates ¶
type FeeRates struct {
// contains filtered or unexported fields
}
func NewFeeRates ¶
func (*FeeRates) GetFeeRate ¶
func (fr *FeeRates) GetFeeRate(category string, symbol, baseCoin string) (*FeeRatesResponse, error)
type FeeRatesResponse ¶
type FeeRatesResponse struct { BaseResponse Result struct { List []FeeRate } }
type LogEntry ¶
type LogEntry struct { ID string `json:"id"` Symbol string `json:"symbol"` Category string `json:"category"` Side string `json:"side"` TransactionTime string `json:"transactionTime"` Type string `json:"type"` Qty string `json:"qty"` Size string `json:"size"` Currency string `json:"currency"` TradePrice string `json:"tradePrice"` Funding string `json:"funding"` Fee string `json:"fee"` CashFlow string `json:"cashFlow"` Change string `json:"change"` CashBalance string `json:"cashBalance"` FeeRate string `json:"feeRate"` BonusChange string `json:"bonusChange"` TradeID string `json:"tradeId"` OrderID string `json:"orderId"` OrderLinkID string `json:"orderLinkId"` }
LogEntry represents a single log entry returned by the API
type LogResponse ¶
type LogResponse struct { List []LogEntry `json:"list"` NextPageCursor string `json:"nextPageCursor"` }
LogResponse represents the response from the /v5/account/transaction-log endpoint
type MMPParams ¶
type MMPParams struct { BaseCoin string `json:"baseCoin"` Window int `json:"window"` // Assuming Window is a number representing milliseconds FrozenPeriod int `json:"frozenPeriod"` // Assuming FrozenPeriod is a number representing milliseconds QtyLimit int `json:"qtyLimit"` // Assuming QtyLimit is an integer representing quantity DeltaLimit int `json:"deltaLimit"` // Assuming DeltaLimit is an integer representing delta }
MMPParams represents the parameters needed to set Market Maker Protection.
type MMPResponse ¶
type MMPResponse struct {
BaseResponse
}
MMPResponse represents the response from setting the Market Maker Protection.
type MMPStateItem ¶
type MMPStateItem struct { BaseCoin string `json:"baseCoin"` MMPEnabled bool `json:"mmpEnabled"` Window string `json:"window"` FrozenPeriod string `json:"frozenPeriod"` QtyLimit string `json:"qtyLimit"` DeltaLimit string `json:"deltaLimit"` MMPFrozenUntil string `json:"mmpFrozenUntil"` MMPFrozen bool `json:"mmpFrozen"` }
type MMPStateResponse ¶
type MMPStateResponse struct { BaseResponse Result struct { List []MMPStateItem `json:"result"` } }
type Margin ¶
type Margin struct {
// contains filtered or unexported fields
}
func (*Margin) GetMMPState ¶
func (m *Margin) GetMMPState(baseCoin string) (*MMPStateResponse, error)
func (*Margin) SetMMP ¶
func (m *Margin) SetMMP(params *MMPParams) (*MMPResponse, error)
SetMMP sets the Market Maker Protection for the client.
func (*Margin) SetMarginMode ¶
func (m *Margin) SetMarginMode(mode string) (*SetMarginModeResponse, error)
type SetMarginModeResponse ¶
type SetMarginModeResponse struct { BaseResponse Result struct { Reasons []struct { ReasonCode string `json:"reasonCode"` ReasonMsg string `json:"reasonMsg"` } `json:"reasons"` } `json:"result"` }
type TimeInterval ¶
type TimeInterval int
func (TimeInterval) String ¶
func (ti TimeInterval) String() string
type TransactionLog ¶
type TransactionLog struct {
// contains filtered or unexported fields
}
TransactionLog holds a client instance
func NewTransactionLog ¶
func NewTransactionLog(client_ *client.Client) *TransactionLog
NewTransactionLog initializes a new TransactionLog object with a client instance.
func (*TransactionLog) Get ¶
func (tl *TransactionLog) Get(params map[string]string) (*LogResponse, error)
Get sends a GET request to the /v5/account/transaction-log endpoint to retrieve transaction logs.
type UnifiedUpdateMsg ¶
type UnifiedUpdateMsg struct {
Msg []string `json:"msg"`
}
type UpgradeToUnified ¶
type UpgradeToUnified struct {
// contains filtered or unexported fields
}
func NewUpgradeToUnifiedRequest ¶
func NewUpgradeToUnifiedRequest(c *client.Client) *UpgradeToUnified
func (*UpgradeToUnified) Upgrade ¶
func (r *UpgradeToUnified) Upgrade() (*UpgradeToUnifiedResponse, error)
type UpgradeToUnifiedResponse ¶
type UpgradeToUnifiedResponse struct { BaseResponse Result struct { UnifiedUpdateStatus string `json:"unifiedUpdateStatus"` UnifiedUpdateMsg UnifiedUpdateMsg `json:"unifiedUpdateMsg"` } }
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func (Wallet) GetAllContractWalletBalance ¶
func (w Wallet) GetAllContractWalletBalance() (*WalletBalance, error)
func (Wallet) GetAllSpotWalletBalance ¶
func (w Wallet) GetAllSpotWalletBalance() (*WalletBalance, error)
func (Wallet) GetAllUnifiedWalletBalance ¶
func (w Wallet) GetAllUnifiedWalletBalance() (*WalletBalance, error)
func (Wallet) GetContractWalletBalance ¶
func (w Wallet) GetContractWalletBalance(coins ...string) (*WalletBalance, error)
func (Wallet) GetSpotWalletBalance ¶
func (w Wallet) GetSpotWalletBalance(coins ...string) (*WalletBalance, error)
func (Wallet) GetUnifiedWalletBalance ¶
func (w Wallet) GetUnifiedWalletBalance(coins ...string) (*WalletBalance, error)
type WalletBalance ¶
type WalletBalance struct { BaseResponse Result struct { List []AccDetails `json:"list"` } }