utils

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ESC = "\033"

ESC is the escape string.

Variables

This section is empty.

Functions

func Bold

func Bold(s string) string

Bold makes a string bold.

func Color

func Color(s string, d Direction) string

Color formats a string according to price direction.

func DateF

func DateF(timestamp int) string

DateF returns a formatted date string from a quote.

func DateFS added in v0.0.4

func DateFS(timestamp int) string

DateFS returns a short formatted date.

func MktStateF

func MktStateF(m finance.MarketState) string

MktStateF formats market state.

func NumberF

func NumberF(i int) string

NumberF formats a big number with commas.

func NumberFancyF added in v0.0.4

func NumberFancyF(n int64) string

NumberFancyF adds suffixes to big numbers.

func Strip

func Strip(s string) string

Strip strips weird html strings.

func ToInt

func ToInt(value string) int

ToInt converts a string to an int.

func ToString

func ToString(v int) string

ToString converts an int to a string.

func ToStringF

func ToStringF(v float64) string

ToStringF converts an int to a string.

Types

type Direction

type Direction int

Direction is a price direction.

const (
	Flat Direction = iota
	Down
	Up
)

func PriceDirection

func PriceDirection(q *finance.Quote) Direction

PriceDirection returns a plus/minus indicating price direction.

Jump to

Keyboard shortcuts

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