Documentation ¶
Index ¶
- func GenerateClobPair(optionalModifications ...ClobModifierOption) *clobtypes.ClobPair
- func GenerateOrderUsingTemplate(order clobtypes.Order, optionalModifications ...OrderModifierOption) clobtypes.Order
- func GetOpenPositionsFromSubaccounts(subaccounts []satypes.Subaccount) []clobtypes.SubaccountOpenPositionInfo
- func MustPerpetualId(clobPair clobtypes.ClobPair) uint32
- func NewDeleveragingMatchOperation(liquidatedSubaccountId satypes.SubaccountId, perpetualId uint32, ...) types.Operation
- func NewMatchOperation(takerMatchableOrder types.MatchableOrder, makerFills []types.MakerFill) types.Operation
- func NewMatchOperationFromPerpetualDeleveragingLiquidation(perpDeleveraging types.MatchPerpetualDeleveraging) types.Operation
- func NewMatchOperationFromPerpetualLiquidation(perpLiquidation types.MatchPerpetualLiquidation) types.Operation
- func NewMatchOperationRaw(takerMatchableOrder types.MatchableOrder, makerFills []types.MakerFill) types.OperationRaw
- func NewMatchOperationRawFromPerpetualDeleveragingLiquidation(perpDeleveraging types.MatchPerpetualDeleveraging) types.OperationRaw
- func NewMatchOperationRawFromPerpetualLiquidation(perpLiquidation types.MatchPerpetualLiquidation) types.OperationRaw
- func NewOrderCancellationOperation(msgCancelOrder *types.MsgCancelOrder) types.Operation
- func NewOrderPlacementOperation(order types.Order) types.Operation
- func NewOrderRemovalOperationRaw(orderId types.OrderId, reason types.OrderRemoval_RemovalReason) types.OperationRaw
- func NewPreexistingStatefulOrderPlacementOperation(order types.Order) types.Operation
- func NewShortTermOrderPlacementOperationRaw(order types.Order) types.OperationRaw
- type ClobModifierOption
- func WithId(id uint32) ClobModifierOption
- func WithPerpetualId(perpetualId uint32) ClobModifierOption
- func WithPerpetualMetadata(metadata *clobtypes.ClobPair_PerpetualClobMetadata) ClobModifierOption
- func WithQuantumConversionExponent(exponent int32) ClobModifierOption
- func WithSpotMetadata(metadata *clobtypes.ClobPair_SpotClobMetadata) ClobModifierOption
- func WithStatus(status clobtypes.ClobPair_Status) ClobModifierOption
- func WithStepBaseQuantums(bq satypes.BaseQuantums) ClobModifierOption
- func WithSubticksPerTick(subticks uint32) ClobModifierOption
- type OrderModifierOption
- type TestHumanOrder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateClobPair ¶
func GenerateClobPair(optionalModifications ...ClobModifierOption) *clobtypes.ClobPair
GenerateClobPair returns a `ClobPair` object set to default values. Passing in `ClobModifierOption` methods alters the value of the `ClobPair` returned. It will start with the default, valid `ClobPair` value defined within the method and make the requested modifications before returning the object.
Example usage: `GenerateClobPair(WithQuantumConversionExponent(25))` This will start with the default `ClobPair` object defined within the method and return the newly-created object after overriding the values of `QuantumConversionExponent` to 25.
func GenerateOrderUsingTemplate ¶
func GenerateOrderUsingTemplate(order clobtypes.Order, optionalModifications ...OrderModifierOption) clobtypes.Order
GenerateOrderUsingTemplate is a helper function to generate an test order with a template and opitonal modifier options. Example usage:
clobtest.GenerateOrderUsingTemplate( OrderTemplate_ShortTerm_Btc, clobtest.WithSide(clobtypes.Order_SIDE_SELL), clobtest.WithSubaccountId(Alice_Num0), clobtest.WithClobPairid(TestEthMarketId), clobtest.WithGTB(TestGTB), )
func GetOpenPositionsFromSubaccounts ¶
func GetOpenPositionsFromSubaccounts( subaccounts []satypes.Subaccount, ) []clobtypes.SubaccountOpenPositionInfo
func MustPerpetualId ¶
MustPerpetualId is a wrapper around ClobPair.GetPerpetualId() which panics if an error is returned.
func NewDeleveragingMatchOperation ¶
func NewDeleveragingMatchOperation( liquidatedSubaccountId satypes.SubaccountId, perpetualId uint32, fills []types.MatchPerpetualDeleveraging_Fill, ) types.Operation
NewDeleveragingMatchOperation returns a new match operation for deleveraging against a undercollateralized subaccount that has failed liquidation.
func NewMatchOperation ¶
func NewMatchOperation( takerMatchableOrder types.MatchableOrder, makerFills []types.MakerFill, ) types.Operation
NewMatchOperation returns a new operation for matching maker orders against a matchable order.
func NewMatchOperationFromPerpetualDeleveragingLiquidation ¶
func NewMatchOperationFromPerpetualDeleveragingLiquidation( perpDeleveraging types.MatchPerpetualDeleveraging, ) types.Operation
NewMatchOperationFromPerpetualDeleveragingLiquidation returns a new match operation wrapping the `perpDeleveraging` object.
func NewMatchOperationFromPerpetualLiquidation ¶
func NewMatchOperationFromPerpetualLiquidation(perpLiquidation types.MatchPerpetualLiquidation) types.Operation
NewMatchOperationFromPerpetualLiquidation returns a new match operation wrapping the `perpLiquidation` object.
func NewMatchOperationRaw ¶
func NewMatchOperationRaw( takerMatchableOrder types.MatchableOrder, makerFills []types.MakerFill, ) types.OperationRaw
NewMatchOperationRaw returns a new raw operation for matching maker orders against a matchable order.
func NewMatchOperationRawFromPerpetualDeleveragingLiquidation ¶
func NewMatchOperationRawFromPerpetualDeleveragingLiquidation( perpDeleveraging types.MatchPerpetualDeleveraging, ) types.OperationRaw
NewMatchOperationRawFromPerpetualDeleveragingLiquidation returns a new raw match operation wrapping the `perpDeleveraging` object.
func NewMatchOperationRawFromPerpetualLiquidation ¶
func NewMatchOperationRawFromPerpetualLiquidation( perpLiquidation types.MatchPerpetualLiquidation, ) types.OperationRaw
NewMatchOperationRawFromPerpetualLiquidation returns a new raw match operation wrapping the `perpLiquidation` object.
func NewOrderCancellationOperation ¶
func NewOrderCancellationOperation(msgCancelOrder *types.MsgCancelOrder) types.Operation
NewOrderCancellationOperation returns a new operation for canceling an order.
func NewOrderPlacementOperation ¶
NewOrderPlacementOperation returns a new operation for placing an order.
func NewOrderRemovalOperationRaw ¶
func NewOrderRemovalOperationRaw( orderId types.OrderId, reason types.OrderRemoval_RemovalReason, ) types.OperationRaw
NewOrderRemovalOperationRaw returns a new raw order removal operation.
func NewPreexistingStatefulOrderPlacementOperation ¶
NewPreexistingStatefulOrderPlacementOperation returns a new operation for placing a pre-existing stateful order. Note this function panics if called with a non-stateful order.
func NewShortTermOrderPlacementOperationRaw ¶
func NewShortTermOrderPlacementOperationRaw(order types.Order) types.OperationRaw
NewShortTermOrderPlacementOperationRaw returns a new raw operation for placing an order.
Types ¶
type ClobModifierOption ¶
func WithId ¶
func WithId(id uint32) ClobModifierOption
func WithPerpetualId ¶
func WithPerpetualId(perpetualId uint32) ClobModifierOption
func WithPerpetualMetadata ¶
func WithPerpetualMetadata(metadata *clobtypes.ClobPair_PerpetualClobMetadata) ClobModifierOption
func WithQuantumConversionExponent ¶
func WithQuantumConversionExponent(exponent int32) ClobModifierOption
func WithSpotMetadata ¶
func WithSpotMetadata(metadata *clobtypes.ClobPair_SpotClobMetadata) ClobModifierOption
func WithStatus ¶
func WithStatus(status clobtypes.ClobPair_Status) ClobModifierOption
func WithStepBaseQuantums ¶
func WithStepBaseQuantums(bq satypes.BaseQuantums) ClobModifierOption
func WithSubticksPerTick ¶
func WithSubticksPerTick(subticks uint32) ClobModifierOption
type OrderModifierOption ¶
func WithClientId ¶
func WithClientId(clientId uint32) OrderModifierOption
func WithClobPairid ¶
func WithClobPairid(id uint32) OrderModifierOption
func WithGTB ¶
func WithGTB(gtb uint32) OrderModifierOption
func WithSide ¶
func WithSide(side clobtypes.Order_Side) OrderModifierOption
func WithSubaccountId ¶
func WithSubaccountId(subaccountId satypes.SubaccountId) OrderModifierOption