Documentation ¶
Index ¶
- func ChangeLiquidationFeeRatio(liquidationFeeRatio sdk.Dec) action.Action
- func ClosePosition(account sdk.AccAddress, pair asset.Pair) action.Action
- func CreateCustomMarket(pair asset.Pair, quoteReserve, baseReserve sdk.Dec, ...) action.Action
- func LiquidatePosition(liquidator, account sdk.AccAddress, pair asset.Pair) action.Action
- func OpenPosition(account sdk.AccAddress, pair asset.Pair, side perpammtypes.Direction, ...) action.Action
- func SetLiquidator(account sdk.AccAddress) action.Action
- type CreateMarketAction
- type OpenPositionResponseChecker
- func OpenPositionResp_BadDebtShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker
- func OpenPositionResp_ExchangeNotionalValueShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker
- func OpenPositionResp_ExchangedPositionSizeShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker
- func OpenPositionResp_FundingPaymentShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker
- func OpenPositionResp_MarginToVaultShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker
- func OpenPositionResp_PositionNotionalShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker
- func OpenPositionResp_PositionShouldBeEqual(expected types.Position) OpenPositionResponseChecker
- func OpenPositionResp_RealizedPnlShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker
- func OpenPositionResp_UnrealizedPnlAfterShouldBeEqual(expected sdk.Dec) OpenPositionResponseChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClosePosition ¶
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 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
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.