action

package
v0.20.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeLiquidationFeeRatio

func ChangeLiquidationFeeRatio(liquidationFeeRatio sdk.Dec) action.Action

func ClosePosition

func ClosePosition(account sdk.AccAddress, pair asset.Pair) action.Action

ClosePosition closes a position for the given account and pair.

func CreateCustomMarket

func CreateCustomMarket(
	pair asset.Pair,
	quoteReserve, baseReserve sdk.Dec,
	marketConfig perpammtypes.MarketConfig,
) action.Action

CreateCustomMarket creates a market with custom parameters

func LiquidatePosition

func LiquidatePosition(liquidator, account sdk.AccAddress, pair asset.Pair) action.Action

func OpenPosition

func OpenPosition(
	account sdk.AccAddress,
	pair asset.Pair,
	side perpammtypes.Direction,
	margin sdk.Int,
	leverage sdk.Dec,
	baseLimit sdk.Dec,
	responseCheckers ...OpenPositionResponseChecker,
) action.Action

OpenPosition opens a position with the given parameters.

responseCheckers are optional functions that can be used to check expected response.

func SetLiquidator

func SetLiquidator(account sdk.AccAddress) action.Action

Types

type CreateMarketAction

type CreateMarketAction struct {
	Pair asset.Pair

	QuoteReserve sdk.Dec
	BaseReserve  sdk.Dec

	MarketConfig perpammtypes.MarketConfig
}

CreateMarketAction creates a market

func CreateBaseMarket

func CreateBaseMarket() CreateMarketAction

CreateBaseMarket creates a base market with: - pair: ubtc:uusdc - quote asset reserve: 1000 - base asset reserve: 100 - market config: default

func (CreateMarketAction) Do

type OpenPositionResponseChecker

type OpenPositionResponseChecker func(resp *types.PositionResp) error

func OpenPositionResp_BadDebtShouldBeEqual

func OpenPositionResp_BadDebtShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker

OpenPositionResp_BadDebtShouldBeEqual checks that the bad debt included in the response is equal to the expected value.

func OpenPositionResp_ExchangeNotionalValueShouldBeEqual

func OpenPositionResp_ExchangeNotionalValueShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker

OpenPositionResp_ExchangeNotionalValueShouldBeEqual checks that the exchanged notional value included in the response is equal to the expected value.

func OpenPositionResp_ExchangedPositionSizeShouldBeEqual

func OpenPositionResp_ExchangedPositionSizeShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker

OpenPositionResp_ExchangedPositionSizeShouldBeEqual checks that the exchanged position size included in the response is equal to the expected value.

func OpenPositionResp_FundingPaymentShouldBeEqual

func OpenPositionResp_FundingPaymentShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker

OpenPositionResp_FundingPaymentShouldBeEqual checks that the funding payment included in the response is equal to the expected value.

func OpenPositionResp_MarginToVaultShouldBeEqual

func OpenPositionResp_MarginToVaultShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker

OpenPositionResp_MarginToVaultShouldBeEqual checks that the margin to vault included in the response is equal to the expected value.

func OpenPositionResp_PositionNotionalShouldBeEqual

func OpenPositionResp_PositionNotionalShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker

OpenPositionResp_PositionNotionalShouldBeEqual checks that the position notional included in the response is equal to the expected value.

func OpenPositionResp_PositionShouldBeEqual

func OpenPositionResp_PositionShouldBeEqual(expected types.Position) OpenPositionResponseChecker

OpenPositionResp_PositionShouldBeEqual checks that the position included in the response is equal to the expected position response.

func OpenPositionResp_RealizedPnlShouldBeEqual

func OpenPositionResp_RealizedPnlShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker

OpenPositionResp_RealizedPnlShouldBeEqual checks that the realized pnl included in the response is equal to the expected value.

func OpenPositionResp_UnrealizedPnlAfterShouldBeEqual

func OpenPositionResp_UnrealizedPnlAfterShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker

OpenPositionResp_UnrealizedPnlAfterShouldBeEqual checks that the unrealized pnl after included in the response is equal to the expected value.

Jump to

Keyboard shortcuts

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