quote

package
v0.0.0-...-5ca2f50 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const AMERITRADE_URL_BASE = "https://api.tdameritrade.com/v1/marketdata"
View Source
const COL_WIDTH = 15
View Source
const ESC_SGR_RESET string = "\x1b[0m"

Variables

This section is empty.

Functions

func HeaderRow

func HeaderRow() []string

func ToStr

func ToStr(i interface{}) string

CAST INTERFACE TO string

Types

type ApiAmeritrade

type ApiAmeritrade struct {
	KEY string
}

func (*ApiAmeritrade) GetPriceHistory

func (API *ApiAmeritrade) GetPriceHistory(pCli *http.Client, sym string, tMin, tMax time.Time) (sC S_CandleArray, E error)

func (*ApiAmeritrade) GetQuotes

func (API *ApiAmeritrade) GetQuotes(pCli *http.Client, syms []string) (sQ []S_Quote, E error)

type Bucket

type Bucket struct {
	Sum     T_Num
	Samples uint
}

func (*Bucket) AddSample

func (B *Bucket) AddSample(v T_Num)

func (Bucket) Val

func (B Bucket) Val() T_Num

type I_Chartable

type I_Chartable interface {
	Length() int
	Timestamp(int) int64
	Price(int) T_Num
}

type Obj

type Obj map[string]interface{}

func (Obj) ToQuote

func (SRC Obj) ToQuote() S_Quote

type Quoter

type Quoter interface {
	GetQuotes(*http.Client, []string) ([]S_Quote, error)
}

type S_Buckets

type S_Buckets struct {
	Bkts       []Bucket
	TMin, TMax int64
	PMin, PMax T_Num
}

func ToBuckets

func ToBuckets(hist I_Chartable, nB int) (RET S_Buckets)

type S_Candle

type S_Candle struct {
	Hi   T_Num
	Lo   T_Num
	Vol  T_Num
	Time T_Time
}

type S_CandleArray

type S_CandleArray []S_Candle

func (S_CandleArray) Length

func (V S_CandleArray) Length() int

func (S_CandleArray) Price

func (V S_CandleArray) Price(ix int) T_Num

func (S_CandleArray) Timestamp

func (V S_CandleArray) Timestamp(ix int) int64

type S_Price

type S_Price struct {
	Bid  T_Num
	Ask  T_Num
	Last T_Num
	Open T_Num
}

type S_Quote

type S_Quote struct {
	Symbol      string
	Description string
	Exchange    string
	Time        S_Time
	Price       S_Price
	Size        S_Size
}

func (*S_Quote) Display

func (Q *S_Quote) Display(out io.Writer, hist S_SampleArray) error

type S_Sample

type S_Sample struct {
	Time  T_Time
	Price S_Price
	Size  S_Size
}

type S_SampleArray

type S_SampleArray []S_Sample

func (S_SampleArray) Length

func (V S_SampleArray) Length() int

func (S_SampleArray) Price

func (V S_SampleArray) Price(ix int) T_Num

func (S_SampleArray) Timestamp

func (V S_SampleArray) Timestamp(ix int) int64

type S_Size

type S_Size struct {
	Bid         T_Num
	Ask         T_Num
	Last        T_Num
	TotalVolume T_Num
}

type S_Time

type S_Time struct {
	Quote T_Time
	Trade T_Time
}

type T_Num

type T_Num float32

func ToNum

func ToNum(i interface{}) T_Num

CONVERT INTERFACE TO T_Num

func (T_Num) String

func (T T_Num) String(wid, dec int) string

type T_Time

type T_Time struct {
	time.Time
}

func ToTime

func ToTime(i interface{}) T_Time

CONVERT INTERFACE (ms timestamp) TO T_Time

func (T_Time) String

func (T T_Time) String() string

Jump to

Keyboard shortcuts

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