pkg

package
v0.0.0-...-debd72c Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kline

type Kline struct {
	E      string `json:"e"`
	E1     int    `json:"E"`
	Symbol string `json:"s"`
	Kline  struct {
		T               int    `json:"t"`
		T1              int    `json:"T"`
		S               string `json:"s"`
		I               string `json:"i"`
		F               int    `json:"f"`
		L               int    `json:"L"`
		Open            string `json:"o"`
		Close           string `json:"c"`
		High            string `json:"h"`
		Low             string `json:"l"`
		Volume          string `json:"v"`
		Number          int    `json:"n"`
		X               bool   `json:"x"`
		Quantity        string `json:"q"`
		TakeBuyVolume   string `json:"V"`
		TakeBuyQuantity string `json:"Q"`
		B               string `json:"B"`
	} `json:"k"`
}

type KlineMessage

type KlineMessage struct {
	Data Kline `json:"data"`
}

type RedisStorage

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

func (*RedisStorage) Close

func (s *RedisStorage) Close() error

func (*RedisStorage) Get

func (s *RedisStorage) Get(key string) (string, error)

func (*RedisStorage) GetPairsMapping

func (s *RedisStorage) GetPairsMapping() (map[string]string, error)

TODO: check if needed, because it's not easy to work with Rails cache structure

func (*RedisStorage) GetTicker

func (s *RedisStorage) GetTicker(pair string) (*Ticker, error)

func (*RedisStorage) SaveKline

func (s *RedisStorage) SaveKline(kine *Kline, pair string) error

func (*RedisStorage) SaveTicker

func (s *RedisStorage) SaveTicker(ticker *Ticker, pair string) error

func (*RedisStorage) Set

func (s *RedisStorage) Set(key string, value string) error

type Storage

type Storage interface {
	GetPairsMapping() (map[string]string, error)
	GetTicker(string) (*Ticker, error)
	SaveTicker(*Ticker, string) error
	SaveKline(*Kline, string) error
	Set(string, string) error
	Get(string) (string, error)
	Close() error
}

func NewStorage

func NewStorage(connectionUrl string) Storage

type Symbol

type Symbol struct {
	Symbol string `json:"symbol"`
}

type Ticker

type Ticker struct {
	Sym                string      `json:"s"`
	Last               interface{} `json:"c"`
	Bid                string      `json:"b"`
	Ask                string      `json:"a"`
	Volume             string      `json:"q"`
	PriceChangePercent string      `json:"P"`
}

type TickerMessage

type TickerMessage struct {
	Data Ticker `json:"data"`
}

Jump to

Keyboard shortcuts

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