Giter Club home page Giter Club logo

go-bybit's Introduction

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

go-bybit's People

Contributors

cksidharthan avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

go-bybit's Issues

bug: change the leverage datatype of SetLeverageParams from int to float64

Change the Leverage Params of LinearAccount -> SetLeverage Params from int to float64

From

type SetLeverageParams struct {
	Symbol           string  `url:"symbol" json:"symbol"`
	BuyLeverage  int       `url:"buy_leverage" json:"buy_leverage"`
	SellLeverage  int       `url:"sell_leverage" json:"sell_leverage"`
}

To

type SetLeverageParams struct {
	Symbol           string       `url:"symbol" json:"symbol"`
	BuyLeverage  float64    `url:"buy_leverage" json:"buy_leverage"`
	SellLeverage  float64    `url:"sell_leverage" json:"sell_leverage"`
}

Implement V5 Endpoints

Implement V5 Endpoints

Bybit has release new V5 API endpoints. Since all the older versions will be deprecated in future, implement client for the new v5 endpoints

some advices

I see that the API related to placing an order is not implemented. It is recommended to expose transport.Http object so that users can realize some functions they do not have!!

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.