ticks

package
v0.0.0-...-cddd04e Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: ISC Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Bittrex    = "bittrex"
	Bittrexusd = Bittrex + "usd"

	Poloniex = "poloniex"

	Binance = "binance"

	IntervalShort    = "short"
	IntervalLong     = "long"
	IntervalHistoric = "historic"
)

Variables

Functions

This section is empty.

Types

type Collector

type Collector interface {
	GetShort(context.Context) error
	GetLong(context.Context) error
	GetHistoric(context.Context) error
}

func NewBinanceCollector

func NewBinanceCollector(ctx context.Context, store Store) (Collector, error)

func NewBittrexCollector

func NewBittrexCollector(ctx context.Context, store Store) (Collector, error)

func NewBittrexUSDCollector

func NewBittrexUSDCollector(ctx context.Context, store Store) (Collector, error)

func NewPoloniexCollector

func NewPoloniexCollector(ctx context.Context, store Store) (Collector, error)

type ExchangeData

type ExchangeData struct {
	ID         int
	Name       string
	WebsiteURL string

	ShortInterval    time.Duration
	LongInterval     time.Duration
	HistoricInterval time.Duration
	// contains filtered or unexported fields
}

type Store

type Store interface {
	ExchangeTickTableName() string
	ExchangeTableName() string
	RegisterExchange(ctx context.Context, exchange ExchangeData) (lastShort, lastLong, lastHistoric time.Time, err error)
	FetchExchangeForSync(ctx context.Context, lastID int, skip, take int) ([]ExchangeData, int64, error)
	StoreExchangeTicks(ctx context.Context, exchange string, interval int, pair string, data []Tick) (time.Time, error)
	LastExchangeTickEntryTime() (time time.Time)
}

type Tick

type Tick struct {
	High   float64
	Low    float64
	Open   float64
	Close  float64
	Volume float64
	Time   time.Time
}

Tick represents an exchange data tick

type TickChartData

type TickChartData struct {
	Filter float64   `json:"filter"`
	Time   time.Time `json:"time"`
}

TickDto represents an exchange data, formatted for presentation

type TickDto

type TickDto struct {
	ExchangeID   int     `json:"exchange_id"`
	ExchangeName string  `json:"exchange_name"`
	High         float64 `json:"high"`
	Low          float64 `json:"low"`
	Open         float64 `json:"open"`
	Close        float64 `json:"close"`
	Volume       float64 `json:"volume"`
	Time         string  `json:"time"`
	Interval     int     `json:"interval"`
	CurrencyPair string  `json:"currency_pair"`
}

TickDto represents an exchange data, formatted for presentation

type TickDtoCP

type TickDtoCP struct {
	CurrencyPair string `json:"currency_pair"`
}

type TickDtoInterval

type TickDtoInterval struct {
	Interval int `json:"interval"`
}

type TickSyncDto

type TickSyncDto struct {
	ExchangeID   int       `json:"exchange_id"`
	ID           int       `json:"id"`
	ExchangeName string    `json:"exchange_name"`
	High         float64   `json:"high"`
	Low          float64   `json:"low"`
	Open         float64   `json:"open"`
	Close        float64   `json:"close"`
	Volume       float64   `json:"volume"`
	Time         time.Time `json:"time"`
	Interval     int       `json:"interval"`
	CurrencyPair string    `json:"currency_pair"`
}

TickSyncDto represents an exchange data, structured for sharing

Jump to

Keyboard shortcuts

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