shared

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OrderRemovalReason_name = map[int32]string{
	0:  "ORDER_REMOVAL_REASON_UNSPECIFIED",
	1:  "ORDER_REMOVAL_REASON_EXPIRED",
	2:  "ORDER_REMOVAL_REASON_USER_CANCELED",
	3:  "ORDER_REMOVAL_REASON_UNDERCOLLATERALIZED",
	4:  "ORDER_REMOVAL_REASON_INTERNAL_ERROR",
	5:  "ORDER_REMOVAL_REASON_SELF_TRADE_ERROR",
	6:  "ORDER_REMOVAL_REASON_POST_ONLY_WOULD_CROSS_MAKER_ORDER",
	7:  "ORDER_REMOVAL_REASON_IMMEDIATE_OR_CANCEL_WOULD_REST_ON_BOOK",
	8:  "ORDER_REMOVAL_REASON_FOK_ORDER_COULD_NOT_BE_FULLY_FULLED",
	9:  "ORDER_REMOVAL_REASON_REDUCE_ONLY_RESIZE",
	10: "ORDER_REMOVAL_REASON_INDEXER_EXPIRED",
	11: "ORDER_REMOVAL_REASON_REPLACED",
	12: "ORDER_REMOVAL_REASON_FULLY_FILLED",
	13: "ORDER_REMOVAL_REASON_EQUITY_TIER",
}
View Source
var OrderRemovalReason_value = map[string]int32{
	"ORDER_REMOVAL_REASON_UNSPECIFIED":                            0,
	"ORDER_REMOVAL_REASON_EXPIRED":                                1,
	"ORDER_REMOVAL_REASON_USER_CANCELED":                          2,
	"ORDER_REMOVAL_REASON_UNDERCOLLATERALIZED":                    3,
	"ORDER_REMOVAL_REASON_INTERNAL_ERROR":                         4,
	"ORDER_REMOVAL_REASON_SELF_TRADE_ERROR":                       5,
	"ORDER_REMOVAL_REASON_POST_ONLY_WOULD_CROSS_MAKER_ORDER":      6,
	"ORDER_REMOVAL_REASON_IMMEDIATE_OR_CANCEL_WOULD_REST_ON_BOOK": 7,
	"ORDER_REMOVAL_REASON_FOK_ORDER_COULD_NOT_BE_FULLY_FULLED":    8,
	"ORDER_REMOVAL_REASON_REDUCE_ONLY_RESIZE":                     9,
	"ORDER_REMOVAL_REASON_INDEXER_EXPIRED":                        10,
	"ORDER_REMOVAL_REASON_REPLACED":                               11,
	"ORDER_REMOVAL_REASON_FULLY_FILLED":                           12,
	"ORDER_REMOVAL_REASON_EQUITY_TIER":                            13,
}

Functions

This section is empty.

Types

type OrderRemovalReason

type OrderRemovalReason int32

OrderRemovalReason is an enum of all the reasons an order was removed.

const (
	// Default value, this is invalid and unused.
	OrderRemovalReason_ORDER_REMOVAL_REASON_UNSPECIFIED OrderRemovalReason = 0
	// The order was removed due to being expired.
	OrderRemovalReason_ORDER_REMOVAL_REASON_EXPIRED OrderRemovalReason = 1
	// The order was removed due to being canceled by a user.
	OrderRemovalReason_ORDER_REMOVAL_REASON_USER_CANCELED OrderRemovalReason = 2
	// The order was removed due to being undercollateralized.
	OrderRemovalReason_ORDER_REMOVAL_REASON_UNDERCOLLATERALIZED OrderRemovalReason = 3
	// The order caused an internal error during order placement and was
	// removed.
	OrderRemovalReason_ORDER_REMOVAL_REASON_INTERNAL_ERROR OrderRemovalReason = 4
	// The order would have matched against another order placed by the same
	// subaccount and was removed.
	OrderRemovalReason_ORDER_REMOVAL_REASON_SELF_TRADE_ERROR OrderRemovalReason = 5
	// The order would have matched against maker orders on the orderbook
	// despite being a post-only order and was removed.
	OrderRemovalReason_ORDER_REMOVAL_REASON_POST_ONLY_WOULD_CROSS_MAKER_ORDER OrderRemovalReason = 6
	// The order was an ICO order and would have been placed on the orderbook as
	// resting liquidity and was removed.
	OrderRemovalReason_ORDER_REMOVAL_REASON_IMMEDIATE_OR_CANCEL_WOULD_REST_ON_BOOK OrderRemovalReason = 7
	// The order was a fill-or-kill order that could not be fully filled and was
	// removed.
	OrderRemovalReason_ORDER_REMOVAL_REASON_FOK_ORDER_COULD_NOT_BE_FULLY_FULLED OrderRemovalReason = 8
	// The order was a reduce-only order that was removed due to either:
	// - being a taker order and fully-filling the order would flip the side of
	//    the subaccount's position, in this case the remaining size of the
	//    order is removed
	// - being a maker order resting on the book and being removed when either
	//    the subaccount's position is closed or flipped sides
	OrderRemovalReason_ORDER_REMOVAL_REASON_REDUCE_ONLY_RESIZE OrderRemovalReason = 9
	// The order should be expired, according to the Indexer's cached data, but
	// the Indexer has yet to receive a message to remove the order. In order to
	// keep the data cached by the Indexer up-to-date and accurate, clear out
	// the data if it's expired by sending an order removal with this reason.
	// Protocol should never send this reason to Indexer.
	OrderRemovalReason_ORDER_REMOVAL_REASON_INDEXER_EXPIRED OrderRemovalReason = 10
	// The order has been replaced.
	OrderRemovalReason_ORDER_REMOVAL_REASON_REPLACED OrderRemovalReason = 11
	// The order has been fully-filled. Only sent by the Indexer for stateful
	// orders.
	OrderRemovalReason_ORDER_REMOVAL_REASON_FULLY_FILLED OrderRemovalReason = 12
	// The order has been removed since the subaccount does not satisfy the
	// equity tier requirements.
	OrderRemovalReason_ORDER_REMOVAL_REASON_EQUITY_TIER OrderRemovalReason = 13
)

func ConvertOrderRemovalReasonToIndexerOrderRemovalReason

func ConvertOrderRemovalReasonToIndexerOrderRemovalReason(
	removalReason clobtypes.OrderRemoval_RemovalReason,
) OrderRemovalReason

ConvertOrderRemovalReasonToIndexerOrderRemovalReason converts a `OrderRemoval_RemovalReason` to indexer's `OrderRemoveV1_OrderRemovalReason`. This is helpful in the memclob logic where we handle a bulk of order removals and generate offchain updates for each order removal.

func GetOrderRemovalReason

func GetOrderRemovalReason(
	orderStatus clobtypes.OrderStatus,
	orderError error,
) (OrderRemovalReason, error)

GetOrderRemovalReason gets the matching `OrderRemove_OrderRemovalReason` given the status of an order.

func (OrderRemovalReason) EnumDescriptor

func (OrderRemovalReason) EnumDescriptor() ([]byte, []int)

func (OrderRemovalReason) String

func (x OrderRemovalReason) String() string

Jump to

Keyboard shortcuts

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