exchange

package
v1.50.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 19 Imported by: 60

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExchangeClient

type ExchangeClient interface {
	QueryClient() *grpc.ClientConn
	GetDerivativeMarket(ctx context.Context, marketId string) (*derivativeExchangePB.MarketResponse, error)
	GetDerivativeOrderbookV2(ctx context.Context, marketId string) (*derivativeExchangePB.OrderbookV2Response, error)
	GetDerivativeOrderbooksV2(ctx context.Context, marketIds []string) (*derivativeExchangePB.OrderbooksV2Response, error)
	// StreamDerivativeOrderbook deprecated API
	StreamDerivativeOrderbookV2(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookV2Client, error)
	StreamDerivativeOrderbookUpdate(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrderbookUpdateClient, error)
	StreamDerivativeMarket(ctx context.Context, marketIds []string) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamMarketClient, error)
	GetDerivativeOrders(ctx context.Context, req *derivativeExchangePB.OrdersRequest) (*derivativeExchangePB.OrdersResponse, error)
	GetDerivativeMarkets(ctx context.Context, req *derivativeExchangePB.MarketsRequest) (*derivativeExchangePB.MarketsResponse, error)
	GetDerivativePositions(ctx context.Context, req *derivativeExchangePB.PositionsRequest) (*derivativeExchangePB.PositionsResponse, error)
	GetDerivativePositionsV2(ctx context.Context, req *derivativeExchangePB.PositionsV2Request) (*derivativeExchangePB.PositionsV2Response, error)
	GetDerivativeLiquidablePositions(ctx context.Context, req *derivativeExchangePB.LiquidablePositionsRequest) (*derivativeExchangePB.LiquidablePositionsResponse, error)
	StreamDerivativePositions(ctx context.Context, req *derivativeExchangePB.StreamPositionsRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamPositionsClient, error)
	StreamDerivativeOrders(ctx context.Context, req *derivativeExchangePB.StreamOrdersRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersClient, error)
	GetDerivativeTrades(ctx context.Context, req *derivativeExchangePB.TradesRequest) (*derivativeExchangePB.TradesResponse, error)
	GetDerivativeTradesV2(ctx context.Context, req *derivativeExchangePB.TradesV2Request) (*derivativeExchangePB.TradesV2Response, error)
	StreamDerivativeTrades(ctx context.Context, req *derivativeExchangePB.StreamTradesRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesClient, error)
	StreamDerivativeV2Trades(ctx context.Context, req *derivativeExchangePB.StreamTradesV2Request) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamTradesV2Client, error)
	GetSubaccountDerivativeOrdersList(ctx context.Context, req *derivativeExchangePB.SubaccountOrdersListRequest) (*derivativeExchangePB.SubaccountOrdersListResponse, error)
	GetSubaccountDerivativeTradesList(ctx context.Context, req *derivativeExchangePB.SubaccountTradesListRequest) (*derivativeExchangePB.SubaccountTradesListResponse, error)
	GetHistoricalDerivativeOrders(ctx context.Context, req *derivativeExchangePB.OrdersHistoryRequest) (*derivativeExchangePB.OrdersHistoryResponse, error)
	StreamHistoricalDerivativeOrders(ctx context.Context, req *derivativeExchangePB.StreamOrdersHistoryRequest) (derivativeExchangePB.InjectiveDerivativeExchangeRPC_StreamOrdersHistoryClient, error)
	GetDerivativeFundingPayments(ctx context.Context, req *derivativeExchangePB.FundingPaymentsRequest) (*derivativeExchangePB.FundingPaymentsResponse, error)
	GetDerivativeFundingRates(ctx context.Context, req *derivativeExchangePB.FundingRatesRequest) (*derivativeExchangePB.FundingRatesResponse, error)
	GetPrice(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string, oracleScaleFactor uint32) (*oraclePB.PriceResponse, error)
	GetOracleList(ctx context.Context) (*oraclePB.OracleListResponse, error)
	StreamPrices(ctx context.Context, baseSymbol string, quoteSymbol string, oracleType string) (oraclePB.InjectiveOracleRPC_StreamPricesClient, error)
	GetAuction(ctx context.Context, round int64) (*auctionPB.AuctionEndpointResponse, error)
	GetAuctions(ctx context.Context) (*auctionPB.AuctionsResponse, error)
	StreamBids(ctx context.Context) (auctionPB.InjectiveAuctionRPC_StreamBidsClient, error)
	GetSubaccountsList(ctx context.Context, accountAddress string) (*accountPB.SubaccountsListResponse, error)
	GetSubaccountBalance(ctx context.Context, subaccountId string, denom string) (*accountPB.SubaccountBalanceEndpointResponse, error)
	StreamSubaccountBalance(ctx context.Context, subaccountId string) (accountPB.InjectiveAccountsRPC_StreamSubaccountBalanceClient, error)
	GetSubaccountBalancesList(ctx context.Context, subaccountId string) (*accountPB.SubaccountBalancesListResponse, error)
	GetSubaccountHistory(ctx context.Context, req *accountPB.SubaccountHistoryRequest) (*accountPB.SubaccountHistoryResponse, error)
	GetSubaccountOrderSummary(ctx context.Context, req *accountPB.SubaccountOrderSummaryRequest) (*accountPB.SubaccountOrderSummaryResponse, error)
	GetOrderStates(ctx context.Context, req *accountPB.OrderStatesRequest) (*accountPB.OrderStatesResponse, error)
	GetPortfolio(ctx context.Context, accountAddress string) (*accountPB.PortfolioResponse, error)
	GetRewards(ctx context.Context, req *accountPB.RewardsRequest) (*accountPB.RewardsResponse, error)
	GetSpotOrders(ctx context.Context, req *spotExchangePB.OrdersRequest) (*spotExchangePB.OrdersResponse, error)
	GetSpotOrderbookV2(ctx context.Context, marketId string) (*spotExchangePB.OrderbookV2Response, error)
	GetSpotOrderbooksV2(ctx context.Context, marketIds []string) (*spotExchangePB.OrderbooksV2Response, error)
	// StreamSpotOrderbook deprecated API
	StreamSpotOrderbookV2(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrderbookV2Client, error)
	StreamSpotOrderbookUpdate(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrderbookUpdateClient, error)
	GetSpotMarkets(ctx context.Context, req *spotExchangePB.MarketsRequest) (*spotExchangePB.MarketsResponse, error)
	GetSpotMarket(ctx context.Context, marketId string) (*spotExchangePB.MarketResponse, error)
	StreamSpotMarket(ctx context.Context, marketIds []string) (spotExchangePB.InjectiveSpotExchangeRPC_StreamMarketsClient, error)
	StreamSpotOrders(ctx context.Context, req *spotExchangePB.StreamOrdersRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersClient, error)
	GetSpotTrades(ctx context.Context, req *spotExchangePB.TradesRequest) (*spotExchangePB.TradesResponse, error)
	GetSpotTradesV2(ctx context.Context, req *spotExchangePB.TradesV2Request) (*spotExchangePB.TradesV2Response, error)
	StreamSpotTrades(ctx context.Context, req *spotExchangePB.StreamTradesRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesClient, error)
	StreamSpotTradesV2(ctx context.Context, req *spotExchangePB.StreamTradesV2Request) (spotExchangePB.InjectiveSpotExchangeRPC_StreamTradesV2Client, error)
	GetSubaccountSpotOrdersList(ctx context.Context, req *spotExchangePB.SubaccountOrdersListRequest) (*spotExchangePB.SubaccountOrdersListResponse, error)
	GetSubaccountSpotTradesList(ctx context.Context, req *spotExchangePB.SubaccountTradesListRequest) (*spotExchangePB.SubaccountTradesListResponse, error)
	GetHistoricalSpotOrders(ctx context.Context, req *spotExchangePB.OrdersHistoryRequest) (*spotExchangePB.OrdersHistoryResponse, error)
	StreamHistoricalSpotOrders(ctx context.Context, req *spotExchangePB.StreamOrdersHistoryRequest) (spotExchangePB.InjectiveSpotExchangeRPC_StreamOrdersHistoryClient, error)
	GetInsuranceFunds(ctx context.Context, req *insurancePB.FundsRequest) (*insurancePB.FundsResponse, error)
	GetRedemptions(ctx context.Context, req *insurancePB.RedemptionsRequest) (*insurancePB.RedemptionsResponse, error)

	GetAccountPortfolio(ctx context.Context, accountAddress string) (*portfolioExchangePB.AccountPortfolioResponse, error)
	GetAccountPortfolioBalances(ctx context.Context, accountAddress string) (*portfolioExchangePB.AccountPortfolioBalancesResponse, error)
	StreamAccountPortfolio(ctx context.Context, accountAddress string, subaccountId, balanceType string) (portfolioExchangePB.InjectivePortfolioRPC_StreamAccountPortfolioClient, error)

	StreamKeepalive(ctx context.Context) (metaPB.InjectiveMetaRPC_StreamKeepaliveClient, error)
	GetInfo(ctx context.Context, req *metaPB.InfoRequest) (*metaPB.InfoResponse, error)
	GetVersion(ctx context.Context, req *metaPB.VersionRequest) (*metaPB.VersionResponse, error)
	Ping(ctx context.Context, req *metaPB.PingRequest) (*metaPB.PingResponse, error)
	Close()
}

