Documentation
¶
Index ¶
- Constants
- func FormatTimestamp(t time.Time) int64
- func GetCurrentTime() int64
- func PrettyPrint(i interface{}) string
- type AccountClient
- func (s *AccountClient) GetAccountInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AccountClient) GetAccountWallet(ctx context.Context, opts ...RequestOption) (*models.GetWalletBalanceResponse, error)
- func (s *AccountClient) GetBorrowHistory(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AccountClient) GetCoinGreeks(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AccountClient) GetCollateralInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AccountClient) GetFeeRates(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AccountClient) GetMMPState(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AccountClient) GetTransactionLog(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AccountClient) ResetMarketMakerProtection(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AccountClient) SetCollateralCoin(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AccountClient) SetMarginMode(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AccountClient) SetMarketMakerProtection(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AccountClient) SetSpotHedgeMode(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AccountClient) UpgradeToUTA(ctx context.Context, opts ...RequestOption) ([]byte, error)
- type AssetClient
- func (s *AssetClient) CancelWithdrawAsset(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) CreateInternalTransfer(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) CreateUniversalTransfer(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetAllCoinsBalance(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetAllowedDepositCoin(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetAssetInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetAssetOrderRecord(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetCoinInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetDeliveryRecord(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetDepositRecords(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetInternalDepositRecords(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetInternalTransfer(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetMasterDepositAddress(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetSingleCoinsBalance(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetSubDepositAddress(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetSubDepositRecords(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetSubUids(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetTransferableCoin(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetUniversalTransfer(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetUsdcSettlement(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetWithdrawalAmount(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) GetWithdrawalRecords(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) SetDepositAccount(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *AssetClient) WithdrawAsset(ctx context.Context, opts ...RequestOption) ([]byte, error)
- type BrokerServiceClient
- type Client
- func (c *Client) NewAccountService(params map[string]interface{}) *AccountClient
- func (c *Client) NewAccountServiceNoParams() *AccountClient
- func (c *Client) NewAssetService(params map[string]interface{}) *AssetClient
- func (c *Client) NewBrokerService(params map[string]interface{}) *BrokerServiceClient
- func (c *Client) NewLendingService(params map[string]interface{}) *LendingServiceClient
- func (c *Client) NewLendingServiceNoParams() *LendingServiceClient
- func (c *Client) NewMarketInfoService(params map[string]interface{}) *MarketClient
- func (c *Client) NewMarketInfoServiceNoParams() *MarketClient
- func (c *Client) NewMarketKLinesService(klineType string, params map[string]interface{}) *MarketClient
- func (c *Client) NewMarketKlineService(klineType, category, symbol, interval string) *Klines
- func (c *Client) NewPlaceOrderService(category, symbol, side, orderType, qty string) *Order
- func (c *Client) NewPositionService(params map[string]interface{}) *PositionClient
- func (c *Client) NewPreUpgradeService(params map[string]interface{}) *PreUpgradeClient
- func (c *Client) NewSpotLeverageService(params map[string]interface{}) *SpotLeverageClient
- func (c *Client) NewSpotMarginDataService(params map[string]interface{}, isUta bool) *SpotMarginClient
- func (c *Client) NewTradeService(params map[string]interface{}) *TradeClient
- func (c *Client) NewUserService(params map[string]interface{}) *UserServiceClient
- func (c *Client) NewUserServiceNoParams() *UserServiceClient
- type ClientOption
- type ErrorHandler
- type Klines
- type LendingServiceClient
- func (s *LendingServiceClient) C2cCancelRedeemFunds(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *LendingServiceClient) C2cDepositFunds(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *LendingServiceClient) C2cRedeemFunds(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *LendingServiceClient) GetC2cLendingAccountInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *LendingServiceClient) GetC2cLendingCoinInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *LendingServiceClient) GetC2cLendingOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *LendingServiceClient) GetInsLoanInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *LendingServiceClient) GetInsLoanOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *LendingServiceClient) GetInsLoanToValue(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *LendingServiceClient) GetInsMarginCoinInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *LendingServiceClient) GetInsRepayOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
- type MarketClient
- func (s *MarketClient) GetDeliveryPrice(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *MarketClient) GetFundingRates(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *MarketClient) GetHistoricalVolatility(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *MarketClient) GetInstrumentInfo(ctx context.Context, opts ...RequestOption) (*models.GetInstrumentsInfoResponse, error)
- func (s *MarketClient) GetInsuranceInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *MarketClient) GetMarketKline(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *MarketClient) GetMarketLSRatio(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *MarketClient) GetMarketTickers(ctx context.Context, opts ...RequestOption) (*models.GetTickersResponse, error)
- func (s *MarketClient) GetOpenInterests(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *MarketClient) GetOrderBookInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *MarketClient) GetPublicRecentTrades(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *MarketClient) GetRiskLimit(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *MarketClient) GetServerTime(ctx context.Context, opts ...RequestOption) (*models.GetServerTimeResponse, error)
- type MessageHandler
- type Order
- func (order *Order) CloseOnTrigger(close bool) *Order
- func (order *Order) Do(ctx context.Context, opts ...RequestOption) (*models.CreateOrderResponse, error)
- func (order *Order) IsLeverage(isLeverage int) *Order
- func (order *Order) Mmp(mmp bool) *Order
- func (order *Order) OrderFilter(filter string) *Order
- func (order *Order) OrderIv(iv string) *Order
- func (order *Order) OrderLinkId(orderLinkId string) *Order
- func (order *Order) PositionIdx(idx int) *Order
- func (order *Order) Price(price string) *Order
- func (order *Order) ReduceOnly(reduce bool) *Order
- func (order *Order) SlLimitPrice(price string) *Order
- func (order *Order) SlOrderType(orderType string) *Order
- func (order *Order) SlTriggerBy(triggerBy string) *Order
- func (order *Order) SmpType(smp string) *Order
- func (order *Order) StopLoss(loss string) *Order
- func (order *Order) TakeProfit(profit string) *Order
- func (order *Order) TimeInForce(tif string) *Order
- func (order *Order) TpLimitPrice(price string) *Order
- func (order *Order) TpOrderType(orderType string) *Order
- func (order *Order) TpTriggerBy(triggerBy string) *Order
- func (order *Order) TpslMode(mode string) *Order
- func (order *Order) TriggerBy(triggerBy string) *Order
- func (order *Order) TriggerDirection(direction int) *Order
- func (order *Order) TriggerPrice(triggerPrice string) *Order
- type PositionClient
- func (s *PositionClient) ConfirmPositionRiskLimit(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PositionClient) GetClosePnl(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PositionClient) GetExecutionList(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PositionClient) GetPositionList(ctx context.Context, opts ...RequestOption) (*models.GetPositionInfoResponse, error)
- func (s *PositionClient) SetPositionAutoMargin(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PositionClient) SetPositionLeverage(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PositionClient) SetPositionRiskLimit(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PositionClient) SetPositionTpslMode(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PositionClient) SetPositionTradingStop(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PositionClient) SwitchPositionMargin(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PositionClient) SwitchPositionMode(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PositionClient) UpdatePositionMargin(ctx context.Context, opts ...RequestOption) ([]byte, error)
- type PreUpgradeClient
- func (s *PreUpgradeClient) GetPreUpgradeClosedPnl(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PreUpgradeClient) GetPreUpgradeExecutionList(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PreUpgradeClient) GetPreUpgradeOptionDeliveryRecord(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PreUpgradeClient) GetPreUpgradeOrderHistory(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PreUpgradeClient) GetPreUpgradeTransactionLog(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *PreUpgradeClient) GetPreUpgradeUsdcSettlement(ctx context.Context, opts ...RequestOption) ([]byte, error)
- type RequestOption
- type ServerResponse
- type SpotLeverageClient
- func (s *SpotLeverageClient) GetLeverageTokenInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotLeverageClient) GetLeverageTokenMarket(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotLeverageClient) GetLeverageTokenOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotLeverageClient) PurchaseLeverageToken(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotLeverageClient) RedeemLeverageToken(ctx context.Context, opts ...RequestOption) ([]byte, error)
- type SpotMarginClient
- func (s *SpotMarginClient) BorrowSpotMarginLoan(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotMarginClient) GetSpotMarginBorrowCoin(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotMarginClient) GetSpotMarginBorrowOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotMarginClient) GetSpotMarginCoin(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotMarginClient) GetSpotMarginData(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotMarginClient) GetSpotMarginInterests(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotMarginClient) GetSpotMarginLoanAccountInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotMarginClient) GetSpotMarginRepaymentOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotMarginClient) GetSpotMarginState(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotMarginClient) RepaySpotMarginLoan(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotMarginClient) SetSpotMarginLeverage(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *SpotMarginClient) ToggleSpotMarginTrade(ctx context.Context, opts ...RequestOption) ([]byte, error)
- type TradeClient
- func (s *TradeClient) AmendBatchOrder(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *TradeClient) AmendOrder(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *TradeClient) CancelAllOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *TradeClient) CancelBatchOrder(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *TradeClient) CancelOrder(ctx context.Context, opts ...RequestOption) (*models.CancelOrderResponse, error)
- func (s *TradeClient) GetOpenOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *TradeClient) GetOrderHistory(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *TradeClient) GetSpotBorrowQuota(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *TradeClient) PlaceBatchOrder(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *TradeClient) PlaceOrder(ctx context.Context, opts ...RequestOption) (*models.CreateOrderResponse, error)
- func (s *TradeClient) SetDisconnectCancelAll(ctx context.Context, opts ...RequestOption) ([]byte, error)
- type UserServiceClient
- func (s *UserServiceClient) CreateSubApiKey(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *UserServiceClient) CreateSubMember(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *UserServiceClient) DeleteMasterAPIKey(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *UserServiceClient) DeleteSubAPIKey(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *UserServiceClient) DeleteSubUID(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *UserServiceClient) FreezeSubUID(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *UserServiceClient) GetAPIKeyInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *UserServiceClient) GetAffiliateUserInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *UserServiceClient) GetSubUidList(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *UserServiceClient) GetUidWalletType(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *UserServiceClient) ModifyMasterAPIKey(ctx context.Context, opts ...RequestOption) ([]byte, error)
- func (s *UserServiceClient) ModifySubAPIKey(ctx context.Context, opts ...RequestOption) ([]byte, error)
- type WebSocket
- func (b *WebSocket) Connect(args []string) error
- func (b *WebSocket) Disconnect() error
- func (b *WebSocket) GetCachedArgs() []string
- func (b *WebSocket) Ping(stopCh <-chan struct{})
- func (b *WebSocket) Send(message string) error
- func (b *WebSocket) SendAsJson(v interface{}) error
- func (b *WebSocket) SetMessageHandler(handler MessageHandler)
- type WebsocketOption
Constants ¶
View Source
const ( BrokerKey = "Referer" BrokerValue = "Zn000401" )
View Source
const ( Name = "coinquant" Version = "1.0.0" // Https MAINNET = "https://api.bybit.com" MAINNET_BACKT = "https://api.bytick.com" TESTNET = "https://api-testnet.bybit.com" // WebSocket public channel - Mainnet SPOT_MAINNET = "wss://stream.bybit.com/v5/public/spot" LINEAR_MAINNET = "wss://stream.bybit.com/v5/public/linear" INVERSE_MAINNET = "wss://stream.bybit.com/v5/public/inverse" OPTION_MAINNET = "wss://stream.bybit.com/v5/public/option" // WebSocket public channel - Testnet SPOT_TESTNET = "wss://stream-testnet.bybit.com/v5/public/spot" LINEAR_TESTNET = "wss://stream-testnet.bybit.com/v5/public/linear" INVERSE_TESTNET = "wss://stream-testnet.bybit.com/v5/public/inverse" OPTION_TESTNET = "wss://stream-testnet.bybit.com/v5/public/option" // WebSocket private channel WEBSOCKET_PRIVATE_MAINNET = "wss://stream.bybit.com/v5/private" WEBSOCKET_PRIVATE_TESTNET = "wss://stream-testnet.bybit.com/v5/private" // V3 V3_CONTRACT_PRIVATE = "wss://stream.bybit.com/contract/private/v3" V3_UNIFIED_PRIVATE = "wss://stream.bybit.com/unified/private/v3" V3_SPOT_PRIVATE = "wss://stream.bybit.com/spot/private/v3" )
Variables ¶
This section is empty.
Functions ¶
func FormatTimestamp ¶
FormatTimestamp formats a time into Unix timestamp in milliseconds, as requested by Binance.
func GetCurrentTime ¶
func GetCurrentTime() int64
func PrettyPrint ¶
func PrettyPrint(i interface{}) string
Types ¶
type AccountClient ¶
type AccountClient struct {
// contains filtered or unexported fields
}
func (*AccountClient) GetAccountInfo ¶
func (s *AccountClient) GetAccountInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AccountClient) GetAccountWallet ¶
func (s *AccountClient) GetAccountWallet(ctx context.Context, opts ...RequestOption) (*models.GetWalletBalanceResponse, error)
func (*AccountClient) GetBorrowHistory ¶
func (s *AccountClient) GetBorrowHistory(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AccountClient) GetCoinGreeks ¶
func (s *AccountClient) GetCoinGreeks(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AccountClient) GetCollateralInfo ¶
func (s *AccountClient) GetCollateralInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AccountClient) GetFeeRates ¶
func (s *AccountClient) GetFeeRates(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AccountClient) GetMMPState ¶
func (s *AccountClient) GetMMPState(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AccountClient) GetTransactionLog ¶
func (s *AccountClient) GetTransactionLog(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AccountClient) ResetMarketMakerProtection ¶
func (s *AccountClient) ResetMarketMakerProtection(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AccountClient) SetCollateralCoin ¶
func (s *AccountClient) SetCollateralCoin(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AccountClient) SetMarginMode ¶
func (s *AccountClient) SetMarginMode(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AccountClient) SetMarketMakerProtection ¶
func (s *AccountClient) SetMarketMakerProtection(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AccountClient) SetSpotHedgeMode ¶
func (s *AccountClient) SetSpotHedgeMode(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AccountClient) UpgradeToUTA ¶
func (s *AccountClient) UpgradeToUTA(ctx context.Context, opts ...RequestOption) ([]byte, error)
type AssetClient ¶
type AssetClient struct {
// contains filtered or unexported fields
}
func (*AssetClient) CancelWithdrawAsset ¶
func (s *AssetClient) CancelWithdrawAsset(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) CreateInternalTransfer ¶
func (s *AssetClient) CreateInternalTransfer(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) CreateUniversalTransfer ¶
func (s *AssetClient) CreateUniversalTransfer(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetAllCoinsBalance ¶
func (s *AssetClient) GetAllCoinsBalance(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetAllowedDepositCoin ¶
func (s *AssetClient) GetAllowedDepositCoin(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetAssetInfo ¶
func (s *AssetClient) GetAssetInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetAssetOrderRecord ¶
func (s *AssetClient) GetAssetOrderRecord(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetCoinInfo ¶
func (s *AssetClient) GetCoinInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetDeliveryRecord ¶
func (s *AssetClient) GetDeliveryRecord(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetDepositRecords ¶
func (s *AssetClient) GetDepositRecords(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetInternalDepositRecords ¶
func (s *AssetClient) GetInternalDepositRecords(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetInternalTransfer ¶
func (s *AssetClient) GetInternalTransfer(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetMasterDepositAddress ¶
func (s *AssetClient) GetMasterDepositAddress(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetSingleCoinsBalance ¶
func (s *AssetClient) GetSingleCoinsBalance(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetSubDepositAddress ¶
func (s *AssetClient) GetSubDepositAddress(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetSubDepositRecords ¶
func (s *AssetClient) GetSubDepositRecords(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetSubUids ¶
func (s *AssetClient) GetSubUids(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetTransferableCoin ¶
func (s *AssetClient) GetTransferableCoin(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetUniversalTransfer ¶
func (s *AssetClient) GetUniversalTransfer(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetUsdcSettlement ¶
func (s *AssetClient) GetUsdcSettlement(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetWithdrawalAmount ¶
func (s *AssetClient) GetWithdrawalAmount(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) GetWithdrawalRecords ¶
func (s *AssetClient) GetWithdrawalRecords(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) SetDepositAccount ¶
func (s *AssetClient) SetDepositAccount(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*AssetClient) WithdrawAsset ¶
func (s *AssetClient) WithdrawAsset(ctx context.Context, opts ...RequestOption) ([]byte, error)
type BrokerServiceClient ¶
type BrokerServiceClient struct {
// contains filtered or unexported fields
}
func (*BrokerServiceClient) GetBrokerAccountInfo ¶
func (s *BrokerServiceClient) GetBrokerAccountInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*BrokerServiceClient) GetBrokerEarning ¶
func (s *BrokerServiceClient) GetBrokerEarning(ctx context.Context, opts ...RequestOption) ([]byte, error)
type Client ¶
type Client struct { APIKey string APISecret string BaseURL string HTTPClient *http.Client Debug bool Logger *log.Logger // contains filtered or unexported fields }
Client define API client
func NewBybitHttpClient ¶
func NewBybitHttpClient(apiKey string, APISecret string, options ...ClientOption) *Client
NewBybitHttpClient NewClient Create client function for initialising new Bybit client
func (*Client) NewAccountService ¶
func (c *Client) NewAccountService(params map[string]interface{}) *AccountClient
func (*Client) NewAccountServiceNoParams ¶
func (c *Client) NewAccountServiceNoParams() *AccountClient
func (*Client) NewAssetService ¶
func (c *Client) NewAssetService(params map[string]interface{}) *AssetClient
func (*Client) NewBrokerService ¶
func (c *Client) NewBrokerService(params map[string]interface{}) *BrokerServiceClient
func (*Client) NewLendingService ¶
func (c *Client) NewLendingService(params map[string]interface{}) *LendingServiceClient
func (*Client) NewLendingServiceNoParams ¶
func (c *Client) NewLendingServiceNoParams() *LendingServiceClient
func (*Client) NewMarketInfoService ¶
func (c *Client) NewMarketInfoService(params map[string]interface{}) *MarketClient
func (*Client) NewMarketInfoServiceNoParams ¶
func (c *Client) NewMarketInfoServiceNoParams() *MarketClient
func (*Client) NewMarketKLinesService ¶
func (c *Client) NewMarketKLinesService(klineType string, params map[string]interface{}) *MarketClient
func (*Client) NewMarketKlineService ¶
NewMarketKlineService Market Endpoints
func (*Client) NewPlaceOrderService ¶
NewPlaceOrderService Trade Endpoints
func (*Client) NewPositionService ¶
func (c *Client) NewPositionService(params map[string]interface{}) *PositionClient
func (*Client) NewPreUpgradeService ¶
func (c *Client) NewPreUpgradeService(params map[string]interface{}) *PreUpgradeClient
func (*Client) NewSpotLeverageService ¶
func (c *Client) NewSpotLeverageService(params map[string]interface{}) *SpotLeverageClient
func (*Client) NewSpotMarginDataService ¶
func (c *Client) NewSpotMarginDataService(params map[string]interface{}, isUta bool) *SpotMarginClient
func (*Client) NewTradeService ¶
func (c *Client) NewTradeService(params map[string]interface{}) *TradeClient
func (*Client) NewUserService ¶
func (c *Client) NewUserService(params map[string]interface{}) *UserServiceClient
func (*Client) NewUserServiceNoParams ¶
func (c *Client) NewUserServiceNoParams() *UserServiceClient
type ClientOption ¶
type ClientOption func(*Client)
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
WithBaseURL is a client option to set the base URL of the Bybit HTTP client.
type ErrorHandler ¶
type ErrorHandler func(err error)
type Klines ¶
type Klines struct {
// contains filtered or unexported fields
}
Klines Market Kline (GET /v5/market/kline)
type LendingServiceClient ¶
type LendingServiceClient struct {
// contains filtered or unexported fields
}
func (*LendingServiceClient) C2cCancelRedeemFunds ¶
func (s *LendingServiceClient) C2cCancelRedeemFunds(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*LendingServiceClient) C2cDepositFunds ¶
func (s *LendingServiceClient) C2cDepositFunds(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*LendingServiceClient) C2cRedeemFunds ¶
func (s *LendingServiceClient) C2cRedeemFunds(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*LendingServiceClient) GetC2cLendingAccountInfo ¶
func (s *LendingServiceClient) GetC2cLendingAccountInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*LendingServiceClient) GetC2cLendingCoinInfo ¶
func (s *LendingServiceClient) GetC2cLendingCoinInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*LendingServiceClient) GetC2cLendingOrders ¶
func (s *LendingServiceClient) GetC2cLendingOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*LendingServiceClient) GetInsLoanInfo ¶
func (s *LendingServiceClient) GetInsLoanInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*LendingServiceClient) GetInsLoanOrders ¶
func (s *LendingServiceClient) GetInsLoanOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*LendingServiceClient) GetInsLoanToValue ¶
func (s *LendingServiceClient) GetInsLoanToValue(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*LendingServiceClient) GetInsMarginCoinInfo ¶
func (s *LendingServiceClient) GetInsMarginCoinInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*LendingServiceClient) GetInsRepayOrders ¶
func (s *LendingServiceClient) GetInsRepayOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
type MarketClient ¶
type MarketClient struct {
// contains filtered or unexported fields
}
func (*MarketClient) GetDeliveryPrice ¶
func (s *MarketClient) GetDeliveryPrice(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*MarketClient) GetFundingRates ¶
func (s *MarketClient) GetFundingRates(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*MarketClient) GetHistoricalVolatility ¶
func (s *MarketClient) GetHistoricalVolatility(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*MarketClient) GetInstrumentInfo ¶
func (s *MarketClient) GetInstrumentInfo(ctx context.Context, opts ...RequestOption) (*models.GetInstrumentsInfoResponse, error)
func (*MarketClient) GetInsuranceInfo ¶
func (s *MarketClient) GetInsuranceInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*MarketClient) GetMarketKline ¶
func (s *MarketClient) GetMarketKline(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*MarketClient) GetMarketLSRatio ¶
func (s *MarketClient) GetMarketLSRatio(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*MarketClient) GetMarketTickers ¶
func (s *MarketClient) GetMarketTickers(ctx context.Context, opts ...RequestOption) (*models.GetTickersResponse, error)
func (*MarketClient) GetOpenInterests ¶
func (s *MarketClient) GetOpenInterests(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*MarketClient) GetOrderBookInfo ¶
func (s *MarketClient) GetOrderBookInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*MarketClient) GetPublicRecentTrades ¶
func (s *MarketClient) GetPublicRecentTrades(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*MarketClient) GetRiskLimit ¶
func (s *MarketClient) GetRiskLimit(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*MarketClient) GetServerTime ¶
func (s *MarketClient) GetServerTime(ctx context.Context, opts ...RequestOption) (*models.GetServerTimeResponse, error)
type MessageHandler ¶
type Order ¶
type Order struct {
// contains filtered or unexported fields
}
func (*Order) CloseOnTrigger ¶
func (*Order) Do ¶
func (order *Order) Do(ctx context.Context, opts ...RequestOption) (*models.CreateOrderResponse, error)
func (*Order) IsLeverage ¶
func (*Order) OrderFilter ¶
func (*Order) OrderLinkId ¶
func (*Order) PositionIdx ¶
func (*Order) ReduceOnly ¶
func (*Order) SlLimitPrice ¶
func (*Order) SlOrderType ¶
func (*Order) SlTriggerBy ¶
func (*Order) TakeProfit ¶
func (*Order) TimeInForce ¶
func (*Order) TpLimitPrice ¶
func (*Order) TpOrderType ¶
func (*Order) TpTriggerBy ¶
func (*Order) TriggerDirection ¶
func (*Order) TriggerPrice ¶
type PositionClient ¶
type PositionClient struct {
// contains filtered or unexported fields
}
func (*PositionClient) ConfirmPositionRiskLimit ¶
func (s *PositionClient) ConfirmPositionRiskLimit(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PositionClient) GetClosePnl ¶
func (s *PositionClient) GetClosePnl(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PositionClient) GetExecutionList ¶
func (s *PositionClient) GetExecutionList(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PositionClient) GetPositionList ¶
func (s *PositionClient) GetPositionList(ctx context.Context, opts ...RequestOption) (*models.GetPositionInfoResponse, error)
func (*PositionClient) SetPositionAutoMargin ¶
func (s *PositionClient) SetPositionAutoMargin(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PositionClient) SetPositionLeverage ¶
func (s *PositionClient) SetPositionLeverage(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PositionClient) SetPositionRiskLimit ¶
func (s *PositionClient) SetPositionRiskLimit(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PositionClient) SetPositionTpslMode ¶
func (s *PositionClient) SetPositionTpslMode(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PositionClient) SetPositionTradingStop ¶
func (s *PositionClient) SetPositionTradingStop(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PositionClient) SwitchPositionMargin ¶
func (s *PositionClient) SwitchPositionMargin(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PositionClient) SwitchPositionMode ¶
func (s *PositionClient) SwitchPositionMode(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PositionClient) UpdatePositionMargin ¶
func (s *PositionClient) UpdatePositionMargin(ctx context.Context, opts ...RequestOption) ([]byte, error)
type PreUpgradeClient ¶
type PreUpgradeClient struct {
// contains filtered or unexported fields
}
func (*PreUpgradeClient) GetPreUpgradeClosedPnl ¶
func (s *PreUpgradeClient) GetPreUpgradeClosedPnl(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PreUpgradeClient) GetPreUpgradeExecutionList ¶
func (s *PreUpgradeClient) GetPreUpgradeExecutionList(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PreUpgradeClient) GetPreUpgradeOptionDeliveryRecord ¶
func (s *PreUpgradeClient) GetPreUpgradeOptionDeliveryRecord(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PreUpgradeClient) GetPreUpgradeOrderHistory ¶
func (s *PreUpgradeClient) GetPreUpgradeOrderHistory(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PreUpgradeClient) GetPreUpgradeTransactionLog ¶
func (s *PreUpgradeClient) GetPreUpgradeTransactionLog(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*PreUpgradeClient) GetPreUpgradeUsdcSettlement ¶
func (s *PreUpgradeClient) GetPreUpgradeUsdcSettlement(ctx context.Context, opts ...RequestOption) ([]byte, error)
type RequestOption ¶
type RequestOption func(*request)
RequestOption define option type for request
func WithRecvWindow ¶
func WithRecvWindow(recvWindow string) RequestOption
WithRecvWindow Append `WithRecvWindow(insert_recvWindow)` to request to modify the default recvWindow value
type ServerResponse ¶
type SpotLeverageClient ¶
type SpotLeverageClient struct {
// contains filtered or unexported fields
}
func (*SpotLeverageClient) GetLeverageTokenInfo ¶
func (s *SpotLeverageClient) GetLeverageTokenInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotLeverageClient) GetLeverageTokenMarket ¶
func (s *SpotLeverageClient) GetLeverageTokenMarket(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotLeverageClient) GetLeverageTokenOrders ¶
func (s *SpotLeverageClient) GetLeverageTokenOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotLeverageClient) PurchaseLeverageToken ¶
func (s *SpotLeverageClient) PurchaseLeverageToken(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotLeverageClient) RedeemLeverageToken ¶
func (s *SpotLeverageClient) RedeemLeverageToken(ctx context.Context, opts ...RequestOption) ([]byte, error)
type SpotMarginClient ¶
type SpotMarginClient struct {
// contains filtered or unexported fields
}
func (*SpotMarginClient) BorrowSpotMarginLoan ¶
func (s *SpotMarginClient) BorrowSpotMarginLoan(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotMarginClient) GetSpotMarginBorrowCoin ¶
func (s *SpotMarginClient) GetSpotMarginBorrowCoin(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotMarginClient) GetSpotMarginBorrowOrders ¶
func (s *SpotMarginClient) GetSpotMarginBorrowOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotMarginClient) GetSpotMarginCoin ¶
func (s *SpotMarginClient) GetSpotMarginCoin(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotMarginClient) GetSpotMarginData ¶
func (s *SpotMarginClient) GetSpotMarginData(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotMarginClient) GetSpotMarginInterests ¶
func (s *SpotMarginClient) GetSpotMarginInterests(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotMarginClient) GetSpotMarginLoanAccountInfo ¶
func (s *SpotMarginClient) GetSpotMarginLoanAccountInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotMarginClient) GetSpotMarginRepaymentOrders ¶
func (s *SpotMarginClient) GetSpotMarginRepaymentOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotMarginClient) GetSpotMarginState ¶
func (s *SpotMarginClient) GetSpotMarginState(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotMarginClient) RepaySpotMarginLoan ¶
func (s *SpotMarginClient) RepaySpotMarginLoan(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotMarginClient) SetSpotMarginLeverage ¶
func (s *SpotMarginClient) SetSpotMarginLeverage(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*SpotMarginClient) ToggleSpotMarginTrade ¶
func (s *SpotMarginClient) ToggleSpotMarginTrade(ctx context.Context, opts ...RequestOption) ([]byte, error)
type TradeClient ¶
type TradeClient struct {
// contains filtered or unexported fields
}
func (*TradeClient) AmendBatchOrder ¶
func (s *TradeClient) AmendBatchOrder(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*TradeClient) AmendOrder ¶
func (s *TradeClient) AmendOrder(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*TradeClient) CancelAllOrders ¶
func (s *TradeClient) CancelAllOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*TradeClient) CancelBatchOrder ¶
func (s *TradeClient) CancelBatchOrder(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*TradeClient) CancelOrder ¶
func (s *TradeClient) CancelOrder(ctx context.Context, opts ...RequestOption) (*models.CancelOrderResponse, error)
func (*TradeClient) GetOpenOrders ¶
func (s *TradeClient) GetOpenOrders(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*TradeClient) GetOrderHistory ¶
func (s *TradeClient) GetOrderHistory(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*TradeClient) GetSpotBorrowQuota ¶
func (s *TradeClient) GetSpotBorrowQuota(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*TradeClient) PlaceBatchOrder ¶
func (s *TradeClient) PlaceBatchOrder(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*TradeClient) PlaceOrder ¶
func (s *TradeClient) PlaceOrder(ctx context.Context, opts ...RequestOption) (*models.CreateOrderResponse, error)
func (*TradeClient) SetDisconnectCancelAll ¶
func (s *TradeClient) SetDisconnectCancelAll(ctx context.Context, opts ...RequestOption) ([]byte, error)
type UserServiceClient ¶
type UserServiceClient struct {
// contains filtered or unexported fields
}
func (*UserServiceClient) CreateSubApiKey ¶
func (s *UserServiceClient) CreateSubApiKey(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*UserServiceClient) CreateSubMember ¶
func (s *UserServiceClient) CreateSubMember(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*UserServiceClient) DeleteMasterAPIKey ¶
func (s *UserServiceClient) DeleteMasterAPIKey(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*UserServiceClient) DeleteSubAPIKey ¶
func (s *UserServiceClient) DeleteSubAPIKey(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*UserServiceClient) DeleteSubUID ¶
func (s *UserServiceClient) DeleteSubUID(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*UserServiceClient) FreezeSubUID ¶
func (s *UserServiceClient) FreezeSubUID(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*UserServiceClient) GetAPIKeyInfo ¶
func (s *UserServiceClient) GetAPIKeyInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*UserServiceClient) GetAffiliateUserInfo ¶
func (s *UserServiceClient) GetAffiliateUserInfo(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*UserServiceClient) GetSubUidList ¶
func (s *UserServiceClient) GetSubUidList(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*UserServiceClient) GetUidWalletType ¶
func (s *UserServiceClient) GetUidWalletType(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*UserServiceClient) ModifyMasterAPIKey ¶
func (s *UserServiceClient) ModifyMasterAPIKey(ctx context.Context, opts ...RequestOption) ([]byte, error)
func (*UserServiceClient) ModifySubAPIKey ¶
func (s *UserServiceClient) ModifySubAPIKey(ctx context.Context, opts ...RequestOption) ([]byte, error)
type WebSocket ¶
type WebSocket struct {
// contains filtered or unexported fields
}
func NewBybitPrivateWebSocket ¶
func NewBybitPrivateWebSocket(url, apiKey, apiSecret string, msgHandler MessageHandler, errHandler ErrorHandler, options ...WebsocketOption) *WebSocket
func NewBybitPublicWebSocket ¶
func NewBybitPublicWebSocket(url string, pingInterval int, msgHandler MessageHandler, errHandler ErrorHandler, options ...WebsocketOption) *WebSocket
func (*WebSocket) Disconnect ¶
func (*WebSocket) GetCachedArgs ¶
func (*WebSocket) SendAsJson ¶
func (*WebSocket) SetMessageHandler ¶
func (b *WebSocket) SetMessageHandler(handler MessageHandler)
type WebsocketOption ¶
type WebsocketOption func(*WebSocket)
func WithMaxAliveTime ¶
func WithMaxAliveTime(maxAliveTime string) WebsocketOption
func WithPingInterval ¶
func WithPingInterval(pingInterval int) WebsocketOption
Source Files
¶
Click to show internal directories.
Click to hide internal directories.