nibiru.msg package

Submodules

nibiru.msg.bank module

class nibiru.msg.bank.MsgSend(to_address: str, coins: Coin | List[Coin])

Bases: PythonMsg

Send tokens from one account to another. PythonMsg corresponding to the ‘cosmos.bank.v1beta1.MsgSend’ message.

to_address

The address of the receiver

Type:

str

coins

The list of coins to send

Type:

Union[Coin, List[Coin]]

coins: Coin | List[Coin]
to_address: str
to_pb(sender: str) MsgSend

Returns the Message as protobuf object.

Returns:

The proto object.

Return type:

pb.MsgSend

class nibiru.msg.bank.MsgsBank

Bases: object

Messages for the x/bank module.

Methods: - send: Send tokens from one account to another

static send(to_address: str, coins: Coin | List[Coin]) MsgSend

Send tokens from one account to another

to_address

The address of the receiver

Type:

str

coins

The list of coins to send

Type:

List[Coin]

Returns:

PythonMsg corresponding to the ‘cosmos.bank.v1beta1.MsgSend’ message

Return type:

MsgSend

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: PythonMsg

Create a pool using the assets specified

swap_fee

The swap fee required for the pool

Type:

float

exit_fee

The exit fee required for the pool

Type:

float

assets

The assets to compose the pool

Type:

List[PoolAsset]

a: int
assets: List[PoolAsset]
exit_fee: float
pool_type: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7f0ee75e0d00>
swap_fee: float
to_pb(sender: str) MsgCreatePool

Returns the Message as protobuf object.

Returns:

The proto object.

Return type:

pb.MsgCreatePool

class nibiru.msg.spot.MsgExitPool(pool_id: int, pool_shares: Coin)

Bases: PythonMsg

Exit a pool using the specified pool shares

pool_id

The id of the pool

Type:

int

pool_shares

The tokens as share of the pool to exit with

Type:

Coin

pool_id: int
pool_shares: Coin
to_pb(sender: str) MsgExitPool

Returns the Message as protobuf object.

Returns:

The proto object.

Return type:

pb.MsgExitPool

class nibiru.msg.spot.MsgJoinPool(pool_id: int, tokens: Coin | List[Coin])

Bases: PythonMsg

Join a pool using the specified tokens

pool_id

The id of the pool to join

Type:

int

tokens

The tokens to be bonded in the pool

Type:

List[Coin]

pool_id: int
to_pb(sender: str) MsgJoinPool

Returns the Message as protobuf object.

Returns:

The proto object.

Return type:

pb.MsgJoinPool

tokens: Coin | List[Coin]
class nibiru.msg.spot.MsgSwapAssets(pool_id: int, token_in: Coin, token_out_denom: str)

Bases: PythonMsg

Swap the assets provided for the denom specified

pool_id

The id of the pool

Type:

int

token_in

The token in we wish to swap with

Type:

Coin

token_out_denom

The token we expect out of the pool

Type:

str

pool_id: int
to_pb(sender: str) MsgSwapAssets

Returns the Message as protobuf object.

Returns:

The proto object.

Return type:

pb.MsgSwapAssets

token_in: Coin
token_out_denom: str
class nibiru.msg.spot.MsgsSpot

Bases: object

MsgsSpot 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: object

The 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: object

Keeper of the pair/trader pairs for liquidations

pair: str
trader: str
class nibiru.msg.perp.MsgAddMargin(pair: str, margin: Coin)

Bases: PythonMsg

Add margin for the position (pair + trader)

pair

The token pair

Type:

str

margin

The margin to remove in a coin format

Type:

Coin

margin: Coin
pair: str
to_pb(sender: str) MsgAddMargin

Returns the Message as protobuf object.

Returns:

The proto object.

Return type:

pb.MsgAddMargin

class nibiru.msg.perp.MsgClosePosition(pair: str)

Bases: PythonMsg

Close the position.

pair

The token pair

Type:

str

pair: str
to_pb(sender: str) MsgClosePosition

Returns the Message as protobuf object.

Returns:

The proto object.

Return type:

pb.MsgClosePosition

class nibiru.msg.perp.MsgMarketOrder(pair: str, dir: Direction, margin: float, leverage: float, base_asset_amount_limit: float)

Bases: PythonMsg

Open a position using the specified parameters.

pair

The token pair

Type:

str

side

The side, either Side.BUY or Side.SELL

Type:

Side

margin

The quote amount you want to use to buy base

Type:

float

leverage

The leverage you want to use, typically between 1 and 15, depending on the maintenance margin ratio of the pool.

Type:

float

base_asset_amount_limit

The minimum amount of base you are willing to receive for this amount of quote.

Type:

float

base_asset_amount_limit: float
dir: Direction
leverage: float
margin: float
pair: str
to_pb(sender: str) MsgMarketOrder

Returns the Message as protobuf object.

Returns:

The proto object.

Return type:

pb.MsgMarketOrder

class nibiru.msg.perp.MsgMultiLiquidate(liquidations: List[Liquidation])

Bases: PythonMsg

Liquidate one or multiple unhealthy positions. Unhealthy positions are positions with margin_ratio < maintenance_margin_ratio.

liquidations

The list of {pair, trader} pairs.

Type:

Liquidation

liquidations: List[Liquidation]
to_pb(sender: str) MsgMultiLiquidate

Returns the Message as protobuf object.

Returns:

The proto object.

Return type:

pb.MsgLiquidate

class nibiru.msg.perp.MsgRemoveMargin(pair: str, margin: Coin)

Bases: PythonMsg

Remove margin for the position (pair + trader)

pair

The token pair

Type:

str

margin

The margin to remove in a coin format

Type:

Coin

margin: Coin
pair: str
to_pb(sender: str) MsgRemoveMargin

Returns the Message as protobuf object.

Returns:

The proto object.

Return type:

pb.MsgRemoveMargin

class nibiru.msg.perp.MsgsPerp

Bases: object

Messages 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)

pair

The token pair

Type:

str

margin

The margin to remove in a coin format

Type:

Coin

static close_position(pair: str) MsgClosePosition

Close the position.

pair

The token pair

Type:

str

static liquidate(pair: str, trader: str) MsgMultiLiquidate

Liquidates unhealthy position (pair + trader)

pair

The token pair

Type:

str

trader

The trader address

Type:

str

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.

pair

The token pair

Type:

str

is_long

Determines whether to open with long or short exposure.

Type:

bool

margin

The margin of the position

Type:

float

leverage

The leverage you want to use, typically between 1 and 15, depending on the maintenance margin ratio of the pool.

Type:

float

base_asset_amount_limit

The minimum amount of base you are willing to receive for this amount of quote.

Type:

float

static remove_margin(pair: str, margin: Coin) MsgRemoveMargin

Remove margin for the position (pair + trader)

pair

The token pair

Type:

str

margin

The margin to remove in a coin format

Type:

Coin

class nibiru.msg.perp.perp

Bases: object

The 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

Module contents