coincheck

package module
Version: v0.0.0-...-9e6be18 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2016 License: MIT Imports: 11 Imported by: 0

README

Client for Coincheck Exchange API

A simple Coincheck Exchange API client.

Example of usage:

package main

import (
	"fmt"

	"github.com/ivanlemeshev/coincheck"
)

const (
	key    = "KEY"
	secret = "SECRET"
)

func main() {
	api := coincheck.New(key, secret)
	result, err := api.GetBalance()
	if err != nil {
		fmt.Println("Error: ", err.Error())
		return
	}

	fmt.Printf("Result: %+v\n", result)
}

Todo:

  • Ticker
  • Public trades
  • Order book
  • New order
  • Unsettled order list
  • Cancel order
  • Order transactions
  • Positions list
  • Balance
  • Leverage balance
  • Send BTC
  • BTC sends history
  • BTC deposits history
  • Fast bitcoin deposit
  • Account information
  • Bank account list
  • Register bank account
  • Remove bank account
  • Withdraw history
  • Create withdraw
  • Cancel withdraw
  • Apply borrowing
  • Borrowing list
  • Reply
  • Transfers to leverage account
  • Transfers from leverage account

Documentation

Index

Constants

View Source
const URL = "https://coincheck.jp"

URL is a Coincheck API base URL

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	// contains filtered or unexported fields
}

APIClient struct represents Coincheck API client

func New

func New(key, secret string) (client *APIClient)

New creates a new Kraken API struct

func (APIClient) GetAccounts

func (api APIClient) GetAccounts() (accounts Accounts, err error)

GetAccounts returns accounts

func (APIClient) GetBalance

func (api APIClient) GetBalance() (balance Balance, err error)

GetBalance returns account balance

func (APIClient) GetLeverageBalance

func (api APIClient) GetLeverageBalance() (leverageBalance LeverageBalance, err error)

GetLeverageBalance returns account leverage balance

func (APIClient) GetOpenOrders

func (api APIClient) GetOpenOrders() (orders OpenOrders, err error)

GetOpenOrders returns all open orders.

func (APIClient) GetOrderBook

func (api APIClient) GetOrderBook() (orderBook OrderBook, err error)

GetOrderBook returns Coincheck order book

func (APIClient) GetTicker

func (api APIClient) GetTicker() (ticker Ticker, err error)

GetTicker returns Coincheck ticker

func (APIClient) GetTrades

func (api APIClient) GetTrades() (trades []Trade, err error)

GetTrades returns Coincheck trades

func (APIClient) NewOrder

func (api APIClient) NewOrder(order Order) (newOrder Order, err error)

NewOrder sends a new order.

type Accounts

type Accounts struct {
	BitcoinAddress  string `json:"bitcoin_address"`
	Email           string `json:"email"`
	ID              int    `json:"id"`
	IdentityStatus  string `json:"identity_status"`
	LendingLeverage string `json:"lending_leverage"`
	MakerFee        string `json:"maker_fee"`
	Success         bool   `json:"success"`
	TakerFee        string `json:"taker_fee"`
	Error           string `json:"error"`
}

Accounts represents Coincheck accounts

type Balance

type Balance struct {
	BTC          string `json:"btc"`
	BTCDebt      string `json:"btc_debt"`
	BTCLendInUse string `json:"btc_lend_in_use"`
	BTCLent      string `json:"btc_lent"`
	BTCReserved  string `json:"btc_reserved"`
	JPY          string `json:"jpy"`
	JPYDebt      string `json:"jpy_debt"`
	JPYLendInUse string `json:"jpy_lend_in_use"`
	JPYLent      string `json:"jpy_lent"`
	JPYReserved  string `json:"jpy_reserved"`
	Success      bool   `json:"success"`
	Error        string `json:"error"`
}

Balance represents account balance

type LeverageBalance

type LeverageBalance struct {
	Margin struct {
		JPY float64 `json:"jpy"`
	} `json:"margin"`
	MarginAvailable struct {
		JPY string `json:"jpy"`
	} `json:"margin_available"`
	MarginLevel string `json:"margin_level"`
	Success     bool   `json:"success"`
	Error       string `json:"error"`
}

LeverageBalance represents account leverage balance

type OpenOrders

type OpenOrders struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
	Orders  []Order
}

OpenOrders represents list of open orders.

type Order

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

Order represents a new order.

type OrderBook

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

OrderBook represents account Coincheck order book

type Ticker

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

Ticker represents Coincheck ticker

type Trade

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

Trade represents Coincheck trade

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL