clob

package
v0.0.0-...-cc24d94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

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

func MustPerpetualId(clobPair clobtypes.ClobPair) uint32

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

func NewOrderPlacementOperation(order types.Order) types.Operation

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

func NewPreexistingStatefulOrderPlacementOperation(order types.Order) types.Operation

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

type ClobModifierOption func(cp *clobtypes.ClobPair)

func WithId

func WithId(id uint32) ClobModifierOption

func WithPerpetualId

func WithPerpetualId(perpetualId uint32) ClobModifierOption

func WithQuantumConversionExponent

func WithQuantumConversionExponent(exponent int32) ClobModifierOption

func WithStepBaseQuantums

func WithStepBaseQuantums(bq satypes.BaseQuantums) ClobModifierOption

func WithSubticksPerTick

func WithSubticksPerTick(subticks uint32) ClobModifierOption

type OrderModifierOption

type OrderModifierOption func(cp *clobtypes.Order)

func WithClientId

func WithClientId(clientId uint32) OrderModifierOption

func WithClobPairid

func WithClobPairid(id uint32) OrderModifierOption

func WithGTB

func WithGTB(gtb uint32) OrderModifierOption

func WithSubaccountId

func WithSubaccountId(subaccountId satypes.SubaccountId) OrderModifierOption

type TestHumanOrder

type TestHumanOrder struct {
	Order      clobtypes.Order
	HumanPrice string
	HumanSize  string
}

TestHumanOrder is a test order with human readable price and size.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL