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
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