goincheck

package module
v0.0.0-...-e898c3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2017 License: MIT Imports: 14 Imported by: 0

README

goincheck

coincheck exchange client API for golang

Build Status Go Documentation MIT License

Installation

$ go get github.com/takuyaohashi/goincheck

Usage Example

package main

import (
    "fmt"

    "github.com/takuyaohashi/goincheck"
)

const (
    accessKey       = "hoge"
    secretAccessKey = "huga"
)

func main() {
    client, _ := goincheck.NewClient(accessKey, secretAccessKey)
    tikcer, _ := client.GetTicker()
    fmt.Printf("Tikcer = %+v\n", tikcer)
}

For detail, please check sample/cmd/goincheck directory or GoDoc.

License

MIT

Author

Takuya OHASHI

Documentation

Overview

Package goincheck is client for Coincheck Exchange API

Package goincheck is client for Coincheck Exchange API

Package goincheck is client for Coincheck Exchange API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Version

func Version() string

Version returns current version.

Types

type Balance

type Balance struct {
	Success      bool   `json:"success"`
	Jpy          string `json:"jpy"`
	Btc          string `json:"btc"`
	JpyReserved  string `json:"jpy_reserved"`
	BtcReserved  string `json:"btc_reserved"`
	JpyLendInUse string `json:"jpy_lend_in_use"`
	BtcLendInUse string `json:"btc_lend_in_use"`
	JpyLend      string `json:"jpy_lent"`
	BtcLend      string `json:"btc_lent"`
	JpyDebt      string `json:"jpy_debt"`
	BtcDebt      string `json:"btc_debt"`
}

Balance struct represents Coincheck Balance API Response.

type Client

type Client struct {
	BaseURL *url.URL

	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client struct represents Coincheck API client.

func NewClient

func NewClient(key, secretKey string) (*Client, error)

NewClient creats Client Struct.

func (*Client) GetBalance

func (cli *Client) GetBalance(ctx context.Context) (*Balance, error)

func (*Client) GetExchangeRate

func (cli *Client) GetExchangeRate(ctx context.Context) (*ExchangeRate, error)

func (*Client) GetOrderBook

func (cli *Client) GetOrderBook(ctx context.Context) (*OrderBook, error)

func (*Client) GetRatePair

func (cli *Client) GetRatePair(ctx context.Context, pair Pair) (*RatePair, error)

func (*Client) GetTicker

func (cli *Client) GetTicker(ctx context.Context) (*Ticker, error)

func (*Client) GetTrade

func (cli *Client) GetTrade(ctx context.Context) (*[]Trade, error)

func (*Client) OrderToBuy

func (cli *Client) OrderToBuy(ctx context.Context, rate int, amount float64) (*Order, error)

func (*Client) OrderToMarketBuy

func (cli *Client) OrderToMarketBuy(ctx context.Context, yen int) (*Order, error)

func (*Client) OrderToMarketSell

func (cli *Client) OrderToMarketSell(ctx context.Context, amount float64) (*Order, error)

func (*Client) OrderToSell

func (cli *Client) OrderToSell(ctx context.Context, rate int, amount float64) (*Order, error)

type ExchangeRate

type ExchangeRate struct {
	Success bool `json:"success"`
	Rate    int  `json:"rate"`
	Price   int  `json:"price"`
	Amount  int  `json:"amount"`
}

ExchangeRate struct represents Coincheck ExchangeRate API Response.

type Order

type Order struct {
	Success      bool    `json:"success"`
	ID           int     `json:"id"`
	Pair         string  `json:"pair"`
	OrderType    string  `json:"order_type"`
	Amount       float64 `json:"amount"`
	Rate         int     `json:"rate"`
	StopLossRate int     `json:"stop_less_rate"`
	CreatedAt    string  `json:"created_at"`
	Error        string  `json:"error"`
}

Order struct represents Coincheck Order API Response.

type OrderBook

type OrderBook struct {
	Asks [][]string `json:"asks"`
	Bids [][]string `json:"bids"`
}

OrderBook struct represents Coincheck OrderBook API Response.

type Pair

type Pair string

Pair shows exchange pairs.

const (
	// BtcJpy is pair of BTC(Bitcoin) and Japanese yen.
	BtcJpy Pair = "btc_jpy"

	// EthJpy is pair of ETH(Ethereum) and Japanese yen.
	EthJpy Pair = "eth_jpy"

	// EtcJpy is pair of ETC(Ethereum Classic) and Japanese yen.
	EtcJpy Pair = "etc_jpy"

	// DaoJpy is pair of DAO and Japanese yen.
	DaoJpy Pair = "dao_jpy"

	// LskJpy is pair of Lsk(Lisk) and Japanese yen.
	LskJpy Pair = "lsk_jpy"

	// FctJpy is pair of FCT(Factom) and Japanese yen.
	FctJpy Pair = "fct_jpy"

	// XmrJpy is pair of XMR(Manero) and Japanese yen.
	XmrJpy Pair = "xmr_jpy"

	// RepJpy is pair of REP(Augur) and Japanese yen.
	RepJpy Pair = "rep_jpy"

	// XrpJpy is pair of XRP(Ripple) and Japanese yen.
	XrpJpy Pair = "xrp_jpy"

	// ZecJpy is pair of ZEC(Zcash) and Japanese yen.
	ZecJpy Pair = "zec_jpy"

	// BchJpy is pair of BCH(Bitcoin Cash) and Japanese yen.
	BchJpy Pair = "bch_jpy"

	// EthBtc is pair of ETH(Ethereum) and BTC(Bitcoin).
	EthBtc Pair = "eth_btc"

	// EtcBtc is pair of ETC(Ethereum Classic) and BTC(Bitcoin).
	EtcBtc Pair = "etc_btc"

	// LskBtc is pair of LSK(Lisk) and BTC(Bitcoin).
	LskBtc Pair = "lsk_btc"

	// FctBtc is pair of FCT(Factom) and BTC(Bitcoin).
	FctBtc Pair = "fct_btc"

	// XmrBtc is pair of XMR(Monero) and BTC(Bitcoin).
	XmrBtc Pair = "xmr_btc"

	// RerBtc is pair of REP(Augur) and BTC(Bitcoin).
	RerBtc Pair = "rep_btc"

	// XrpBtc is pair of XRP(Ripple) and BTC(Bitcoin).
	XrpBtc Pair = "xrp_btc"

	// ZecBtc is pair of ZEC(Zcash) and BTC(Bitcoin).
	ZecBtc Pair = "zec_btc"

	// BchBtc is pair of BCH(Bitcoin Cash) and BTC(Bitcoin).
	BchBtc Pair = "bch_btc"
)

type RatePair

type RatePair struct {
	Rate string `json:"rate"`
}

RatePair struct reporesents Coincheck RatePair API Response.

type Ticker

type Ticker struct {
	Last      float64 `json:"last"`
	Bid       float64 `json:"bid"`
	Ask       float64 `json:"ask"`
	High      float64 `json:"high"`
	Low       float64 `json:"low"`
	Volume    float64 `json:"volume"`
	Timestamp float64 `json:"timestamp"`
}

Ticker struct represents Coincheck Ticker API Response.

type Trade

type Trade struct {
	ID        int     `json:"id"`
	Amount    string  `json:"amount"`
	Rate      float64 `json:"rate"`
	OrderType string  `json:"order_type"`
	CreatedAt string  `json:"created_at"`
}

Trade struct represents Coincheck Trade API Respoonse.

Directories

Path Synopsis
sample

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL