Documentation ¶
Index ¶
- func AddMargin(account sdk.AccAddress, pair asset.Pair, margin sdkmath.Int) action.Action
- func ChangeLiquidationFeeRatio(liquidationFeeRatio sdk.Dec) action.Action
- func ClosePosition(account sdk.AccAddress, pair asset.Pair) action.Action
- func CreateCustomMarket(pair asset.Pair, marketModifiers ...marketModifier) action.Action
- func CreateMarket(pair asset.Pair, market types.Market, amm types.AMM) action.Action
- func EditPriceMultiplier(pair asset.Pair, multiplier sdk.Dec) action.Action
- func EditSwapInvariant(pair asset.Pair, multiplier sdk.Dec) action.Action
- func InsertPosition(modifiers ...positionModifier) action.Action
- func InsertReserveSnapshot(pair asset.Pair, time time.Time, modifiers ...reserveSnapshotModifier) action.Action
- func MarketOrder(trader sdk.AccAddress, pair asset.Pair, dir types.Direction, ...) action.Action
- func MarketOrderFails(trader sdk.AccAddress, pair asset.Pair, dir types.Direction, ...) action.Action
- func MsgServerAddMargin(traderAddress sdk.AccAddress, pair asset.Pair, amount sdkmath.Int) action.Action
- func MsgServerClosePosition(traderAddress sdk.AccAddress, pair asset.Pair) action.Action
- func MsgServerDonateToPerpEf(traderAddress sdk.AccAddress, amount sdkmath.Int) action.Action
- func MsgServerMarketOrder(traderAddress sdk.AccAddress, pair asset.Pair, dir types.Direction, ...) action.Action
- func MsgServerMultiLiquidate(liquidator sdk.AccAddress, shouldAllFail bool, ...) action.Action
- func MsgServerRemoveMargin(traderAddress sdk.AccAddress, pair asset.Pair, amount sdkmath.Int) action.Action
- func MultiLiquidate(liquidator sdk.AccAddress, shouldAllFail bool, ...) action.Action
- func PartialClose(trader sdk.AccAddress, pair asset.Pair, amount sdk.Dec) action.Action
- func PartialCloseFails(trader sdk.AccAddress, pair asset.Pair, amount sdk.Dec, expecedErr error) action.Action
- func QueryPosition(pair asset.Pair, traderAddress sdk.AccAddress, ...) action.Action
- func QueryPositionNotFound(pair asset.Pair, traderAddress sdk.AccAddress) action.Action
- func QueryPositions(traderAddress sdk.AccAddress, responseCheckers ...[]QueryPositionChecker) action.Action
- func RemoveMargin(account sdk.AccAddress, pair asset.Pair, margin sdkmath.Int) action.Action
- func RemoveMarginFail(account sdk.AccAddress, pair asset.Pair, margin sdkmath.Int, err error) action.Action
- func SetMarketEnabled(pair asset.Pair, enable bool) action.Action
- func WithLastUpdatedBlockNumber(lastUpdatedBlockNumber int64) positionModifier
- func WithLatestCumulativePremiumFraction(latestCumulativePremiumFraction sdk.Dec) positionModifier
- func WithLatestMarketCPF(amount sdk.Dec) marketModifier
- func WithMargin(margin sdk.Dec) positionModifier
- func WithOpenNotional(openNotional sdk.Dec) positionModifier
- func WithPair(pair asset.Pair) positionModifier
- func WithPrepaidBadDebt(amount sdkmath.Int) marketModifier
- func WithPriceMultiplier(multiplier sdk.Dec) reserveSnapshotModifier
- func WithPricePeg(multiplier sdk.Dec) marketModifier
- func WithSize(size sdk.Dec) positionModifier
- func WithSqrtDepth(amount sdk.Dec) marketModifier
- func WithTotalLong(amount sdk.Dec) marketModifier
- func WithTotalShort(amount sdk.Dec) marketModifier
- func WithTrader(addr sdk.AccAddress) positionModifier
- func WithdrawFromVault(pair asset.Pair, account sdk.AccAddress, amount sdkmath.Int) action.Action
- type MarketOrderResponseChecker
- func MarketOrderResp_BadDebtShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
- func MarketOrderResp_ExchangeNotionalValueShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
- func MarketOrderResp_ExchangedPositionSizeShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
- func MarketOrderResp_FundingPaymentShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
- func MarketOrderResp_MarginToVaultShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
- func MarketOrderResp_PositionNotionalShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
- func MarketOrderResp_PositionShouldBeEqual(expected types.Position) MarketOrderResponseChecker
- func MarketOrderResp_RealizedPnlShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
- func MarketOrderResp_UnrealizedPnlAfterShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
- type PairTraderTuple
- type QueryPositionChecker
- func QueryPosition_MarginRatioEquals(expected sdk.Dec) QueryPositionChecker
- func QueryPosition_PositionEquals(expected types.Position) QueryPositionChecker
- func QueryPosition_PositionNotionalEquals(expected sdk.Dec) QueryPositionChecker
- func QueryPosition_UnrealizedPnlEquals(expected sdk.Dec) QueryPositionChecker
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 ¶
CreateCustomMarket creates a market with custom parameters
func CreateMarket ¶
func EditPriceMultiplier ¶
func InsertPosition ¶
func InsertReserveSnapshot ¶
func MarketOrder ¶ added in v0.21.5
func MarketOrder( trader sdk.AccAddress, pair asset.Pair, dir types.Direction, margin sdkmath.Int, leverage sdk.Dec, baseAssetLimit sdk.Dec, responseCheckers ...MarketOrderResponseChecker, ) action.Action
MarketOrder opens a position with the given parameters.
responseCheckers are optional functions that can be used to check expected response.
func MarketOrderFails ¶ added in v0.21.5
func MsgServerAddMargin ¶
func MsgServerClosePosition ¶
func MsgServerDonateToPerpEf ¶
func MsgServerMarketOrder ¶ added in v0.21.5
func MsgServerMultiLiquidate ¶
func MsgServerMultiLiquidate(liquidator sdk.AccAddress, shouldAllFail bool, pairTraderTuples ...PairTraderTuple) action.Action
func MsgServerRemoveMargin ¶
func MultiLiquidate ¶
func MultiLiquidate(liquidator sdk.AccAddress, shouldAllFail bool, pairTraderTuples ...PairTraderTuple) action.Action
func PartialClose ¶ added in v0.21.6
func PartialCloseFails ¶ added in v0.21.6
func QueryPosition ¶
func QueryPosition(pair asset.Pair, traderAddress sdk.AccAddress, responseCheckers ...QueryPositionChecker) action.Action
func QueryPositionNotFound ¶
func QueryPositions ¶
func QueryPositions(traderAddress sdk.AccAddress, responseCheckers ...[]QueryPositionChecker) action.Action
func RemoveMargin ¶
func RemoveMarginFail ¶
func SetMarketEnabled ¶
Enable market
func WithLastUpdatedBlockNumber ¶
func WithLastUpdatedBlockNumber(lastUpdatedBlockNumber int64) positionModifier
func WithLatestMarketCPF ¶ added in v0.21.7
func WithMargin ¶
func WithOpenNotional ¶
func WithPrepaidBadDebt ¶
func WithPriceMultiplier ¶
func WithPricePeg ¶
func WithSqrtDepth ¶
func WithTotalLong ¶
func WithTotalShort ¶
func WithTrader ¶
func WithTrader(addr sdk.AccAddress) positionModifier
func WithdrawFromVault ¶
Types ¶
type MarketOrderResponseChecker ¶ added in v0.21.5
type MarketOrderResponseChecker func(resp *types.PositionResp) error
Open Position Response Checkers
func MarketOrderResp_BadDebtShouldBeEqual ¶ added in v0.21.5
func MarketOrderResp_BadDebtShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
MarketOrderResp_BadDebtShouldBeEqual checks that the bad debt included in the response is equal to the expected value.
func MarketOrderResp_ExchangeNotionalValueShouldBeEqual ¶ added in v0.21.5
func MarketOrderResp_ExchangeNotionalValueShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
MarketOrderResp_ExchangeNotionalValueShouldBeEqual checks that the exchanged notional value included in the response is equal to the expected value.
func MarketOrderResp_ExchangedPositionSizeShouldBeEqual ¶ added in v0.21.5
func MarketOrderResp_ExchangedPositionSizeShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
MarketOrderResp_ExchangedPositionSizeShouldBeEqual checks that the exchanged position size included in the response is equal to the expected value.
func MarketOrderResp_FundingPaymentShouldBeEqual ¶ added in v0.21.5
func MarketOrderResp_FundingPaymentShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
MarketOrderResp_FundingPaymentShouldBeEqual checks that the funding payment included in the response is equal to the expected value.
func MarketOrderResp_MarginToVaultShouldBeEqual ¶ added in v0.21.5
func MarketOrderResp_MarginToVaultShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
MarketOrderResp_MarginToVaultShouldBeEqual checks that the margin to vault included in the response is equal to the expected value.
func MarketOrderResp_PositionNotionalShouldBeEqual ¶ added in v0.21.5
func MarketOrderResp_PositionNotionalShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
MarketOrderResp_PositionNotionalShouldBeEqual checks that the position notional included in the response is equal to the expected value.
func MarketOrderResp_PositionShouldBeEqual ¶ added in v0.21.5
func MarketOrderResp_PositionShouldBeEqual(expected types.Position) MarketOrderResponseChecker
MarketOrderResp_PositionShouldBeEqual checks that the position included in the response is equal to the expected position response.
func MarketOrderResp_RealizedPnlShouldBeEqual ¶ added in v0.21.5
func MarketOrderResp_RealizedPnlShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
MarketOrderResp_RealizedPnlShouldBeEqual checks that the realized pnl included in the response is equal to the expected value.
func MarketOrderResp_UnrealizedPnlAfterShouldBeEqual ¶ added in v0.21.5
func MarketOrderResp_UnrealizedPnlAfterShouldBeEqual(expected sdk.Dec) MarketOrderResponseChecker
MarketOrderResp_UnrealizedPnlAfterShouldBeEqual checks that the unrealized pnl after included in the response is equal to the expected value.
type PairTraderTuple ¶
type PairTraderTuple struct { Pair asset.Pair Trader sdk.AccAddress Successful bool }
type QueryPositionChecker ¶
type QueryPositionChecker func(resp types.QueryPositionResponse) error
func QueryPosition_MarginRatioEquals ¶
func QueryPosition_MarginRatioEquals(expected sdk.Dec) QueryPositionChecker
func QueryPosition_PositionEquals ¶
func QueryPosition_PositionEquals(expected types.Position) QueryPositionChecker
func QueryPosition_PositionNotionalEquals ¶
func QueryPosition_PositionNotionalEquals(expected sdk.Dec) QueryPositionChecker
func QueryPosition_UnrealizedPnlEquals ¶
func QueryPosition_UnrealizedPnlEquals(expected sdk.Dec) QueryPositionChecker