utils

package
v0.10.21 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DELIMITER = "_"

Variables

This section is empty.

Functions

func Assets2TradingPair

func Assets2TradingPair(baseAsset, quoteAsset string) (symbol string)

func CalBigNotional

func CalBigNotional(price, qty int64) *big.Int

func CalBigNotionalInt64

func CalBigNotionalInt64(price, qty int64) int64

CalBigNotionalInt64() calculate the multiply value of notional based on price and qty both price and qty are in int64 with 1e8 as decimals TODO: here the floor divide is used. there may cause small residual.

func CalcLotSize

func CalcLotSize(price int64) int64

func CalcPriceWMA

func CalcPriceWMA(prices *utils.FixedSizeRing) int64

func CalcTickSize

func CalcTickSize(price int64) int64

Price ≥1e9 ≥1e10 ≥1e11 ≥1e12 ≥1e13 ≥1e14 ≥1e15 ≥1e16 ≥1e17 TickSize 1e4 1e5 1e6 1e7 1e8 1e9 1e10 1e11 1e12 LotSize 1e4 1e3 1e2 1e1 1 1 1 1 1

func IsExceedMaxNotional

func IsExceedMaxNotional(price, qty int64) bool

IsExceedMaxNotional return the result that is the product of price and quantity exceeded max notional

func IsMiniTokenTradingPair

func IsMiniTokenTradingPair(symbol string) bool

func IsUnderMinNotional

func IsUnderMinNotional(price, qty int64) bool

min notional is 1, so we need to ensure price * qty / 1e8 >= 1

func TradingPair2Assets

func TradingPair2Assets(symbol string) (baseAsset, quoteAsset string, err error)

func TradingPair2AssetsSafe

func TradingPair2AssetsSafe(symbol string) (baseAsset, quoteAsset string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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