tickerproxy

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2017 License: MIT Imports: 10 Imported by: 1

README

TickerProxy

TickerProxy is a simple proxy tool for getting the latest crypto financial data from bitcoinaverage.com. The goal is to provide a caching layer between OpenBazaar nodes and the bitcoinaverage.com infrastructure. Eventually the price logic can be enhanced here, for example by average multiple sources of data.

Get your account's API public and private keys from bitcoinaverage.com.

Install

go get github.com/OpenBazaar/tickerproxy

Run

go run "$GOPATH/src/github.com/OpenBazaar/tickerproxy/bin/main.go"

Configuration and defaults

export TICKER_PROXY_PORT="8080" # Port to listen on
export TICKER_PROXY_SPEED="10"  # Number of seconds to wait between updates
export TICKER_PROXY_PUBKEY=""   # API public key from bitcoinaverage.com
export TICKER_PROXY_PRIVKEY=""  # API private key from bitcoinaverage.com

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Proxy

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

Proxy gets data from the API endpoint and caches it

func New

func New(speed int, pubkey string, privkey string) *Proxy

New creates a new `Proxy` with the given credentials and default values

func (*Proxy) Fetch

func (p *Proxy) Fetch() error

Fetch gets the latest data from the API server

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP is an `http.Handler` that just returns the lastest response from the upstream server

func (*Proxy) SetStream added in v0.1.3

func (p *Proxy) SetStream(stream *health.Stream)

SetStream sets the health stream to write to

func (*Proxy) Start

func (p *Proxy) Start()

Start requests the latest data and begins polling every tick

func (*Proxy) Stop

func (p *Proxy) Stop()

Stop makes the `Proxy` stop fetching new data

func (*Proxy) String

func (p *Proxy) String() string

String returns the latest response from the API as a string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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