mirror of
https://github.com/lukewilson2002/autotrader.git
synced 2025-06-15 16:33:50 +00:00
Add some type safety to getting DOHLCV columns
This commit is contained in:
parent
ed08bd275d
commit
920df02bcc
28
frame.go
28
frame.go
@ -178,29 +178,29 @@ func (d *Frame) Dates() *Series {
|
|||||||
return d.Series("Date")
|
return d.Series("Date")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opens returns a Series of all the open prices in the Frame. This is equivalent to calling Series("Open").
|
// Opens returns a FloatSeries of all the open prices in the Frame. This is equivalent to calling Series("Open").
|
||||||
func (d *Frame) Opens() *Series {
|
func (d *Frame) Opens() *FloatSeries {
|
||||||
return d.Series("Open")
|
return &FloatSeries{d.Series("Open")}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Highs returns a Series of all the high prices in the Frame. This is equivalent to calling Series("High").
|
// Highs returns a FloatSeries of all the high prices in the Frame. This is equivalent to calling Series("High").
|
||||||
func (d *Frame) Highs() *Series {
|
func (d *Frame) Highs() *FloatSeries {
|
||||||
return d.Series("High")
|
return &FloatSeries{d.Series("High")}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lows returns a Series of all the low prices in the Frame. This is equivalent to calling Series("Low").
|
// Lows returns a FloatSeries of all the low prices in the Frame. This is equivalent to calling Series("Low").
|
||||||
func (d *Frame) Lows() *Series {
|
func (d *Frame) Lows() *FloatSeries {
|
||||||
return d.Series("Low")
|
return &FloatSeries{d.Series("Low")}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Closes returns a Series of all the close prices in the Frame. This is equivalent to calling Series("Close").
|
// Closes returns a FloatSeries of all the close prices in the Frame. This is equivalent to calling Series("Close").
|
||||||
func (d *Frame) Closes() *Series {
|
func (d *Frame) Closes() *FloatSeries {
|
||||||
return d.Series("Close")
|
return &FloatSeries{d.Series("Close")}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Volumes returns a Series of all the volumes in the Frame. This is equivalent to calling Series("Volume").
|
// Volumes returns a Series of all the volumes in the Frame. This is equivalent to calling Series("Volume").
|
||||||
func (d *Frame) Volumes() *Series {
|
func (d *Frame) Volumes() *FloatSeries {
|
||||||
return d.Series("Volume")
|
return &FloatSeries{d.Series("Volume")}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Contains returns true if the Frame contains all the given series names. Remember that names are case sensitive.
|
// Contains returns true if the Frame contains all the given series names. Remember that names are case sensitive.
|
||||||
|
@ -33,6 +33,10 @@ func NewSeries(name string, vals ...any) *Series {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Series) ISetName(name string) {
|
||||||
|
s.SetName(name)
|
||||||
|
}
|
||||||
|
|
||||||
// Copy is equivalent to CopyRange(0, -1).
|
// Copy is equivalent to CopyRange(0, -1).
|
||||||
func (s *Series) Copy() *Series {
|
func (s *Series) Copy() *Series {
|
||||||
return s.CopyRange(0, -1)
|
return s.CopyRange(0, -1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user