gobybit

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: MIT Imports: 1 Imported by: 0

README

Code check Go Report Card

go-bybit

Bybit API Client SDK for Golang (Go). This library is a wrapper SDK for the Bybit API written in Golang(Go).

Bybit API Docs: https://bybit.com/docs

This Project is under active development. Please feel free to contribute.

Install

go get -u github.com/cksidharthan/go-bybit

Example

func main() {
	client := rest.NewRestClient(bybit.BybitTestnetBaseURL, os.Getenv("BYBIT_API_KEY"), os.Getenv("BYBIT_API_SECRET"))

	// Get spot market client
	spotClient := client.Spot()
	// Get linear market client
	linearClient := client.Linear()
	// Get inverse perpetual market client
	inverseClient := client.InversePerpetual()

	spotResponse, err := spotClient.Market().GetSymbols(context.Background())
	if err != nil {
		fmt.Errorf("error: %v", err)
	}

	linearResponse, err := linearClient.Market().GetSymbolInformation(context.Background(), &linear.GetSymbolInformationParams{
		Symbol: "BTCUSDT",
	})
	if err != nil {
		fmt.Errorf("error: %v", err)
	}

	inverseResponse, err := inverseClient.Market().GetSymbolInformation(context.Background(), &inverseperp.GetSymbolInformationParams{
		Symbol: "BTCUSD",
	})
	if err != nil {
		fmt.Errorf("error: %v", err)
	}

	fmt.Println(spotResponse)
	fmt.Println(linearResponse)
	fmt.Println(inverseResponse)
}

All the tests in this repository interact with the Bybit API directly. Please refer them for examples, when using this library. :)

In the meantime, I'll be adding more examples to ./examples folder.

Endpoints completed

Category SubCategory Created Testcases
SPOT Market Data
SPOT Account Data
SPOT Wallet Data
SPOT API Data
USDT Perpetual Market Data
USDT Perpetual Account Data
USDT Perpetual Wallet Data
Inverse Perpetual Market Data
Inverse Perpetual Account Data
Inverse Perpetual Wallet Data
Contributing

Pull requests are welcome.

Please make sure to add tests when adding new methods.

Local Development

Code Formatting and linting.

make fmt
make lint

Unit Testing

make test

visitors

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RestClient added in v0.0.3

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

func NewBybitClient added in v0.0.3

func NewBybitClient(url, apiKey, apiSecret string) *RestClient

func (*RestClient) Rest added in v0.0.3

func (c *RestClient) Rest() rest.Client

Jump to

Keyboard shortcuts

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