func NewExchangeClient

func NewExchangeClient(network common.Network, options ...common.ClientOption) (ExchangeClient, error)

type MockExchangeClient added in v1.49.0

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

func (*MockExchangeClient) Close added in v1.49.0

func (e *MockExchangeClient) Close()

func (*MockExchangeClient) GetAccountPortfolio added in v1.49.0

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

func (*MockExchangeClient) GetAccountPortfolioBalances added in v1.49.0

func (e *MockExchangeClient) GetAccountPortfolioBalances(ctx context.Context, accountAddress string) (*portfolioExchangePB.AccountPortfolioBalancesResponse, error)

func (*MockExchangeClient) GetAuction added in v1.49.0

func (*MockExchangeClient) GetAuctions added in v1.49.0

func (*MockExchangeClient) GetDerivativeFundingPayments added in v1.49.0

func (*MockExchangeClient) GetDerivativeFundingRates added in v1.49.0

func (*MockExchangeClient) GetDerivativeLiquidablePositions added in v1.49.0

func (*MockExchangeClient) GetDerivativeMarket added in v1.49.0

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

func (*MockExchangeClient) GetDerivativeMarkets added in v1.49.0

func (*MockExchangeClient) GetDerivativeOrderbookV2 added in v1.49.0

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

func (*MockExchangeClient) GetDerivativeOrderbooksV2 added in v1.49.0

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

