internal

package
v0.0.0-...-78b482a Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//BITCUSD pair represents the BTC/USD pair typically found as a basis
	BITCUSD = Pair{
		Base:  BTC,
		Quote: USD,
	}

	//ETHUSD pair represent the ETH/USD pair found on exchanges.
	ETHUSD = Pair{
		Base:  ETH,
		Quote: USD,
	}
)

Functions

This section is empty.

Types

type Asset

type Asset string

Asset represent a coin or currency that is used in trading pairs.

const (
	//BTC reprseent the Bitcoin asset
	BTC Asset = "BTC"
	//ETH represents the ethereum asset
	ETH Asset = "ETH"
	//USD represents the USD asset
	USD Asset = "USD"
)

func (Asset) Decimals

func (a Asset) Decimals() int

Decimals stores the number of decimal places that an asset has.

func (Asset) Format

func (a Asset) Format(i int64) string

Format will convert the units into a string that has a floating point denomination.

func (Asset) Unit

func (a Asset) Unit(u float64) int64

Unit returns the normalized unit value for an asset. i.e. for USD if the given value is: 50.00, then the normalized value is 5000, due to the number of cents in the value.

func (Asset) UnitStr

func (a Asset) UnitStr(s string) (int64, error)

UnitStr will produce a normalized unit from a string value. See Unit for more information.

type CandlesCache

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

CandlesCache represents a local candles cache for every exchange. To allow dinamic polling from multiple sources (REST + Websocket)

func NewCandlesCache

func NewCandlesCache() *CandlesCache

NewCandlesCache creates a new CandlesCache Object

func (*CandlesCache) Get

func (cc *CandlesCache) Get(market *environment.Market) ([]environment.CandleStick, bool)

Get gets the value for the specified key.

func (*CandlesCache) Set

func (cc *CandlesCache) Set(market *environment.Market, candles []environment.CandleStick) []environment.CandleStick

Set sets a value for the specified key.

type Limit

type Limit struct {
	ClientID string
	Pair     Pair
	Side     Side
	BaseSize string
	Price    string
	PostOnly bool
	Expires  *time.Time
}

Limit represents an order that a limit type

type OrderbookCache

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

OrderbookCache represents a local orderbook cache for every exchange. To allow dinamic polling from multiple sources (REST + Websocket)

func NewOrderbookCache

func NewOrderbookCache() *OrderbookCache

NewOrderbookCache creates a new OrderbookCache Object

func (*OrderbookCache) Get

func (cc *OrderbookCache) Get(market *environment.Market) (*environment.OrderBook, bool)

Get gets the value for the specified key.

func (*OrderbookCache) Set

func (cc *OrderbookCache) Set(market *environment.Market, book *environment.OrderBook) *environment.OrderBook

Set sets a value for the specified key.

type Pair

type Pair struct {
	Base  Asset
	Quote Asset
}

Pair represent an asset pairing that can be trading on an echange.

type Side

type Side string

Side represents the side of the trade that the order is placing.

const (
	// SideBuy specifies the buy side of an order
	SideBuy Side = "BUY"

	// SideSell specifies the sell side of an order
	SideSell = "SELL"
)

type SummaryCache

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

SummaryCache represents a local summary cache for every exchange. To allow dinamic polling from multiple sources (REST + Websocket)

func NewSummaryCache

func NewSummaryCache() *SummaryCache

NewSummaryCache creates a new SummaryCache Object

func (*SummaryCache) Get

func (sc *SummaryCache) Get(market *environment.Market) (*environment.MarketSummary, bool)

Get gets the value for the specified key.

func (*SummaryCache) Set

func (sc *SummaryCache) Set(market *environment.Market, summary *environment.MarketSummary) *environment.MarketSummary

Set sets a value for the specified key.

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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