exchange

package
v0.1.429-bweng-test-1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOutstandingLimitOrdersToOrderbook

func AddOutstandingLimitOrdersToOrderbook(
	orderbook *types.OrderBook,
	limitBuys []*types.Order,
	limitSells []*types.Order,
)

func CancelOrders

func CancelOrders(
	cancels []*types.Cancellation,
	orderbook *types.OrderBook,
)

func MatchByValueFOKMarketOrder

func MatchByValueFOKMarketOrder(
	ctx sdk.Context,
	marketOrder *types.Order,
	orderBookEntries *types.CachedSortedOrderBookEntries,
	direction types.PositionDirection,
	totalExecuted *sdk.Dec,
	totalPrice *sdk.Dec,
	minPrice *sdk.Dec,
	maxPrice *sdk.Dec,
	settlements []*types.SettlementEntry,
	allTakerSettlements []*types.SettlementEntry,
	blockOrders *cache.BlockOrders,
) ([]*types.SettlementEntry, []*types.SettlementEntry)

func MatchFOKMarketOrder

func MatchFOKMarketOrder(
	ctx sdk.Context,
	marketOrder *types.Order,
	orderBookEntries *types.CachedSortedOrderBookEntries,
	direction types.PositionDirection,
	totalExecuted *sdk.Dec,
	totalPrice *sdk.Dec,
	minPrice *sdk.Dec,
	maxPrice *sdk.Dec,
	settlements []*types.SettlementEntry,
	allTakerSettlements []*types.SettlementEntry,
	blockOrders *cache.BlockOrders,
) ([]*types.SettlementEntry, []*types.SettlementEntry)

func MatchMarketOrder

func MatchMarketOrder(
	ctx sdk.Context,
	marketOrder *types.Order,
	orderBookEntries *types.CachedSortedOrderBookEntries,
	direction types.PositionDirection,
	totalExecuted *sdk.Dec,
	totalPrice *sdk.Dec,
	minPrice *sdk.Dec,
	maxPrice *sdk.Dec,
	settlements []*types.SettlementEntry,
	allTakerSettlements []*types.SettlementEntry,
	blockOrders *cache.BlockOrders,
) ([]*types.SettlementEntry, []*types.SettlementEntry)

func MergeByNominalTakerSettlements

func MergeByNominalTakerSettlements(settlements []*types.SettlementEntry) []*types.SettlementEntry

func Settle

func Settle(
	ctx sdk.Context,
	takerOrder *types.Order,
	quantityTaken sdk.Dec,
	order types.OrderBookEntry,
	worstPrice sdk.Dec,
	blockOrders *cache.BlockOrders,
) ([]*types.SettlementEntry, []*types.SettlementEntry)

this function helps to settle market orders

func SettleFromBook

func SettleFromBook(
	ctx sdk.Context,
	longOrder types.OrderBookEntry,
	shortOrder types.OrderBookEntry,
	executedQuantity sdk.Dec,
) []*types.SettlementEntry

func UpdateOrderData

func UpdateOrderData(
	takerOrder *types.Order,
	quantityTaken sdk.Dec,
	blockOrders *cache.BlockOrders,
)

this function update the order data in the memState to be noted that the order status will only reflect for market orders that are settled

Types

type ExecutionOutcome

type ExecutionOutcome struct {
	TotalNotional sdk.Dec
	TotalQuantity sdk.Dec
	Settlements   []*types.SettlementEntry
	MinPrice      sdk.Dec
	MaxPrice      sdk.Dec
}

func MatchLimitOrders

func MatchLimitOrders(
	ctx sdk.Context,
	orderbook *types.OrderBook,
) ExecutionOutcome

func MatchMarketOrders

func MatchMarketOrders(
	ctx sdk.Context,
	marketOrders []*types.Order,
	orderBookEntries *types.CachedSortedOrderBookEntries,
	direction types.PositionDirection,
	blockOrders *cache.BlockOrders,
) ExecutionOutcome

func (*ExecutionOutcome) Merge

type ToSettle

type ToSettle struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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