Documentation
¶
Index ¶
- Constants
- func PastUnixTime(t time.Duration) int64
- type AggregatedProviderCandles
- type AggregatedProviderPrices
- type BinanceCandle
- type BinanceCandleMetadata
- type BinancePairSummary
- type BinanceProvider
- func (p *BinanceProvider) GetAvailablePairs() (map[string]struct{}, error)
- func (p *BinanceProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
- func (p *BinanceProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
- func (p *BinanceProvider) SubscribeCurrencyPairs(cps ...types.CurrencyPair) error
- type BinanceSubscriptionMsg
- type BinanceTicker
- type CandlePrice
- type CoinbaseErrResponse
- type CoinbasePairSummary
- type CoinbaseProvider
- func (p *CoinbaseProvider) GetAvailablePairs() (map[string]struct{}, error)
- func (p *CoinbaseProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
- func (p *CoinbaseProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
- func (p *CoinbaseProvider) SubscribeCurrencyPairs(cps ...types.CurrencyPair) error
- type CoinbaseSubscriptionMsg
- type CoinbaseTicker
- type CoinbaseTrade
- type CoinbaseTradeResponse
- type GateCandle
- type GateCandleResponse
- type GateCandleSubscriptionMsg
- type GateEvent
- type GateEventResult
- type GatePairSummary
- type GateProvider
- func (p *GateProvider) GetAvailablePairs() (map[string]struct{}, error)
- func (p *GateProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
- func (p *GateProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
- func (p *GateProvider) SubscribeCurrencyPairs(cps ...types.CurrencyPair) error
- type GateTicker
- type GateTickerResponse
- type GateTickerSubscriptionMsg
- type HuobiCandle
- type HuobiCandleTick
- type HuobiPairData
- type HuobiPairsSummary
- type HuobiProvider
- func (p *HuobiProvider) GetAvailablePairs() (map[string]struct{}, error)
- func (p *HuobiProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
- func (p *HuobiProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
- func (p *HuobiProvider) SubscribeCurrencyPairs(cps ...types.CurrencyPair) error
- type HuobiSubscriptionMsg
- type HuobiTick
- type HuobiTicker
- type KrakenCandle
- type KrakenEvent
- type KrakenEventSubscriptionStatus
- type KrakenEventSystemStatus
- type KrakenPairData
- type KrakenPairsSummary
- type KrakenProvider
- func (p *KrakenProvider) GetAvailablePairs() (map[string]struct{}, error)
- func (p *KrakenProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
- func (p *KrakenProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
- func (p *KrakenProvider) SubscribeCurrencyPairs(cps ...types.CurrencyPair) error
- type KrakenSubscriptionChannel
- type KrakenSubscriptionMsg
- type KrakenTicker
- type MockProvider
- func (p MockProvider) GetAvailablePairs() (map[string]struct{}, error)
- func (p MockProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
- func (p MockProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
- func (p MockProvider) SubscribeCurrencyPairs(pairs ...types.CurrencyPair) error
- type OkxCandlePair
- type OkxCandleResponse
- type OkxID
- type OkxInstId
- type OkxPairsSummary
- type OkxProvider
- func (p *OkxProvider) GetAvailablePairs() (map[string]struct{}, error)
- func (p *OkxProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
- func (p *OkxProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
- func (p *OkxProvider) SubscribeCurrencyPairs(cps ...types.CurrencyPair) error
- type OkxSubscriptionMsg
- type OkxSubscriptionTopic
- type OkxTickerPair
- type OkxTickerResponse
- type OsmosisCandleResponse
- type OsmosisPairData
- type OsmosisPairsSummary
- type OsmosisProvider
- func (p OsmosisProvider) GetAvailablePairs() (map[string]struct{}, error)
- func (p OsmosisProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
- func (p OsmosisProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
- func (p OsmosisProvider) SubscribeCurrencyPairs(pairs ...types.CurrencyPair) error
- type OsmosisTokenResponse
- type Provider
- type TickerPrice
Constants ¶
const (
KrakenPairsEndpoint = "https://api.kraken.com/0/public/AssetPairs"
)
Variables ¶
This section is empty.
Functions ¶
func PastUnixTime ¶ added in v0.1.2
PastUnixTime returns a millisecond timestamp that represents the unix time minus t.
Types ¶
type AggregatedProviderCandles ¶ added in v0.1.2
type AggregatedProviderCandles map[string]map[string][]CandlePrice
AggregatedProviderCandles defines a type alias for a map of provider -> asset -> []CandlePrice
type AggregatedProviderPrices ¶ added in v0.1.2
type AggregatedProviderPrices map[string]map[string]TickerPrice
AggregatedProviderPrices defines a type alias for a map of provider -> asset -> TickerPrice
type BinanceCandle ¶ added in v0.1.2
type BinanceCandle struct { Symbol string `json:"s"` // Symbol ex.: BTCUSDT Metadata BinanceCandleMetadata `json:"k"` // Metadata for candle }
BinanceCandle candle binance websocket channel "kline_1m" response.
type BinanceCandleMetadata ¶ added in v0.1.2
type BinanceCandleMetadata struct { Close string `json:"c"` // Price at close TimeStamp int64 `json:"T"` // Close time in unix epoch ex.: 1645756200000 Volume string `json:"v"` // Volume during period }
BinanceCandleMetadata candle metadata used to compute tvwap price.
type BinancePairSummary ¶ added in v0.1.3
type BinancePairSummary struct {
Symbol string `json:"symbol"`
}
BinancePairSummary defines the response structure for a Binance pair summary.
type BinanceProvider ¶
type BinanceProvider struct {
// contains filtered or unexported fields
}
BinanceProvider defines an Oracle provider implemented by the Binance public API.
REF: https://binance-docs.github.io/apidocs/spot/en/#individual-symbol-mini-ticker-stream REF: https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-streams
func NewBinanceProvider ¶
func NewBinanceProvider(ctx context.Context, logger zerolog.Logger, pairs ...types.CurrencyPair) (*BinanceProvider, error)
func (*BinanceProvider) GetAvailablePairs ¶ added in v0.1.3
func (p *BinanceProvider) GetAvailablePairs() (map[string]struct{}, error)
GetAvailablePairs returns all pairs to which the provider can subscribe. ex.: map["ATOMUSDT" => {}, "UMEEUSDC" => {}].
func (*BinanceProvider) GetCandlePrices ¶ added in v0.1.2
func (p *BinanceProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
GetCandlePrices returns the candlePrices based on the provided pairs.
func (*BinanceProvider) GetTickerPrices ¶
func (p *BinanceProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
GetTickerPrices returns the tickerPrices based on the provided pairs.
func (*BinanceProvider) SubscribeCurrencyPairs ¶ added in v0.1.2
func (p *BinanceProvider) SubscribeCurrencyPairs(cps ...types.CurrencyPair) error
SubscribeCurrencyPairs subscribe all currency pairs into ticker and candle channels.
type BinanceSubscriptionMsg ¶ added in v0.1.1
type BinanceSubscriptionMsg struct { Method string `json:"method"` // SUBSCRIBE/UNSUBSCRIBE Params []string `json:"params"` // streams to subscribe ex.: usdtatom@ticker ID uint16 `json:"id"` // identify messages going back and forth }
BinanceSubscribeMsg Msg to subscribe all the tickers channels.
type BinanceTicker ¶ added in v0.1.1
type BinanceTicker struct { Symbol string `json:"s"` // Symbol ex.: BTCUSDT LastPrice string `json:"c"` // Last price ex.: 0.0025 Volume string `json:"v"` // Total traded base asset volume ex.: 1000 C uint64 `json:"C"` // Statistics close time }
BinanceTicker ticker price response. https://pkg.go.dev/encoding/json#Unmarshal Unmarshal matches incoming object keys to the keys used by Marshal (either the struct field name or its tag), preferring an exact match but also accepting a case-insensitive match. C field which is Statistics close time is not used, but it avoids to implement specific UnmarshalJSON.
type CandlePrice ¶ added in v0.1.2
type CandlePrice struct { Price sdk.Dec // last trade price Volume sdk.Dec // volume TimeStamp int64 // timestamp }
CandlePrice defines price, volume, and time information for an exchange rate.
type CoinbaseErrResponse ¶ added in v0.1.4
type CoinbaseErrResponse struct { Type string `json:"type"` // should be "error" Reason string `json:"reason"` // ex.: "tickers" is not a valid channel }
CoinbaseErrResponse defines the response body for errors.
type CoinbasePairSummary ¶ added in v0.1.4
type CoinbasePairSummary struct { Base string `json:"base_currency"` Quote string `json:"quote_currency"` }
CoinbasePairSummary defines the response structure for a Coinbase pair summary.
type CoinbaseProvider ¶ added in v0.1.4
type CoinbaseProvider struct {
// contains filtered or unexported fields
}
CoinbaseProvider defines an Oracle provider implemented by the Coinbase public API.
REF: https://www.coinbase.io/docs/websocket/index.html
func NewCoinbaseProvider ¶ added in v0.1.4
func NewCoinbaseProvider(ctx context.Context, logger zerolog.Logger, pairs ...types.CurrencyPair) (*CoinbaseProvider, error)
NewCoinbaseProvider creates a new CoinbaseProvider.
func (*CoinbaseProvider) GetAvailablePairs ¶ added in v0.1.4
func (p *CoinbaseProvider) GetAvailablePairs() (map[string]struct{}, error)
GetAvailablePairs returns all pairs to which the provider can subscribe.
func (*CoinbaseProvider) GetCandlePrices ¶ added in v0.1.4
func (p *CoinbaseProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
GetCandlePrices returns candles based off of the saved trades map. Candles need to be cut up into one-minute intervals.
func (*CoinbaseProvider) GetTickerPrices ¶ added in v0.1.4
func (p *CoinbaseProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
GetTickerPrices returns the tickerPrices based on the saved map.
func (*CoinbaseProvider) SubscribeCurrencyPairs ¶ added in v0.1.4
func (p *CoinbaseProvider) SubscribeCurrencyPairs(cps ...types.CurrencyPair) error
SubscribeCurrencyPairs subscribes to websockets for all currency pairs.
type CoinbaseSubscriptionMsg ¶ added in v0.1.4
type CoinbaseSubscriptionMsg struct { Type string `json:"type"` // ex. "subscribe" ProductIDs []string `json:"product_ids"` // streams to subscribe ex.: ["BOT-USDT", ...] Channels []string `json:"channels"` // channels to subscribe to ex.: "ticker" }
CoinbaseSubscriptionMsg Msg to subscribe to all channels.
type CoinbaseTicker ¶ added in v0.1.4
type CoinbaseTicker struct { ProductID string `json:"product_id"` // ex.: ATOM-USDT Price string `json:"price"` // ex.: 523.0 Volume string `json:"volume_24h"` // 24-hour volume }
CoinbaseTicker defines the ticker info we'd like to save.
type CoinbaseTrade ¶ added in v0.1.4
type CoinbaseTrade struct { ProductID string // ex.: ATOM-USDT Time int64 // Time in unix epoch ex.: 164732388700 Size string // Size of the trade ex.: 10.41 Price string // ex.: 14.02 }
CoinbaseTrade defines the trade info we'd like to save.
type CoinbaseTradeResponse ¶ added in v0.1.4
type CoinbaseTradeResponse struct { Type string `json:"type"` // "last_match" or "match" ProductID string `json:"product_id"` // ex.: ATOM-USDT Time string `json:"time"` // Time in format 2006-01-02T15:04:05.000000Z Size string `json:"size"` // Size of the trade ex.: 10.41 Price string `json:"price"` // ex.: 14.02 }
CoinbaseMatchResponse defines the response body for coinbase trades.
type GateCandle ¶ added in v0.1.2
type GateCandle struct { Close string // Closing price TimeStamp int64 // Unix timestamp Volume string // Total candle volume Symbol string // Total symbol }
func (*GateCandle) UnmarshalParams ¶ added in v0.1.2
func (gc *GateCandle) UnmarshalParams(params [][]interface{}) error
UnmarshalParams is a helper function which unmarshals the 2d slice of interfaces from a GateCandleResponse into the GateCandle.
type GateCandleResponse ¶ added in v0.1.2
type GateCandleResponse struct { Method string `json:"method"` Params [][]interface{} `json:"params"` }
GateTickerResponse defines the response body for gate tickers. The Params response is a 2D slice of multiple candles and their data.
type GateCandleSubscriptionMsg ¶ added in v0.1.2
type GateCandleSubscriptionMsg struct { Method string `json:"method"` // ticker.subscribe Params []interface{} `json:"params"` // streams to subscribe ex.: ["BOT_USDT": 1800] ID uint16 `json:"id"` // identify messages going back and forth }
GateCandleSubscriptionMsg Msg to subscribe to a candle channel.
type GateEvent ¶ added in v0.1.2
type GateEvent struct { ID int `json:"id"` // subscription id, ex.: 123 Result GateEventResult `json:"result"` // event result body }
GateEvent defines the response body for gate subscription statuses.
type GateEventResult ¶ added in v0.1.2
type GateEventResult struct {
Status string `json:"status"` // ex. "successful"
}
GateEventResult defines the Result body for the GateEvent response.
type GatePairSummary ¶ added in v0.1.3
GatePairSummary defines the response structure for a Gate pair summary.
type GateProvider ¶ added in v0.1.2
type GateProvider struct {
// contains filtered or unexported fields
}
GateProvider defines an Oracle provider implemented by the Gate public API.
REF: https://www.gate.io/docs/websocket/index.html
func NewGateProvider ¶ added in v0.1.2
func NewGateProvider(ctx context.Context, logger zerolog.Logger, pairs ...types.CurrencyPair) (*GateProvider, error)
NewGateProvider creates a new GateProvider.
func (*GateProvider) GetAvailablePairs ¶ added in v0.1.3
func (p *GateProvider) GetAvailablePairs() (map[string]struct{}, error)
GetAvailablePairs returns all pairs to which the provider can subscribe.
func (*GateProvider) GetCandlePrices ¶ added in v0.1.2
func (p *GateProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
GetCandlePrices returns the candlePrices based on the saved map
func (*GateProvider) GetTickerPrices ¶ added in v0.1.2
func (p *GateProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
GetTickerPrices returns the tickerPrices based on the saved map.
func (*GateProvider) SubscribeCurrencyPairs ¶ added in v0.1.2
func (p *GateProvider) SubscribeCurrencyPairs(cps ...types.CurrencyPair) error
SubscribeCurrencyPairs subscribe to ticker and candle channels for all pairs.
type GateTicker ¶ added in v0.1.2
type GateTickerResponse ¶ added in v0.1.2
type GateTickerResponse struct { Method string `json:"method"` Params []interface{} `json:"params"` }
GateTickerResponse defines the response body for gate tickers.
type GateTickerSubscriptionMsg ¶ added in v0.1.2
type GateTickerSubscriptionMsg struct { Method string `json:"method"` // ticker.subscribe Params []string `json:"params"` // streams to subscribe ex.: BOT_USDT ID uint16 `json:"id"` // identify messages going back and forth }
GateTickerSubscriptionMsg Msg to subscribe all the tickers channels.
type HuobiCandle ¶ added in v0.1.2
type HuobiCandle struct { CH string `json:"ch"` // Channel name. Format:market.$symbol.kline.$period Tick HuobiCandleTick `json:"tick"` }
HuobiCandle defines the response type for the channel and the tick object for a given ticker/symbol.
type HuobiCandleTick ¶ added in v0.1.2
type HuobiCandleTick struct { Close float64 `json:"close"` // Closing price during this period TimeStamp int64 `json:"id"` // TimeStamp for this as an ID Volume float64 `json:"vol"` // Volume during this period }
HuobiCandleTick defines the response type for the candle.
type HuobiPairData ¶ added in v0.1.3
type HuobiPairData struct {
Symbol string `json:"symbol"`
}
HuobiPairData defines the data response structure for an Huobi pair.
type HuobiPairsSummary ¶ added in v0.1.3
type HuobiPairsSummary struct {
Data []HuobiPairData `json:"data"`
}
HuobiPairsSummary defines the response structure for an Huobi pairs summary.
type HuobiProvider ¶
type HuobiProvider struct {
// contains filtered or unexported fields
}
HuobiProvider defines an Oracle provider implemented by the Huobi public API.
REF: https://huobiapi.github.io/docs/spot/v1/en/#market-ticker REF: https://huobiapi.github.io/docs/spot/v1/en/#get-klines-candles
func NewHuobiProvider ¶
func NewHuobiProvider(ctx context.Context, logger zerolog.Logger, pairs ...types.CurrencyPair) (*HuobiProvider, error)
NewHuobiProvider returns a new Huobi provider with the WS connection and msg handler.
func (*HuobiProvider) GetAvailablePairs ¶ added in v0.1.3
func (p *HuobiProvider) GetAvailablePairs() (map[string]struct{}, error)
GetAvailablePairs returns all pairs to which the provider can subscribe.
func (*HuobiProvider) GetCandlePrices ¶ added in v0.1.2
func (p *HuobiProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
GetTickerPrices returns the tickerPrices based on the saved map.
func (*HuobiProvider) GetTickerPrices ¶
func (p *HuobiProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
GetTickerPrices returns the tickerPrices based on the saved map.
func (*HuobiProvider) SubscribeCurrencyPairs ¶ added in v0.1.2
func (p *HuobiProvider) SubscribeCurrencyPairs(cps ...types.CurrencyPair) error
SubscribeCurrencyPairs subscribe all currency pairs into ticker and candle channels.
type HuobiSubscriptionMsg ¶ added in v0.1.1
type HuobiSubscriptionMsg struct {
Sub string `json:"sub"` // channel to subscribe market.$symbol.ticker
}
HuobiSubscriptionMsg Msg to subscribe to one ticker channel at time.
type HuobiTick ¶ added in v0.1.1
type HuobiTick struct { Vol float64 `json:"vol"` // Accumulated trading value of last 24 hours LastPrice float64 `json:"lastPrice"` // Last traded price }
HuobiTick defines the response type for the last 24h market summary and the last traded price for a given ticker/symbol.
type HuobiTicker ¶ added in v0.1.1
type HuobiTicker struct { CH string `json:"ch"` // Channel name. Format:market.$symbol.ticker Tick HuobiTick `json:"tick"` }
HuobiTicker defines the response type for the channel and the tick object for a given ticker/symbol.
type KrakenCandle ¶ added in v0.1.2
type KrakenCandle struct { Close string // Close price during this period TimeStamp int64 // Linux epoch timestamp Volume string // Volume during this period Symbol string // Symbol for this candle }
KrakenCandle candle response from Kraken candle channel. REF: https://docs.kraken.com/websockets/#message-ohlc
func (*KrakenCandle) UnmarshalJSON ¶ added in v0.1.2
func (kc *KrakenCandle) UnmarshalJSON(buf []byte) error
type KrakenEvent ¶ added in v0.1.1
type KrakenEvent struct {
Event string `json:"event"` // events from kraken ex.: systemStatus | subscriptionStatus
}
KrakenEvent wraps the possible events from the provider.
type KrakenEventSubscriptionStatus ¶ added in v0.1.1
type KrakenEventSubscriptionStatus struct { Status string `json:"status"` // subscribed|unsubscribed|error Pair string `json:"pair"` // Pair symbol base/quote ex.: "XBT/USD" ErrorMessage string `json:"errorMessage"` // error description }
KrakenEventSubscriptionStatus parse the subscriptionStatus event message.
type KrakenEventSystemStatus ¶ added in v0.1.1
type KrakenEventSystemStatus struct {
Status string `json:"status"` // online|maintenance|cancel_only|limit_only|post_only
}
KrakenEventSystemStatus parse the systemStatus event message.
type KrakenPairData ¶ added in v0.1.3
type KrakenPairData struct {
WsName string `json:"wsname"`
}
KrakenPairData defines the data response structure for an Kraken pair.
type KrakenPairsSummary ¶ added in v0.1.3
type KrakenPairsSummary struct {
Result map[string]KrakenPairData `json:"result"`
}
KrakenPairsSummary defines the response structure for an Kraken pairs summary.
type KrakenProvider ¶
type KrakenProvider struct {
// contains filtered or unexported fields
}
KrakenProvider defines an Oracle provider implemented by the Kraken public API.
REF: https://docs.kraken.com/websockets/#overview
func NewKrakenProvider ¶
func NewKrakenProvider(ctx context.Context, logger zerolog.Logger, pairs ...types.CurrencyPair) (*KrakenProvider, error)
NewKrakenProvider returns a new Kraken provider with the WS connection and msg handler.
func (*KrakenProvider) GetAvailablePairs ¶ added in v0.1.3
func (p *KrakenProvider) GetAvailablePairs() (map[string]struct{}, error)
GetAvailablePairs returns all pairs to which the provider can subscribe.
func (*KrakenProvider) GetCandlePrices ¶ added in v0.1.2
func (p *KrakenProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
GetCandlePrices returns the candlePrices based on the saved map.
func (*KrakenProvider) GetTickerPrices ¶
func (p *KrakenProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
GetTickerPrices returns the tickerPrices based on the saved map.
func (*KrakenProvider) SubscribeCurrencyPairs ¶ added in v0.1.2
func (p *KrakenProvider) SubscribeCurrencyPairs(cps ...types.CurrencyPair) error
SubscribeCurrencyPairs subscribe all currency pairs into ticker and candle channels.
type KrakenSubscriptionChannel ¶ added in v0.1.1
type KrakenSubscriptionChannel struct {
Name string `json:"name"` // channel to be subscribed ex.: ticker
}
KrakenSubscriptionChannel Msg with the channel name to be subscribed.
type KrakenSubscriptionMsg ¶ added in v0.1.1
type KrakenSubscriptionMsg struct { Event string `json:"event"` // subscribe/unsubscribe Pair []string `json:"pair"` // Array of currency pairs ex.: "BTC/USDT", Subscription KrakenSubscriptionChannel `json:"subscription"` // subscription object }
KrakenSubscriptionMsg Msg to subscribe to all the pairs at once.
type KrakenTicker ¶ added in v0.1.1
type KrakenTicker struct { C []string `json:"c"` // Close with Price in the first position V []string `json:"v"` // Volume with the value over last 24 hours in the second position }
KrakenTicker ticker price response from Kraken ticker channel. REF: https://docs.kraken.com/websockets/#message-ticker
type MockProvider ¶
type MockProvider struct {
// contains filtered or unexported fields
}
MockProvider defines a mocked exchange rate provider using a published Google sheets document to fetch mocked/fake exchange rates.
func NewMockProvider ¶
func NewMockProvider() *MockProvider
func (MockProvider) GetAvailablePairs ¶ added in v0.1.3
func (p MockProvider) GetAvailablePairs() (map[string]struct{}, error)
GetAvailablePairs return all available pairs symbol to susbscribe.
func (MockProvider) GetCandlePrices ¶ added in v0.1.2
func (p MockProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
func (MockProvider) GetTickerPrices ¶
func (p MockProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
func (MockProvider) SubscribeCurrencyPairs ¶ added in v0.1.2
func (p MockProvider) SubscribeCurrencyPairs(pairs ...types.CurrencyPair) error
SubscribeCurrencyPairs performs a no-op since mock does not use websockets
type OkxCandlePair ¶ added in v0.1.2
type OkxCandlePair struct { Close string `json:"c"` // Close price for this time period TimeStamp int64 `json:"ts"` // Linux epoch timestamp Volume string `json:"vol"` // Volume for this time period InstId string `json:"instId"` // Instrument ID ex.: BTC-USDT }
OkxCandlePair defines a candle for Okx.
type OkxCandleResponse ¶ added in v0.1.2
OkxCandleResponse defines the response structure of a Okx candle request.
type OkxID ¶ added in v0.1.2
OkxInst defines the structure containing ID information for the OkxResponses.
type OkxInstId ¶ added in v0.1.3
type OkxInstId struct {
InstID string `json:"instId"` // Instrument ID ex.: BTC-USDT
}
OkxInstId defines the id Symbol of an pair.
type OkxPairsSummary ¶ added in v0.1.3
type OkxPairsSummary struct {
Data []OkxInstId `json:"data"`
}
OkxPairsSummary defines the response structure for an Okx pairs summary.
type OkxProvider ¶ added in v0.1.1
type OkxProvider struct {
// contains filtered or unexported fields
}
OkxProvider defines an Oracle provider implemented by the Okx public API.
REF: https://www.okx.com/docs-v5/en/#websocket-api-public-channel-tickers-channel
func NewOkxProvider ¶ added in v0.1.1
func NewOkxProvider(ctx context.Context, logger zerolog.Logger, pairs ...types.CurrencyPair) (*OkxProvider, error)
NewOkxProvider creates a new OkxProvider.
func (*OkxProvider) GetAvailablePairs ¶ added in v0.1.3
func (p *OkxProvider) GetAvailablePairs() (map[string]struct{}, error)
GetAvailablePairs return all available pairs symbol to susbscribe.
func (*OkxProvider) GetCandlePrices ¶ added in v0.1.2
func (p *OkxProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
GetCandlePrices returns the candlePrices based on the saved map
func (*OkxProvider) GetTickerPrices ¶ added in v0.1.1
func (p *OkxProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
GetTickerPrices returns the tickerPrices based on the saved map.
func (*OkxProvider) SubscribeCurrencyPairs ¶ added in v0.1.2
func (p *OkxProvider) SubscribeCurrencyPairs(cps ...types.CurrencyPair) error
SubscribeCurrencyPairs subscribe all currency pairs into ticker and candle channels.
type OkxSubscriptionMsg ¶ added in v0.1.1
type OkxSubscriptionMsg struct { Op string `json:"op"` // Operation ex.: subscribe Args []OkxSubscriptionTopic `json:"args"` }
OkxSubscriptionMsg Message to subscribe/unsubscribe with N Topics.
type OkxSubscriptionTopic ¶ added in v0.1.1
type OkxSubscriptionTopic struct { Channel string `json:"channel"` // Channel name ex.: tickers InstId string `json:"instId"` // Instrument ID ex.: BTC-USDT }
OkxSubscriptionTopic Topic with the ticker to be subscribed/unsubscribed.
type OkxTickerPair ¶ added in v0.1.1
type OkxTickerPair struct { OkxInstId Last string `json:"last"` // Last traded price ex.: 43508.9 Vol24h string `json:"vol24h"` // 24h trading volume ex.: 11159.87127845 }
OkxTickerPair defines a ticker pair of Okx.
type OkxTickerResponse ¶ added in v0.1.1
type OkxTickerResponse struct { Data []OkxTickerPair `json:"data"` ID OkxID `json:"arg"` }
OkxTickerResponse defines the response structure of a Okx ticker request.
type OsmosisCandleResponse ¶ added in v0.1.2
type OsmosisCandleResponse struct { Time int64 `json:"time"` Close float64 `json:"close"` Volume float64 `json:"volume"` }
OsmosisCandleResponse defines the response structure for an Osmosis candle request.
type OsmosisPairData ¶ added in v0.1.3
OsmosisPairData defines the data response structure for an Osmosis pair.
type OsmosisPairsSummary ¶ added in v0.1.3
type OsmosisPairsSummary struct {
Data []OsmosisPairData `json:"data"`
}
OsmosisPairsSummary defines the response structure for an Osmosis pairs summary.
type OsmosisProvider ¶
type OsmosisProvider struct {
// contains filtered or unexported fields
}
OsmosisProvider defines an Oracle provider implemented by the Osmosis public API.
REF: https://api-osmosis.imperator.co/swagger/
func NewOsmosisProvider ¶
func NewOsmosisProvider() *OsmosisProvider
func NewOsmosisProviderWithTimeout ¶
func NewOsmosisProviderWithTimeout(timeout time.Duration) *OsmosisProvider
func (OsmosisProvider) GetAvailablePairs ¶ added in v0.1.3
func (p OsmosisProvider) GetAvailablePairs() (map[string]struct{}, error)
GetAvailablePairs return all available pairs symbol to susbscribe.
func (OsmosisProvider) GetCandlePrices ¶ added in v0.1.2
func (p OsmosisProvider) GetCandlePrices(pairs ...types.CurrencyPair) (map[string][]CandlePrice, error)
func (OsmosisProvider) GetTickerPrices ¶
func (p OsmosisProvider) GetTickerPrices(pairs ...types.CurrencyPair) (map[string]TickerPrice, error)
func (OsmosisProvider) SubscribeCurrencyPairs ¶ added in v0.1.2
func (p OsmosisProvider) SubscribeCurrencyPairs(pairs ...types.CurrencyPair) error
SubscribeCurrencyPairs performs a no-op since osmosis does not use websockets
type OsmosisTokenResponse ¶
type OsmosisTokenResponse struct { Price float64 `json:"price"` Symbol string `json:"symbol"` Volume float64 `json:"volume_24h"` }
OsmosisTokenResponse defines the response structure for an Osmosis token request.
type Provider ¶
type Provider interface { // GetTickerPrices returns the tickerPrices based on the provided pairs. GetTickerPrices(...types.CurrencyPair) (map[string]TickerPrice, error) // GetCandlePrices returns the candlePrices based on the provided pairs. GetCandlePrices(...types.CurrencyPair) (map[string][]CandlePrice, error) // GetAvailablePairs return all available pairs symbol to susbscribe. GetAvailablePairs() (map[string]struct{}, error) // SubscribeCurrencyPairs subscribe to ticker and candle channels for all pairs. SubscribeCurrencyPairs(...types.CurrencyPair) error }
Provider defines an interface an exchange price provider must implement.