core

package
v1.49.0-rc3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const AdditionalChainFormatDecimals = 18

Variables

This section is empty.

Functions

This section is empty.

Types

type DerivativeMarket

type DerivativeMarket struct {
	Id                     string
	Status                 string
	Ticker                 string
	OracleBase             string
	OracleQuote            string
	OracleType             string
	OracleScaleFactor      uint32
	InitialMarginRatio     decimal.Decimal
	MaintenanceMarginRatio decimal.Decimal
	QuoteToken             Token
	MakerFeeRate           decimal.Decimal
	TakerFeeRate           decimal.Decimal
	ServiceProviderFee     decimal.Decimal
	MinPriceTickSize       decimal.Decimal
	MinQuantityTickSize    decimal.Decimal
}

func (DerivativeMarket) CalculateMarginInChainFormat

func (derivativeMarket DerivativeMarket) CalculateMarginInChainFormat(humanReadableQuantity decimal.Decimal, humanReadablePrice decimal.Decimal, leverage decimal.Decimal) cosmtypes.Dec

func (DerivativeMarket) MarginFromChainFormat

func (derivativeMarket DerivativeMarket) MarginFromChainFormat(chainValue cosmtypes.Dec) decimal.Decimal

func (DerivativeMarket) MarginToChainFormat

func (derivativeMarket DerivativeMarket) MarginToChainFormat(humanReadableValue decimal.Decimal) cosmtypes.Dec

func (DerivativeMarket) PriceFromChainFormat

func (derivativeMarket DerivativeMarket) PriceFromChainFormat(chainValue cosmtypes.Dec) decimal.Decimal

func (DerivativeMarket) PriceToChainFormat

func (derivativeMarket DerivativeMarket) PriceToChainFormat(humanReadableValue decimal.Decimal) cosmtypes.Dec

func (DerivativeMarket) QuantityFromChainFormat

func (derivativeMarket DerivativeMarket) QuantityFromChainFormat(chainValue cosmtypes.Dec) decimal.Decimal

func (DerivativeMarket) QuantityToChainFormat

func (derivativeMarket DerivativeMarket) QuantityToChainFormat(humanReadableValue decimal.Decimal) cosmtypes.Dec

type MarketsAssistant

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

func NewMarketsAssistant deprecated

func NewMarketsAssistant(networkName string) (MarketsAssistant, error)

Deprecated: use NewMarketsAssistantUsingExchangeClient instead

func NewMarketsAssistantUsingExchangeClient

func NewMarketsAssistantUsingExchangeClient(ctx context.Context, exchangeClient exchange.ExchangeClient) (MarketsAssistant, error)

func (MarketsAssistant) AllDerivativeMarkets

func (assistant MarketsAssistant) AllDerivativeMarkets() map[string]DerivativeMarket

func (MarketsAssistant) AllSpotMarkets

func (assistant MarketsAssistant) AllSpotMarkets() map[string]SpotMarket

func (MarketsAssistant) AllTokens

func (assistant MarketsAssistant) AllTokens() map[string]Token

type MockExchangeClient

type MockExchangeClient struct {
	SpotMarketsResponses       []spotExchangePB.MarketsResponse
	DerivativeMarketsResponses []derivativeExchangePB.MarketsResponse
}

func (*MockExchangeClient) Close

func (e *MockExchangeClient) Close()

func (*MockExchangeClient) GetAccountPortfolio

func (e *MockExchangeClient) GetAccountPortfolio(ctx context.Context, accountAddress string) (portfolioExchangePB.AccountPortfolioResponse, error)

func (*MockExchangeClient) GetAuction

func (*MockExchangeClient) GetAuctions

func (*MockExchangeClient) GetDerivativeMarket

func (e *MockExchangeClient) GetDerivativeMarket(ctx context.Context, marketId string) (derivativeExchangePB.MarketResponse, error)

func (*MockExchangeClient) GetDerivativeOrderbookV2

func (e *MockExchangeClient) GetDerivativeOrderbookV2(ctx context.Context, marketId string) (derivativeExchangePB.OrderbookV2Response, error)

func (*MockExchangeClient) GetDerivativeOrderbooksV2

func (e *MockExchangeClient) GetDerivativeOrderbooksV2(ctx context.Context, marketIds []string) (derivativeExchangePB.OrderbooksV2Response, error)

func (*MockExchangeClient) GetInfo

func (*MockExchangeClient) GetInsuranceFunds

func (*MockExchangeClient) GetOracleList

