tickerproxy

package module
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2018 License: MIT Imports: 16 Imported by: 1

README

TickerProxy

TickerProxy gathers the latest financial data from bitcoinaverage.com. The goal is to provide a caching layer between OpenBazaar nodes and the bitcoinaverage.com infrastructure. It provides exchange rates against BTC for all known fiat symbols and a few crypto symbols.

It can writes responses to a local file and/or AWS S3.

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_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
export TICKER_PROXY_OUTFILE="/path/to/file" # A file to write outputs to
export AWS_REGION="us-east-1"               # An AWS region to write to
export AWS_S3_BUCKET="openbazaar-ticker"    # An AWS bucket to write outputs to
export TICKER_BUGSNAG_APIKEY="secretkey"    # A Bugsnag key for error monitoring

Documentation

Index

Constants

View Source
const TestS3Region = "test"

TestS3Region is the region to use in test mode

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, outfile string, s3Region string, s3Bucket string) (*Proxy, error)

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) 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