collectors

package
v0.0.0-...-bc78c8b Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Pairs = map[string]string{
	"BTC":  "XBT/EUR",
	"ETH":  "ETH/EUR",
	"ADA":  "ADA/EUR",
	"ATOM": "ATOM/EUR",
	"DOT":  "DOT/EUR",
}

Functions

func GetCsv

func GetCsv(file string) (*csv.Reader, error)

GetCsv returns the pointer for a csv file from the filepath

func GetPreviousIntervalDates

func GetPreviousIntervalDates(date time.Time, intervalDuration int) (time.Time, time.Time)

Types

type FileTickerCollector

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

FileTickerCollector collects data from a csv file

func NewFileTickerCollector

func NewFileTickerCollector(options domain.CollectorOptions, indicators *[]domain.Indicator) *FileTickerCollector

NewFileTickerCollector returns an instance of FileTickerCollector

func (*FileTickerCollector) GetTicker

func (ftc *FileTickerCollector) GetTicker(tickerSymbol string) (float32, error)

GetTicker is a stub

func (*FileTickerCollector) Regist

func (ftc *FileTickerCollector) Regist(observable domain.OnNewAssetPrice)

Regist add function to be executed when a new price is received

func (*FileTickerCollector) SetIndicators

func (ftc *FileTickerCollector) SetIndicators(indicators *[]domain.Indicator)

func (*FileTickerCollector) Start

func (ftc *FileTickerCollector) Start()

Start starts collecting data from data source

func (*FileTickerCollector) Stop

func (ftc *FileTickerCollector) Stop()

Stop is a stub

type KrakenCollector

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

KrakenCollector collects data from kraken exchange

func NewKrakenCollector

func NewKrakenCollector(asset string, options domain.CollectorOptions, krakenAPI *krakenapi.KrakenAPI, indicators *[]domain.Indicator) *KrakenCollector

NewKrakenCollector returns an instance of KrakenCollector

func (*KrakenCollector) GetTicker

func (kc *KrakenCollector) GetTicker(tickerSymbol string) (float32, error)

GetTicker calls kraken API to get ticker pair price

func (*KrakenCollector) PublishAssetPrice

func (kc *KrakenCollector) PublishAssetPrice(ohlc *domain.OHLC) error

func (*KrakenCollector) Regist

func (kc *KrakenCollector) Regist(observable domain.OnNewAssetPrice)

Regist add function to be executed when ticker price changes

func (*KrakenCollector) SetIndicators

func (kc *KrakenCollector) SetIndicators(indicators *[]domain.Indicator)

SetIndicators set indicators that listen for price changes

func (*KrakenCollector) Start

func (kc *KrakenCollector) Start()

Start connects to a kraken websocket that send prices variations

func (*KrakenCollector) Stop

func (kc *KrakenCollector) Stop()

Stop closes connection with kraken websocket

type SocketEvent

type SocketEvent struct {
	Event string
}

SocketEvent is a type used to decode kraken websocket messages

type TickerMessage

type TickerMessage struct {
	A []interface{}
	B []interface{}
	V []interface{}
}

TickerMessage is a type used to decode messages of ticker price change events

Jump to

Keyboard shortcuts

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