func (*MockExchangeClient) GetOrderStates

func (*MockExchangeClient) GetPortfolio

func (e *MockExchangeClient) GetPortfolio(ctx context.Context, accountAddress string) (accountPB.PortfolioResponse, error)

func (*MockExchangeClient) GetPrice

func (e *MockExchangeClient) GetPrice(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string, oracleScaleFactor uint32) (oraclePB.PriceResponse, error)

func (*MockExchangeClient) GetRedemptions

func (*MockExchangeClient) GetRewards

func (*MockExchangeClient) GetSpotMarket

func (e *MockExchangeClient) GetSpotMarket(ctx context.Context, marketId string) (spotExchangePB.MarketResponse, error)

func (*MockExchangeClient) GetSpotMarkets

func (*MockExchangeClient) GetSpotOrderbookV2

func (e *MockExchangeClient) GetSpotOrderbookV2(ctx context.Context, marketId string) (spotExchangePB.OrderbookV2Response, error)

func (*MockExchangeClient) GetSpotOrderbooksV2

func (e *MockExchangeClient) GetSpotOrderbooksV2(ctx context.Context, marketIds []string) (spotExchangePB.OrderbooksV2Response, error)

func (*MockExchangeClient) GetSpotOrders

func (*MockExchangeClient) GetSpotTrades

func (*MockExchangeClient) GetSpotTradesV2

func (*MockExchangeClient) GetSubaccountBalance

func (e *MockExchangeClient) GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (accountPB.SubaccountBalanceEndpointResponse, error)

func (*MockExchangeClient) GetSubaccountBalancesList

func (e *MockExchangeClient) GetSubaccountBalancesList(ctx context.Context, subaccountId string) (accountPB.SubaccountBalancesListResponse, error)

func (*MockExchangeClient) GetSubaccountsList

func (e *MockExchangeClient) GetSubaccountsList(ctx context.Context, accountAddress string) (accountPB.SubaccountsListResponse, error)

func (*MockExchangeClient) GetVersion

func (*MockExchangeClient) Ping

func (*MockExchangeClient) QueryClient

func (e *MockExchangeClient) QueryClient() *grpc.ClientConn

func (*MockExchangeClient) StreamAccountPortfolio

func (e *MockExchangeClient) StreamAccountPortfolio(ctx context.Context, accountAddress string, subaccountId, balanceType string) (portfolioExchangePB.InjectivePortfolioRPC_StreamAccountPortfolioClient, error)

func (*MockExchangeClient) StreamBids

func (*MockExchangeClient) StreamDerivativeMarket

func (*MockExchangeClient) StreamKeepalive

func (*MockExchangeClient) StreamPrices

func (e *MockExchangeClient) StreamPrices(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string) (oraclePB.InjectiveOracleRPC_StreamPricesClient, error)

func (*MockExchangeClient) StreamSpotMarket

func (*MockExchangeClient) StreamSpotOrderbookUpdate

func (*MockExchangeClient) StreamSpotOrderbookV2

func (*MockExchangeClient) StreamSubaccountBalance

type SpotMarket

type SpotMarket struct {
	Id                  string
	Status              string
	Ticker              string
	BaseToken           Token
	QuoteToken          Token
	MakerFeeRate        decimal.Decimal
	TakerFeeRate        decimal.Decimal
	ServiceProviderFee  decimal.Decimal
	MinPriceTickSize    decimal.Decimal
	MinQuantityTickSize decimal.Decimal
}

func (SpotMarket) PriceFromChainFormat

func (spotMarket SpotMarket) PriceFromChainFormat(chainValue cosmtypes.Dec) decimal.Decimal

func (SpotMarket) PriceToChainFormat

func (spotMarket SpotMarket) PriceToChainFormat(humanReadableValue decimal.Decimal) cosmtypes.Dec

func (SpotMarket) QuantityFromChainFormat

func (spotMarket SpotMarket) QuantityFromChainFormat(chainValue cosmtypes.Dec) decimal.Decimal

func (SpotMarket) QuantityToChainFormat

func (spotMarket SpotMarket) QuantityToChainFormat(humanReadableValue decimal.Decimal) cosmtypes.Dec

type Token

type Token struct {
	Name     string
	Symbol   string
	Denom    string
	Address  string
	Decimals int32
	Updated  int64
}

func (Token) ChainFormattedValue

func (t Token) ChainFormattedValue(humanReadableValue decimal.Decimal) decimal.Decimal

Jump to

Keyboard shortcuts

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