price

package
v0.0.0-...-bc49051 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Price

type Price int64

Price is a fixed-point value that can represent prices and safely be used for math.

func Parse

func Parse(raw string) Price

Parse pareses a price and returns the value.

func (Price) Add

func (p Price) Add(other Price) Price

Add implements + for prices.

func (Price) Delta

func (p Price) Delta(other Price) Price

Delta returns the absolute difference between a given price and another price.

func (Price) Div

func (p Price) Div(other Price) Price

Div implements / for prices.

func (Price) Float64

func (p Price) Float64() float64

Float64 returns a float64 form of the price by dividing the price by the basis.

func (Price) LeftShift

func (p Price) LeftShift(by uint) Price

LeftShift implements >> for prices.

func (Price) Mul

func (p Price) Mul(other Price) Price

Mul implements * for prices.

func (Price) RightShift

func (p Price) RightShift(by uint) Price

RightShift implements << for prices.

func (Price) String

func (p Price) String() string

String returns a string form of the price.

func (Price) Sub

func (p Price) Sub(other Price) Price

Sub implements - for prices.

Jump to

Keyboard shortcuts

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