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 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 MsgServerMultiLiquidate(liquidator sdk.AccAddress, shouldAllFail bool, ...) action.Action
- func MsgServerOpenPosition(traderAddress sdk.AccAddress, pair asset.Pair, dir types.Direction, ...) 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 OpenPosition(trader sdk.AccAddress, pair asset.Pair, dir types.Direction, ...) action.Action
- func OpenPositionFails(trader sdk.AccAddress, pair asset.Pair, dir types.Direction, ...) 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 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 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
- 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 MsgServerAddMargin ¶
func MsgServerClosePosition ¶
func MsgServerDonateToPerpEf ¶
func MsgServerMultiLiquidate ¶
func MsgServerMultiLiquidate(liquidator sdk.AccAddress, shouldAllFail bool, pairTraderTuples ...PairTraderTuple) action.Action
func MsgServerOpenPosition ¶
func MsgServerRemoveMargin ¶
func MultiLiquidate ¶
func MultiLiquidate(liquidator sdk.AccAddress, shouldAllFail bool, pairTraderTuples ...PairTraderTuple) action.Action
func OpenPosition ¶
func OpenPosition( trader sdk.AccAddress, pair asset.Pair, dir types.Direction, margin sdkmath.Int, leverage sdk.Dec, baseAssetLimit 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 OpenPositionFails ¶
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 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 OpenPositionResponseChecker ¶
type OpenPositionResponseChecker func(resp *types.PositionResp) error
Open Position Response Checkers
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.
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