https://github.com/esenmx/coincap-go
CoinCap.io client written with Go.
https://github.com/esenmx/coincap-go
coincap go
Last synced: 5 months ago
JSON representation
CoinCap.io client written with Go.
- Host: GitHub
- URL: https://github.com/esenmx/coincap-go
- Owner: esenmx
- License: mit
- Created: 2021-07-26T13:02:54.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-27T13:41:34.000Z (over 3 years ago)
- Last Synced: 2025-01-10T18:38:50.262Z (6 months ago)
- Topics: coincap, go
- Language: Go
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# coincap-go
[CoinCap.io](https://coincap.io/) REST API wrapper written with Go. For docs checkout: https://docs.coincap.io/
## Installation
```sh
go get -u github.com/softronaut/coincap-go
```## Usage
```go
// Instance
client := coincap.DefaultClient() // uses http.DefaultClient
// Customization
retry := retryablehttp.NewClient() // or you can use a customized http.Client
retry.RetryMax = 3
retry.RetryWaitMax = time.Second * 5
client := coincap.CustomClient(retry.StandardClient())// API interface
GetAssets(GetAssetsParams) (AssetsData, error)
GetAsset(id string) (AssetData, error)
GetAssetHistory(GetAssetHistoryParams) (AssetHistoriesData, error)
GetAssetMarkets(GetAssetMarketsParams) (AssetMarketsData, error)
GetRates() (RatesData, error)
GetRate(id string) (RateData, error)
GetExchanges() (ExchangesData, error)
GetExchange(id string) (ExchangeData, error)
GetMarkets(GetMarketsParams) (MarketsData, error)
GetCandles(GetCandlesParams) (CandlesData, error)// Examples
assets, err := client.GetAssets(GetAssetsParams{Ids: []string{"bitcoin", "ethereum"}})
polkadot, err := client.GetAsset("polkadot")
linkUsdc, err := client.GetMarkets(GetMarketsParams{ExchangeId: "binance", BaseSymbol: "link", QuoteId: "usd-coin"})
```## Notes
Each `response` and `parameter` declared as `struct`.
Some parameter logics implemented (required parameters, api limits or start/end timestamp relations etc.).
`gzip` encoding enabled by default.
## ToDo
- WebSocket support
- Extensive error handling