Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nao1215/coincheck

coincheck - coincheck public & private API client written in Go.
https://github.com/nao1215/coincheck

api-client coin coincheck golang virtual-currency

Last synced: 7 days ago
JSON representation

coincheck - coincheck public & private API client written in Go.

Awesome Lists containing this project

README

        

## coincheck public & private API client

[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)

[![Go Reference](https://pkg.go.dev/badge/github.com/nao1215/coincheck.svg)](https://pkg.go.dev/github.com/nao1215/coincheck)
![Coverage](https://raw.githubusercontent.com/nao1215/octocovs-central-repo/main/badges/nao1215/coincheck/coverage.svg)
[![MultiPlatformUnitTest](https://github.com/nao1215/coincheck/actions/workflows/unit_test.yml/badge.svg)](https://github.com/nao1215/coincheck/actions/workflows/unit_test.yml)
[![reviewdog](https://github.com/nao1215/coincheck/actions/workflows/reviewdog.yml/badge.svg)](https://github.com/nao1215/coincheck/actions/workflows/reviewdog.yml)
[![gitleaks](https://github.com/nao1215/coincheck/actions/workflows/gitleak.yml/badge.svg)](https://github.com/nao1215/coincheck/actions/workflows/gitleak.yml)

>[!IMPORTANT]
> This library is under development and is not yet ready for production use.

The coincheck package is a client for the API provided by Coincheck, Inc., which operates the cryptocurrency exchange (Coincheck). The coincheck package offers two types of APIs:

- Public API: Can be executed without authentication
- Private API: Requires authentication using the API Key and API Secret issued by the Coincheck service.

The coincheck package supports both Public and Private APIs.
- [Coincheck official API documentation](https://coincheck.com/documents/exchange/api)
- [Coincheck official API client](https://github.com/coincheckjp/coincheck-go)

## Supported OS and go version

- OS: Linux, macOS, Windows
- Go: 1.20 or later

## Example

An example of executing the Public API is shown below.

```go
package main

import (
"context"
"fmt"

"github.com/nao1215/coincheck"
)

func main() {
client, err := coincheck.NewClient()
if err != nil {
panic(err)
}

// Get the latest ticker
ticker, err := client.GetTicker(context.Background(), coincheck.GetTickerInput{
Pair: coincheck.PairETCJPY,
})
if err != nil {
panic(err)
}

fmt.Printf("Last: %d\n", ticker.Last)
fmt.Printf("Bid: %d\n", ticker.Bid)
fmt.Printf("Ask: %d\n", ticker.Ask)
fmt.Printf("High: %d\n", ticker.High)
fmt.Printf("Low: %d\n", ticker.Low)
fmt.Printf("Volume: %s\n", ticker.Volume)
fmt.Printf("Timestamp: %d\n", ticker.Timestamp)

// Output:
// Last: 4000.000000
// Bid: 3980.020000
// Ask: 4000.000000
// High: 4220.000000
// Low: 4000.000000
// Volume: 339.150000
// Timestamp: 1722661800.000000
}
```

If you want to execute the Private API, you need to create a client with the API Key and API Secret issued by the Coincheck service.

```go
client, err := coincheck.NewClient(WithCredentials("API_KEY", "API_SECRET"))
```

## API List
### Public API

| API | Method Name |Description |
| :--- | :--- | :--- |
| GET /api/ticker | [GetTicker()](https://pkg.go.dev/github.com/nao1215/coincheck#Client.GetTicker) | Check latest ticker information. |
| GET /api/trades | [GetTrades()](https://pkg.go.dev/github.com/nao1215/coincheck#Client.GetTrades) | You can get current order transactions. |
| GET /api/order_books | [GetOrderBooks()](https://pkg.go.dev/github.com/nao1215/coincheck#Client.GetOrderBooks) | Fetch order book information. |
| GET /api/exchange/orders/rate | [GetExchangeOrdersRate()](https://pkg.go.dev/github.com/nao1215/coincheck#Client.GetExchangeOrdersRate) | To calculate the rate from the order of the exchange. |
| GET /api/rate/[pair] | [GetRate()](https://pkg.go.dev/github.com/nao1215/coincheck#Client.GetRate) | Get the Standard Rate of Coin. |
| GET /api/exchange_status | [GetExchangeStatus()](https://pkg.go.dev/github.com/nao1215/coincheck#Client.GetExchangeStatus) | Retrieving the status of the exchange. |

### Private API

| API | Method Name |Description |
| :--- | :--- | :--- |
| GET /api/bank_accounts | [GetBankAccounts()](https://pkg.go.dev/github.com/nao1215/coincheck#Client.GetBankAccounts) | Display list of bank account you registered (withdrawal).|
| GET /api/accounts/balance | [GetAccountsBalance()](https://pkg.go.dev/github.com/nao1215/coincheck#Client.GetAccountsBalance) | Get the balance of your account. |

## License

[MIT License](./LICENSE)

## Contribution
First off, thanks for taking the time to contribute! See [CONTRIBUTING.md](./CONTRIBUTING.md) for more information. Contributions are not only related to development. For example, GitHub Star motivates me to develop! Please feel free to contribute to this project.

## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=nao1215/coincheck&type=Date)](https://star-history.com/#nao1215/coincheck&Date)

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):



CHIKAMATSU Naohiro
CHIKAMATSU Naohiro

💻






Add your contributions



This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

## Reasons for Creating the coincheck package

I wanted to create a Bot that is reason why. Another reason is that I started creating it without much thought. Foolish. Now, I would rather have a bitFlyer Bot.

I received a bonus and bought cryptocurrency out of curiosity (I bought it secretly from my spouse and have already lost 10,000 yen). I became interested in the mechanism of cryptocurrency itself, as well as in how to trade cryptocurrency automatically using a Bot.

The cryptocurrency exchanges I use are Coincheck and bitFlyer, with the former being the one where I hold the most coins. Given this situation, it was natural for me to consider creating a Bot for Coincheck.

However, the official Coincheck API client (Golang) was quite simplistic. I had no choice but to create my own. At this point, I realized my mistake. There was a lot of information that could not be gleaned from the official documentation.