exchange

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayToMap

func ArrayToMap(exchanges []Exchange) map[string]Exchange

ArrayToMap converts an array of exchanges to a map of exchanges.

func GetExpiredExchangesNames

func GetExpiredExchangesNames(
	expectedExchanges []string,
	exchangesFromDB []Exchange,
	expirationDuration time.Duration,
) (toSync []string, err error)

GetExpiredExchangesNames returns the names of the exchanges that are expired.

Types

type Exchange

type Exchange struct {
	Name         string
	Periods      []string
	Pairs        []string
	Fees         float64
	LastSyncTime time.Time
}

Exchange represents an exchange.

func MapToArray

func MapToArray(mappedExchanges map[string]Exchange) []Exchange

MapToArray converts a map of exchanges to an array of exchanges.

func (*Exchange) AddPair

func (e *Exchange) AddPair(symbols ...string)

AddPair adds a pair to the exchange.

func (*Exchange) AddPeriods

func (e *Exchange) AddPeriods(symbols ...string)

AddPeriods adds a period to the exchange.

func (Exchange) Equals

func (e Exchange) Equals(e2 Exchange) bool

Equals checks if two exchanges are equal.

func (Exchange) IsOutdated

func (e Exchange) IsOutdated(expirationDuration time.Duration) bool

IsOutdated checks if the exchange is outdated.

func (Exchange) Merge

func (e Exchange) Merge(e2 Exchange) Exchange

Merge merges two exchanges into one.

func (Exchange) String

func (e Exchange) String() string

String returns the string representation of the exchange.

Jump to

Keyboard shortcuts

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