qtrade

package module
v0.0.0-...-9961f0f Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2019 License: MIT Imports: 16 Imported by: 0

README

go-qtrade

Qtrade API version1

Description

go-qtrade is a go client library for Qtrade API.

Installation

$ go get -u github.com/go-numb/go-qtrade

Usage

package main

import (
 "fmt"
 "github.com/go-numb/go-qtrade"
)


func main() {
	c := qtrade.New("", "")
	res, err := c.Ticker(VEOBTC)
	if err != nil {
		fmt.Println(err)
	}

	fmt.Printf("%+v\n", res)
}

Author

@_numbP

License

MIT

Documentation

Index

Constants

View Source
const (
	URL     = "https://api.qtrade.io/"
	VERSION = "v1"

	VEOBTC = "VEO_BTC"
	LTCBTC = "LTC_BTC"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Balances

type Balances struct {
	Data struct {
		Balances []struct {
			Balance  float64 `json:"balance,string"`
			Currency string  `json:"currency"`
		} `json:"balances"`
	} `json:"data"`
}

type Book

type Book struct {
	Price float64
	Size  float64
}

type Books

type Books struct {
	Books []Book
}

func (*Books) UnmarshalJSON

func (p *Books) UnmarshalJSON(b []byte) error

type Client

type Client struct {
	Key, Secret string

	URL        *url.URL
	HTTPClient *http.Client
}

func New

func New(key, secret string) *Client

func (*Client) Balances

func (p *Client) Balances() (*Balances, error)

func (*Client) Executions

func (p *Client) Executions(code string) (*Executions, error)

func (*Client) Orderbook

func (p *Client) Orderbook(code string) (*Orderbook, error)

func (*Client) Ticker

func (p *Client) Ticker(code string) (*Ticker, error)

type Executions

type Executions struct {
	Data struct {
		Trades []struct {
			Amount      float64   `json:"amount,string"`
			CreatedAt   time.Time `json:"created_at"`
			Price       float64   `json:"price,string"`
			SellerTaker bool      `json:"seller_taker"`
		} `json:"trades"`
	} `json:"data"`
}

type Orderbook

type Orderbook struct {
	Data struct {
		BestAsk, BestBid float64
		Buy              Books `json:"buy"`
		Sell             Books `json:"sell"`
	} `json:"data"`
}

type Ticker

type Ticker struct {
	Data struct {
		Ask             float64 `json:"ask,string"`
		Bid             float64 `json:"bid,string"`
		DayAvgPrice     float64 `json:"day_avg_price,string"`
		DayChange       float64 `json:"day_change,string"`
		DayHigh         float64 `json:"day_high,string"`
		DayLow          float64 `json:"day_low,string"`
		DayOpen         float64 `json:"day_open,string"`
		DayVolumeBase   float64 `json:"day_volume_base,string"`
		DayVolumeMarket float64 `json:"day_volume_market,string"`
		ID              int     `json:"id"`
		IDHr            string  `json:"id_hr"`
		Last            float64 `json:"last,string"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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