func (*MockExchangeClient) GetDerivativeOrders added in v1.49.0

func (*MockExchangeClient) GetDerivativePositions added in v1.49.0

func (*MockExchangeClient) GetDerivativePositionsV2 added in v1.49.0

func (*MockExchangeClient) GetDerivativeTrades added in v1.49.0

func (*MockExchangeClient) GetDerivativeTradesV2 added in v1.49.0

func (*MockExchangeClient) GetHistoricalDerivativeOrders added in v1.49.0

func (*MockExchangeClient) GetHistoricalSpotOrders added in v1.49.0

func (*MockExchangeClient) GetInfo added in v1.49.0

func (*MockExchangeClient) GetInsuranceFunds added in v1.49.0

func (*MockExchangeClient) GetOracleList added in v1.49.0

func (*MockExchangeClient) GetOrderStates added in v1.49.0

func (*MockExchangeClient) GetPortfolio added in v1.49.0

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

func (*MockExchangeClient) GetPrice added in v1.49.0

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

func (*MockExchangeClient) GetRedemptions added in v1.49.0

func (*MockExchangeClient) GetRewards added in v1.49.0

func (*MockExchangeClient) GetSpotMarket added in v1.49.0

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

func (*MockExchangeClient) GetSpotMarkets added in v1.49.0

func (*MockExchangeClient) GetSpotOrderbookV2 added in v1.49.0

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

func (*MockExchangeClient) GetSpotOrderbooksV2 added in v1.49.0

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

func (*MockExchangeClient) GetSpotOrders added in v1.49.0

func (*MockExchangeClient) GetSpotTrades added in v1.49.0

func (*MockExchangeClient) GetSpotTradesV2 added in v1.49.0

func (*MockExchangeClient) GetSubaccountBalance added in v1.49.0

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

func (*MockExchangeClient) GetSubaccountBalancesList added in v1.49.0

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

func (*MockExchangeClient) GetSubaccountDerivativeOrdersList added in v1.49.0

func (*MockExchangeClient) GetSubaccountDerivativeTradesList added in v1.49.0

func (*MockExchangeClient) GetSubaccountHistory added in v1.49.0

func (*MockExchangeClient) GetSubaccountOrderSummary added in v1.49.0

func (*MockExchangeClient) GetSubaccountSpotOrdersList added in v1.49.0

func (*MockExchangeClient) GetSubaccountSpotTradesList added in v1.49.0

func (*MockExchangeClient) GetSubaccountsList added in v1.49.0

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

func (*MockExchangeClient) GetVersion added in v1.49.0

func (*MockExchangeClient) Ping added in v1.49.0

func (*MockExchangeClient) QueryClient added in v1.49.0

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

func (*MockExchangeClient) StreamAccountPortfolio added in v1.49.0

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

func (*MockExchangeClient) StreamBids added in v1.49.0

func (*MockExchangeClient) StreamDerivativeMarket added in v1.49.0

func (*MockExchangeClient) StreamDerivativeOrderbookUpdate added in v1.49.0

func (*MockExchangeClient) StreamDerivativeOrderbookV2 added in v1.49.0

func (*MockExchangeClient) StreamKeepalive added in v1.49.0

func (*MockExchangeClient) StreamPrices added in v1.49.0

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

func (*MockExchangeClient) StreamSpotMarket added in v1.49.0

func (*MockExchangeClient) StreamSpotOrderbookUpdate added in v1.49.0

func (*MockExchangeClient) StreamSpotOrderbookV2 added in v1.49.0

func (*MockExchangeClient) StreamSubaccountBalance added in v1.49.0

Jump to

Keyboard shortcuts

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