Documentation
¶
Index ¶
- Constants
- func CompareBarWithTimestamp(bar *Bar, t time.Time) int
- func CompareBarsByTimestamp(a, b *Bar) int
- func QuantityMeanStddev(q *Quantity) (cluster.Point, error)
- type Bar
- type BarSet
- type Bars
- func (bars Bars) BinarySearch(t time.Time) (int, bool)
- func (bars Bars) ClosePrices() []float64
- func (bars Bars) IndexForward(t time.Time) (int, bool)
- func (bars Bars) IndexReverse(t time.Time) (int, bool)
- func (bars Bars) Last() *Bar
- func (bars Bars) LastN(n int) Bars
- func (bars Bars) Localize()
- func (bars Bars) NextN(index, n int) Bars
- func (bars Bars) Store(w io.Writer) error
- func (bars Bars) StoreToFile(fpath string) error
- func (bars Bars) TimeSpan() timespan.TimeSpan
- func (bars Bars) Timestamps() []time.Time
- type Collection
- type CollectionInfo
- type Direction
- type Hours
- type LoadBarsFunc
- type MakePointFunc
- type OHLC
- type Position
- type PositionType
- type Positions
- type PositionsAnalysis
- type Quantity
- func (q *Quantity) AddRecord(r QuantityRecord)
- func (q *Quantity) DropRecordsBefore(t time.Time)
- func (q *Quantity) FindRecord(t time.Time) (QuantityRecord, bool)
- func (q *Quantity) FindRecordsAfter(t time.Time) []QuantityRecord
- func (q *Quantity) IsEmpty() bool
- func (q *Quantity) RecordValues() []float64
- func (q *Quantity) SortByTime()
- type QuantityRecord
- type Security
- type TimeOfDay
- type TimePrice
- type TimeSeries
- func (ts *TimeSeries) AddQuantity(q *Quantity)
- func (ts *TimeSeries) Cluster(k int, makePoint MakePointFunc) error
- func (ts *TimeSeries) DropRecordsBefore(t time.Time)
- func (ts *TimeSeries) FindQuantity(name string) (*Quantity, bool)
- func (ts *TimeSeries) IsEmpty() bool
- func (ts *TimeSeries) SortByTime() bool
- type TimeValue
Constants ¶
View Source
const ( PositionTypeLong = "long" PositionTypeShort = "short" )
View Source
const AttrCluster = "cluster"
View Source
const (
Resolution1Min = "1m"
)
View Source
const SecurityKeyName = "symbol"
Variables ¶
This section is empty.
Functions ¶
func CompareBarsByTimestamp ¶
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) HeikinAshi ¶
type Bars ¶
type Bars []*Bar
func LoadBarsFromFile ¶
func LoadRunBars ¶
func (Bars) ClosePrices ¶
func (Bars) StoreToFile ¶
func (Bars) Timestamps ¶
type Collection ¶
type CollectionInfo ¶
type OHLC ¶
type Position ¶
type PositionType ¶
type PositionType int
type Positions ¶
type Positions []*Position
func (Positions) Analyze ¶
func (ps Positions) Analyze() *PositionsAnalysis
func (Positions) StoreToFile ¶
type PositionsAnalysis ¶
type PositionsAnalysis struct {
Winning, TotalPL float64
}
type Quantity ¶
type Quantity struct { Name string `json:"name"` Records []QuantityRecord `json:"records"` Attributes map[string]any `json:"attributes"` }
func NewQuantity ¶
func NewQuantity(name string, records ...QuantityRecord) *Quantity
func (*Quantity) AddRecord ¶
func (q *Quantity) AddRecord(r QuantityRecord)
func (*Quantity) DropRecordsBefore ¶
func (*Quantity) FindRecord ¶
func (q *Quantity) FindRecord(t time.Time) (QuantityRecord, bool)
func (*Quantity) FindRecordsAfter ¶
func (q *Quantity) FindRecordsAfter(t time.Time) []QuantityRecord
func (*Quantity) RecordValues ¶
func (*Quantity) SortByTime ¶
func (q *Quantity) SortByTime()
type QuantityRecord ¶
type Security ¶
type TimeOfDay ¶
func (*TimeOfDay) MarshalJSON ¶
func (*TimeOfDay) MinuteOfDay ¶
func (*TimeOfDay) UnmarshalJSON ¶
type TimeSeries ¶
type TimeSeries struct {
Quantities []*Quantity `json:"quantities"`
}
func NewTimeSeries ¶
func NewTimeSeries() *TimeSeries
func (*TimeSeries) AddQuantity ¶
func (ts *TimeSeries) AddQuantity(q *Quantity)
func (*TimeSeries) Cluster ¶
func (ts *TimeSeries) Cluster(k int, makePoint MakePointFunc) error
func (*TimeSeries) DropRecordsBefore ¶
func (ts *TimeSeries) DropRecordsBefore(t time.Time)
func (*TimeSeries) FindQuantity ¶
func (ts *TimeSeries) FindQuantity(name string) (*Quantity, bool)
func (*TimeSeries) IsEmpty ¶
func (ts *TimeSeries) IsEmpty() bool
func (*TimeSeries) SortByTime ¶
func (ts *TimeSeries) SortByTime() bool
Source Files
¶
Click to show internal directories.
Click to hide internal directories.