price

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: Apache-2.0, Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryHistory = "history"
	QueryCandles = "candles"
	QueryDaily   = "daily"
	MaxTicks     = 2000
)
View Source
const (
	CandleInterval1M  CandleInterval = "1m"
	CandleInterval5M                 = "5m"
	CandleInterval15M                = "15m"
	CandleInterval30M                = "30m"
	CandleInterval60M                = "60m"
)
View Source
const (
	EntityName = "price"
)

Variables

This section is empty.

Functions

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

func RegisterRoutes

func RegisterRoutes(ctx context.CLIContext, r *mux.Router, cdc *codec.Codec)

Types

type CandleEntry

type CandleEntry struct {
	Date  time.Time `json:"date"`
	Open  sdk.Uint  `json:"open"`
	Close sdk.Uint  `json:"close"`
	High  sdk.Uint  `json:"high"`
	Low   sdk.Uint  `json:"low"`
}

type CandleInterval

type CandleInterval string

func NewCandleIntervalFromString

func NewCandleIntervalFromString(in string) (CandleInterval, error)

func (CandleInterval) Delta

func (c CandleInterval) Delta() int64

func (*CandleInterval) UnmarshalJSON

func (c *CandleInterval) UnmarshalJSON(data []byte) error

type CandleQueryParams

type CandleQueryParams struct {
	From     time.Time
	To       time.Time
	Interval CandleInterval
}

type CandleQueryResult

type CandleQueryResult struct {
	MarketID store.EntityID `json:"market_id"`
	Pair     string         `json:"pair"`
	Candles  []CandleEntry  `json:"candles"`
}

type DailyQueryResult

type DailyQueryResult struct {
	Pair   string   `json:"pair"`
	Volume sdk.Uint `json:"volume"`
	Change sdk.Dec  `json:"change"`
	Last   sdk.Uint `json:"last"`
	High   sdk.Uint `json:"high"`
	Low    sdk.Uint `json:"low"`
}

type IteratorCB

type IteratorCB func(tick Tick) bool

type Keeper

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

func NewKeeper

func NewKeeper(db dbm.DB, cdc *codec.Codec) Keeper

func (Keeper) IteratorByMarketAndInterval

func (k Keeper) IteratorByMarketAndInterval(mktID store.EntityID, from time.Time, to time.Time, cb IteratorCB)

func (Keeper) OnEvent

func (k Keeper) OnEvent(event interface{}) error

func (Keeper) OnFillEvent

func (k Keeper) OnFillEvent(event types.Fill)

func (Keeper) ReverseIteratorByMarket

func (k Keeper) ReverseIteratorByMarket(mktID store.EntityID, cb IteratorCB)

func (Keeper) ReverseIteratorByMarketFrom

func (k Keeper) ReverseIteratorByMarketFrom(mktID store.EntityID, from time.Time, cb IteratorCB)

type Tick

type Tick struct {
	MarketID    store.EntityID
	Pair        string
	BlockNumber int64
	BlockTime   int64
	Price       sdk.Uint
}

type TickEntry

type TickEntry struct {
	BlockNumber int64    `json:"block_number"`
	Timestamp   int64    `json:"timestamp"`
	Price       sdk.Uint `json:"price"`
}

type TickQueryResult

type TickQueryResult struct {
	MarketID store.EntityID `json:"market_id"`
	Pair     string         `json:"pair"`
	Ticks    []TickEntry    `json:"ticks"`
}

func (TickQueryResult) String

func (t TickQueryResult) String() string

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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