Documentation ¶
Index ¶
- Variables
- func GetTickersSortedByMarketId(marketToMarketConfig map[uint32]types.MarketConfig) []string
- func MsgQueryAllMarketParamExec(clientCtx client.Context) (testutil.BufferWriter, error)
- func MsgQueryAllMarketPriceExec(clientCtx client.Context) (testutil.BufferWriter, error)
- func NewGockBinanceResponse(responseCode int, tickers []JsonResponse) *gock.Response
- func NewGockBinanceUSResponse(responseCode int, tickers []JsonResponse) *gock.Response
- func NewGockBitfinexResponse(responseCode int, tickers []JsonResponse) *gock.Response
- func SetupExchangeResponses(t *testing.T, responses map[ExchangeIdAndName]Response)
- type BinanceTicker
- type BitfinexTicker
- type ExchangeIdAndName
- type JsonResponse
- type Response
Constants ¶
This section is empty.
Variables ¶
var ( // Exchange responses. EmptyResponses_AllExchanges = map[ExchangeIdAndName]Response{ { exchangeId: exchange_common.EXCHANGE_ID_BINANCE, exchangeName: constants.BinanceExchangeName, }: { ResponseCode: responseErr, }, { exchangeId: exchange_common.EXCHANGE_ID_BINANCE_US, exchangeName: constants.BinanceUSExchangeName, }: { ResponseCode: responseErr, }, { exchangeId: exchange_common.EXCHANGE_ID_BITFINEX, exchangeName: constants.BitfinexExchangeName, }: { ResponseCode: responseErr, }, } FullResponses_AllExchanges_Btc101_Eth9001 = map[ExchangeIdAndName]Response{ { exchangeId: exchange_common.EXCHANGE_ID_BINANCE, exchangeName: constants.BinanceExchangeName, }: { ResponseCode: responseOk, Tickers: []JsonResponse{binanceTicker_Btc100, binanceTicker_Eth9001}, }, { exchangeId: exchange_common.EXCHANGE_ID_BINANCE_US, exchangeName: constants.BinanceUSExchangeName, }: { ResponseCode: responseOk, Tickers: []JsonResponse{binanceUSTicker_Btc101, binanceUSTicker_Eth9000}, }, { exchangeId: exchange_common.EXCHANGE_ID_BITFINEX, exchangeName: constants.BitfinexExchangeName, }: { ResponseCode: responseOk, Tickers: []JsonResponse{bitfinexTicker_Btc102, bitfinexTicker_Eth9002}, }, } PartialResponses_AllExchanges_Eth9001 = map[ExchangeIdAndName]Response{ { exchangeId: exchange_common.EXCHANGE_ID_BINANCE, exchangeName: constants.BinanceExchangeName, }: { ResponseCode: responseOk, }, { exchangeId: exchange_common.EXCHANGE_ID_BINANCE_US, exchangeName: constants.BinanceUSExchangeName, }: { ResponseCode: responseOk, Tickers: []JsonResponse{binanceUSTicker_Eth9000}, }, { exchangeId: exchange_common.EXCHANGE_ID_BITFINEX, exchangeName: constants.BitfinexExchangeName, }: { ResponseCode: responseOk, Tickers: []JsonResponse{bitfinexTicker_Eth9002}, }, } )
Functions ¶
func GetTickersSortedByMarketId ¶
func GetTickersSortedByMarketId(marketToMarketConfig map[uint32]types.MarketConfig) []string
func MsgQueryAllMarketParamExec ¶
func MsgQueryAllMarketParamExec(clientCtx client.Context) (testutil.BufferWriter, error)
MsgQueryAllMarketParamExec lists all markets params in `Prices`.
func MsgQueryAllMarketPriceExec ¶
func MsgQueryAllMarketPriceExec(clientCtx client.Context) (testutil.BufferWriter, error)
MsgQueryAllMarketPriceExec lists all markets prices in `Prices`.
func NewGockBinanceResponse ¶
func NewGockBinanceResponse( responseCode int, tickers []JsonResponse, ) *gock.Response
NewGockBinanceResponse creates and registers a new HTTP mock using `gock` for Binance.
func NewGockBinanceUSResponse ¶
func NewGockBinanceUSResponse( responseCode int, tickers []JsonResponse, ) *gock.Response
NewGockBinanceResponse creates and registers a new HTTP mock using `gock` for BinanceUS.
func NewGockBitfinexResponse ¶
func NewGockBitfinexResponse( responseCode int, tickers []JsonResponse, ) *gock.Response
NewGockBitfinexResponse creates and registers a new HTTP mock using `gock` for Bitfinex.
func SetupExchangeResponses ¶
func SetupExchangeResponses( t *testing.T, responses map[ExchangeIdAndName]Response, )
SetupExchangeResponses validates and sets up responses returned by exchange APIs using `gock`.
Types ¶
type BinanceTicker ¶
BinanceTicker represents ticker returned by Binance for testing purposes.
func NewBinanceTicker ¶
func NewBinanceTicker(symbol, askPrice, bidPrice, lastPrice string) BinanceTicker
NewBinanceTicker returns a new BinanceTicker.
type BitfinexTicker ¶
type BitfinexTicker struct { Symbol string // index 0 BidPrice float64 // index 1 AskPrice float64 // index 3 LastPrice float64 // index 7 }
BitfinexTicker represents ticker in Bitfinex response for testing purposes.
func NewBitfinexTicker ¶
func NewBitfinexTicker(symbol string, askPrice, bidPrice, lastPrice float64) BitfinexTicker
NewBitfinexTicker returns a new BitfinexTicker.
type ExchangeIdAndName ¶
type ExchangeIdAndName struct {
// contains filtered or unexported fields
}
ExchangeIdAndName represents an exchange with an ID and a name.
type JsonResponse ¶
type JsonResponse interface {
// contains filtered or unexported methods
}
JsonResponse is an interface that encapsulates a JSON API response.
type Response ¶
type Response struct { ResponseCode int Tickers []JsonResponse }
Response represents an API response from an exchange.