tradingutil

package
v0.0.0-...-c0411a1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

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

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

AggregateTradesQuoteQuantity aggregates the quote quantity from the given trade slice

func CollectOpenOrders

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

func CollectOrderGroupIds

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

func CollectOrderSymbols

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

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

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

type CancelAllOrdersBySymbolService

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

type CancelAllOrdersService

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