marketdata

package module
v0.0.0-...-89322db Latest Latest
Warning

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

Go to latest
Published: May 23, 2025 License: MIT Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareBarWithTimestamp

func CompareBarWithTimestamp(bar *Bar, t time.Time) int

func StoreBars

func StoreBars(w io.Writer, bars Bars) error

Types

type Bar

type Bar struct {
	Timestamp  time.Time `json:"t"`
	Volume     uint64    `json:"v"`
	TradeCount uint64    `json:"n"`
	VWAP       float64   `json:"vw"`

	*OHLC
}

func NewBarFromAlpaca

func NewBarFromAlpaca(alpacaBar marketdata.Bar) *Bar

func (*Bar) Date

func (b *Bar) Date() date.Date

func (*Bar) GetVWAP

func (b *Bar) GetVWAP() float64

func (*Bar) HeikinAshi

func (b *Bar) HeikinAshi(prev *OHLC) *OHLC

func (*Bar) Localize

func (b *Bar) Localize()

type BarCollector

type BarCollector interface {
	Collect(symbol string, ts timespan.TimeSpan) (Bars, error)
}

type Bars

type Bars []*Bar

func LoadBars

func LoadBars(r io.Reader) (Bars, error)

func (Bars) BinarySearch

func (bars Bars) BinarySearch(t time.Time) (int, bool)

func (Bars) ClosePrices

func (bars Bars) ClosePrices() []float64

func (Bars) IndexForward

func (bars Bars) IndexForward(t time.Time) (int, bool)

func (Bars) IndexReverse

func (bars Bars) IndexReverse(t time.Time) (int, bool)

func (Bars) Last

func (bars Bars) Last() *Bar

func (Bars) LastN

func (bars Bars) LastN(n int) Bars

func (Bars) Localize

func (bars Bars) Localize()

func (Bars) NextN

func (bars Bars) NextN(index, n int) Bars

func (Bars) TimeSpan

func (bars Bars) TimeSpan() timespan.TimeSpan

func (Bars) Timestamps

func (bars Bars) Timestamps() []time.Time

type CollectCommand

type CollectCommand struct {
	End, Start date.Date
	Dir        string
	Symbol     string
	Location   *time.Location
	Collector  BarCollector
}

func (*CollectCommand) Init

func (cmd *CollectCommand) Init() error

func (*CollectCommand) Run

func (cmd *CollectCommand) Run() error

type OHLC

type OHLC struct {
	Open  float64 `json:"o"`
	High  float64 `json:"h"`
	Low   float64 `json:"l"`
	Close float64 `json:"c"`
}

func (*OHLC) Float64s

func (ohlc *OHLC) Float64s() []float64

func (*OHLC) GetClose

func (ohlc *OHLC) GetClose() float64

func (*OHLC) GetHigh

func (ohlc *OHLC) GetHigh() float64

func (*OHLC) GetLow

func (ohlc *OHLC) GetLow() float64

func (*OHLC) GetOpen

func (ohlc *OHLC) GetOpen() float64

func (*OHLC) HL2

func (ohlc *OHLC) HL2() float64

func (*OHLC) HLC3

func (ohlc *OHLC) HLC3() float64

func (*OHLC) HLCC4

func (ohlc *OHLC) HLCC4() float64

func (*OHLC) OCC3

func (ohlc *OHLC) OCC3() float64

func (*OHLC) OHLC4

func (ohlc *OHLC) OHLC4() float64

Directories

Path Synopsis
cmd
collect command

Jump to

Keyboard shortcuts

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