cryptoticker

package module
v0.0.0-...-11dfb10 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2017 License: MIT Imports: 6 Imported by: 0

README

CryptoTicker

Build Status Coverage Status Go Report Card GoDoc

In short: All-in-one cryptocurrency ticker pack

Crypto-currency market ticker API provider around the biggest worldwide markets.

  • Bittrex (BittrexTicker)
  • Poloniex (PoloniexTicker)
  • Bitfinex (Bitfinex)
  • GDAX
  • Kraken
  • Coinone (Coinone)
  • Bithumb (Bithumb)
  • bitFlyer

... Request for more markets are welcome!

Quick Start

go get -u github.com/ssut/cryptoticker

example.go

package main

import (
	"fmt"
	"github.com/ssut/cryptoticker"
)

func main() {
	parser := cryptoticker.NewParser(cryptoticker.PoloniexTicker)
	parsed, err := parser.Parse()
	if err != nil {
		panic(err)
	}

	coins, err := parsed.Coins()
	if err != nil {
		panic(err)
	}

	for _, coin := range coins {
		// coin.Base, coin.Next
		fmt.Println(coin.String())
	}

	tickers, err := parsed.Tickers()
	if err != nil {
		panic(err)
	}

	for _, ticker := range tickers {
		// ticker.Currency (the same object as parsed.Coins())
		// ticker.Volume, ticker.Last, ticker.High, ticker.Low, ticker.First
	}
}

Documentation

Note that this library is unfinished. Because of that there may be major changes to library in the future.

See the document at:

  • GoDoc
  • Hand crafted documentation coming eventually.

License

CryptoTicker is free software licensed under the MIT license. Details provided in the LICENSE file.

Buy me a coffee?

If you feel like buying me a coffee, donations are welcome to:

BTC: 1PkTzRLgcggpfrj4UDqM1PksPYirJs8WqY
ETH: 0x159D5BDCD4971E8CF8F51C5FA01E8B1A8CD25FE1
XMR: 43JCpUNQuH9STRr6nuBWWXULC8qRFRwWhiMd98yJLinVWDiqKZPenszX3B76GD7fv5dBN5uXY78CLP3pknQh9HhyR7ohVCU

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CurrencyPair

type CurrencyPair struct {
	Base string
	Next string
}

CurrencyPair represents a pair of trading currency

func (*CurrencyPair) String

func (p *CurrencyPair) String() string

String returns a unique string based on the given pair

type IParsableTicker

type IParsableTicker interface {
	Coins() ([]*CurrencyPair, error)
	Tickers() ([]*Ticker, error)
}

IParsableTicker represents a object that can parse and return Ticker

type IParser

type IParser interface {
	// Coins returns an array of supported cryptocurrencies
	RawTicker() (IParsableTicker, error)
}

IParser represents a object that can parse and return a IParsableTicker

type Parser

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

Parser represents a Crypto Client

func NewParser

func NewParser(p TickerType) *Parser

NewParser returns a new Crypto Client with specific market

func (*Parser) Parse

func (p *Parser) Parse() (IParsableTicker, error)

Parse tries to fetch and parse ticker data from the market, and returns IParsableTicker

type Ticker

type Ticker struct {
	Currency *CurrencyPair
	Volume   string
	Last     string
	High     string
	Low      string
	First    string
}

Ticker represents a Ticker

type TickerType

type TickerType int

TickerType represents makerts

const (
	CoinoneTicker  TickerType = 1 << iota // Coinone
	BithumbTicker                         // Bithumb
	PoloniexTicker                        // Poloniex
	BittrexTicker                         // Bittrex
	BitfinexTicker                        // Bitfinex
)

Jump to

Keyboard shortcuts

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