Documentation
¶
Overview ¶
Package exchange defines a focused store for core-mint exchange rate records.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store interface {
// PutExchangeRates puts exchange rate records for the core mint into the store.
//
// currency.ErrExists is returned if records already exist for the provided time.
PutExchangeRates(ctx context.Context, record *currency.MultiRateRecord) error
// GetExchangeRate gets price information given a certain time and currency symbol
// for the core mint. The most recent record at or before the requested time is
// returned.
//
// currency.ErrNotFound is returned if no price data exists at or before the provided time.
GetExchangeRate(ctx context.Context, symbol string, t time.Time) (*currency.ExchangeRateRecord, error)
// GetAllExchangeRates gets price information given a certain time for the core mint.
// The most recent record at or before the requested time is returned.
//
// currency.ErrNotFound is returned if no price data exists at or before the provided time.
GetAllExchangeRates(ctx context.Context, t time.Time) (*currency.MultiRateRecord, error)
// GetExchangeRatesInRange gets the price information for a range of time given a currency
// symbol and interval for the core mint. The start and end timestamps are provided along
// with the interval.
//
// currency.ErrNotFound is returned if the symbol or the exchange rates for the symbol cannot be found
// currency.ErrInvalidRange is returned if the range is not valid
// currency.ErrInvalidInterval is returned if the interval is not valid
GetExchangeRatesInRange(ctx context.Context, symbol string, interval query.Interval, start time.Time, end time.Time, ordering query.Ordering) ([]*currency.ExchangeRateRecord, error)
}
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cache provides an exchange.Store decorator that caches single- and all-symbol rate lookups in front of a wrapped store.
|
Package cache provides an exchange.Store decorator that caches single- and all-symbol rate lookups in front of a wrapped store. |
|
Package dynamodb implements the exchange.Store interface on top of DynamoDB.
|
Package dynamodb implements the exchange.Store interface on top of DynamoDB. |
|
Package memory provides an in-memory exchange.Store implementation for fast unit tests.
|
Package memory provides an in-memory exchange.Store implementation for fast unit tests. |
|
Package tests holds the shared conformance suite run against every exchange.Store implementation.
|
Package tests holds the shared conformance suite run against every exchange.Store implementation. |
Click to show internal directories.
Click to hide internal directories.