Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PriceParser ¶
type PriceParser struct{}
PriceParser is designed to abstract away the underlying number used as a price. Due to efficiency and floating point precision limitations, this backtester uses an integer to represent all prices. This means that $0.10 is, internally, 100,000,000. Because such large numbers are rather unwieldy for humans, the PriceParser will take a "normal" 2 decimal places numbers as input, and show normal" 2 decimal places numbers as output when requested to `display()` For consistency's sake, PriceParser should be used for ALL prices that enter the backtester system. Numbers should also always be parsed correctly to view.
func (*PriceParser) Display ¶
func (p *PriceParser) Display(i int64) float64
Display an int as float with 2 decimal places
func (*PriceParser) DisplayDecimal ¶
func (p *PriceParser) DisplayDecimal(i int64, decimal int) float64
DisplayDecimal an int as float with custom decimal places