nibiru.msg package
Submodules
nibiru.msg.bank module
- class nibiru.msg.bank.MsgSend(to_address: str, coins: Coin | List[Coin])
Bases:
PythonMsgSend tokens from one account to another. PythonMsg corresponding to the ‘cosmos.bank.v1beta1.MsgSend’ message.
- coins
The list of coins to send
- Type:
Union[Coin, List[Coin]]
- class nibiru.msg.bank.MsgsBank
Bases:
objectMessages for the x/bank module.
Methods: - send: Send tokens from one account to another
nibiru.msg.spot module
- class nibiru.msg.spot.MsgCreatePool(swap_fee: float, exit_fee: float, a: int, pool_type: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7f0ee75e0d00>, assets: ~typing.List[~nibiru.pytypes.common.PoolAsset])
Bases:
PythonMsgCreate a pool using the assets specified
- assets
The assets to compose the pool
- Type:
List[PoolAsset]
- pool_type: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7f0ee75e0d00>
- class nibiru.msg.spot.MsgExitPool(pool_id: int, pool_shares: Coin)
Bases:
PythonMsgExit a pool using the specified pool shares
The tokens as share of the pool to exit with
- Type:
Coin
- pool_shares: Coin
- class nibiru.msg.spot.MsgJoinPool(pool_id: int, tokens: Coin | List[Coin])
Bases:
PythonMsgJoin a pool using the specified tokens
- tokens
The tokens to be bonded in the pool
- Type:
List[Coin]
- class nibiru.msg.spot.MsgSwapAssets(pool_id: int, token_in: Coin, token_out_denom: str)
Bases:
PythonMsgSwap the assets provided for the denom specified
- token_in
The token in we wish to swap with
- Type:
Coin
- to_pb(sender: str) MsgSwapAssets
Returns the Message as protobuf object.
- Returns:
The proto object.
- Return type:
pb.MsgSwapAssets
- token_in: Coin
- class nibiru.msg.spot.MsgsSpot
Bases:
objectMsgsSpot has methods for building messages for transactions on Nibi-Swap.
Methods: - create_pool: Create a pool using the assets specified - exit_pool: Exit a pool using the specified pool shares - join_pool: Join a pool using the specified tokens - swap: Swap the assets provided for the denom specified
- static create_pool(swap_fee: float, exit_fee: float, a: int, pool_type: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7f0ee75e0d00>, assets: ~typing.List[~nibiru.pytypes.common.PoolAsset]) MsgCreatePool
- static exit_pool(pool_id: int, pool_shares: Coin) MsgExitPool
- static join_pool(pool_id: int, tokens: Coin | List[Coin]) MsgJoinPool
- static swap(pool_id: int, token_in: Coin, token_out_denom: str) MsgSwapAssets
- class nibiru.msg.spot.spot
Bases:
objectThe spot class allows to create transactions for the decentralized spot exchange using the queries.
- create_pool: MsgCreatePool
- exit_pool: MsgExitPool
- join_pool: MsgJoinPool
- swap_assets: MsgSwapAssets
nibiru.msg.perp module
- class nibiru.msg.perp.Liquidation(pair: str, trader: str)
Bases:
objectKeeper of the pair/trader pairs for liquidations
- class nibiru.msg.perp.MsgAddMargin(pair: str, margin: Coin)
Bases:
PythonMsgAdd margin for the position (pair + trader)
- margin
The margin to remove in a coin format
- Type:
Coin
- margin: Coin
- class nibiru.msg.perp.MsgMarketOrder(pair: str, dir: Direction, margin: float, leverage: float, base_asset_amount_limit: float)
Bases:
PythonMsgOpen a position using the specified parameters.
- side
The side, either Side.BUY or Side.SELL
- Type:
Side
- leverage
The leverage you want to use, typically between 1 and 15, depending on the maintenance margin ratio of the pool.
- Type:
- base_asset_amount_limit
The minimum amount of base you are willing to receive for this amount of quote.
- Type:
- dir: Direction
- class nibiru.msg.perp.MsgMultiLiquidate(liquidations: List[Liquidation])
Bases:
PythonMsgLiquidate one or multiple unhealthy positions. Unhealthy positions are positions with margin_ratio < maintenance_margin_ratio.
- liquidations
The list of {pair, trader} pairs.
- Type:
- liquidations: List[Liquidation]
- class nibiru.msg.perp.MsgRemoveMargin(pair: str, margin: Coin)
Bases:
PythonMsgRemove margin for the position (pair + trader)
- margin
The margin to remove in a coin format
- Type:
Coin
- margin: Coin
- class nibiru.msg.perp.MsgsPerp
Bases:
objectMessages for the Nibiru Chain x/perp module
Methods: - open_position - close_position: - add_margin: Deleverages a position by adding margin to back it. - remove_margin: Increases the leverage of the position by removing margin.
- static add_margin(pair: str, margin: Coin) MsgAddMargin
Add margin for the position (pair + trader)
- margin
The margin to remove in a coin format
- Type:
Coin
- static close_position(pair: str) MsgClosePosition
Close the position.
- static liquidate(pair: str, trader: str) MsgMultiLiquidate
Liquidates unhealthy position (pair + trader)
- static liquidate_multiple(liquidations: List[Liquidation]) MsgMultiLiquidate
Liquidates multiple unhealthy positions (pair + trader)
- liquidations
list of pair/traders to liquidate
- Type:
List[Liquidation]
- static open_position(pair: str, is_long: bool, margin: float, leverage: float, base_asset_amount_limit: float = 0) MsgMarketOrder
Open a posiiton using the specified parameters.
- leverage
The leverage you want to use, typically between 1 and 15, depending on the maintenance margin ratio of the pool.
- Type:
- class nibiru.msg.perp.perp
Bases:
objectThe perp class allows you to generate transaction for the perpetual futures module using the different messages available.
- add_margin: MsgAddMargin
- close_position: MsgClosePosition
- liquidate: MsgMultiLiquidate
- open_position: MsgMarketOrder
- remove_margin: MsgRemoveMargin