Skip to content

eightseventhreethree/go-gemini-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-gemini-api

A Go library for interacting with the Gemini API. An example can be found in the examples directory or below.

Maintainability

package main

import (
	"fmt"
	"time"

	"github.com/eightseventhreethree/go-gemini-api/pkg/gemini"
	"github.com/eightseventhreethree/go-gemini-api/pkg/handlers"
)

func main() {
	api := gemini.NewClient(&gemini.ClientOpts{
		BaseURL:    "https://api.sandbox.gemini.com",
		Timeout:    time.Second.Round(10),
		RetryLimit: 3,
		RetryDelay: time.Second.Round(3),
	})

	resp, err := api.GetSymbols()
	handlers.CheckErrLog(err, "failed to GetSymbols")
	for _, v := range resp.Symbols {
		sym := &gemini.SymbolRequest{Name: v}
		symDetails, err := api.GetSymbolDetails(sym)
		handlers.CheckErrLog(err, "failed to call GetSymbolDetails")
		if symDetails.Status != gemini.Closed {
			tickerResp, err := api.GetTickerV2(sym)
			handlers.CheckErrLog(err, "failed to call GetTickerV1")
			tickerv1Resp, _ := api.GetTickerV1(sym)
			fmt.Printf("Symbol: %s -> Changes: %v -> Volume: %v \n", v, tickerResp.Changes, tickerv1Resp.Volume)
		}
	}
}

Contributing:

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License:

GPLv2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published