tradingutil

package
v1.59.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: AGPL-3.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregateTradesQuantity

func AggregateTradesQuantity(trades []types.Trade) fixedpoint.Value

AggregateTradesQuantity sums up the quantity from the given trades totalQuantity = SUM(trade1.Quantity, trade2.Quantity, ...)

func AggregateTradesQuoteQuantity added in v1.57.0

func AggregateTradesQuoteQuantity(trades []types.Trade) fixedpoint.Value

AggregateTradesQuoteQuantity aggregates the quote quantity from the given trade slice

func CollectOpenOrders added in v1.58.0

func CollectOpenOrders(ctx context.Context, ex types.Exchange, symbols ...string) ([]types.Order, error)

func CollectOrderGroupIds added in v1.58.0

func CollectOrderGroupIds(orders []types.Order) (groupIds []uint32)

func CollectOrderSymbols added in v1.58.0

func CollectOrderSymbols(orders []types.Order) (symbols []string)

func CollectTradeFee

func CollectTradeFee(trades []types.Trade) map[string]fixedpoint.Value

CollectTradeFee collects the fee from the given trade slice

func UniversalCancelAllOrders added in v1.58.0

func UniversalCancelAllOrders(ctx context.Context, exchange types.Exchange, openOrders []types.Order) error

UniversalCancelAllOrders checks if the exchange instance supports the best order cancel strategy it tries the first interface CancelAllOrdersService that does not need any existing order information or symbol information.

if CancelAllOrdersService is not supported, then it tries CancelAllOrdersBySymbolService which needs at least one symbol for the cancel api request.

Types

type CancelAllOrdersByGroupIDService added in v1.58.0

type CancelAllOrdersByGroupIDService interface {
	CancelOrdersByGroupID(ctx context.Context, groupID uint32) ([]types.Order, error)
}

type CancelAllOrdersBySymbolService added in v1.58.0

type CancelAllOrdersBySymbolService interface {
	CancelOrdersBySymbol(ctx context.Context, symbol string) ([]types.Order, error)
}

type CancelAllOrdersService added in v1.58.0

type CancelAllOrdersService interface {
	CancelAllOrders(ctx context.Context) ([]types.Order, error)
}

Jump to

Keyboard shortcuts

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