mirror of
https://github.com/lukewilson2002/autotrader.git
synced 2025-08-03 13:29:33 +00:00
Gave the Series, Frame, and Signals a lot of needed love
This commit is contained in:
13
trader.go
13
trader.go
@@ -9,7 +9,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/go-co-op/gocron"
|
||||
"github.com/rocketlaunchr/dataframe-go"
|
||||
)
|
||||
|
||||
// Performance (financial) reporting and statistics.
|
||||
@@ -86,13 +85,13 @@ func (t *Trader) Run() {
|
||||
func (t *Trader) Init() {
|
||||
t.Strategy.Init(t)
|
||||
t.stats.Dated = NewDataFrame(
|
||||
NewDataSeries(dataframe.NewSeriesTime("Date", nil)),
|
||||
NewDataSeries(dataframe.NewSeriesFloat64("Equity", nil)),
|
||||
NewDataSeries(dataframe.NewSeriesFloat64("Profit", nil)),
|
||||
NewDataSeries(dataframe.NewSeriesFloat64("Drawdown", nil)),
|
||||
NewDataSeries(dataframe.NewSeriesFloat64("Returns", nil)),
|
||||
NewDataSeries("Date"),
|
||||
NewDataSeries("Equity"),
|
||||
NewDataSeries("Profit"),
|
||||
NewDataSeries("Drawdown"),
|
||||
NewDataSeries("Returns"),
|
||||
)
|
||||
t.Broker.SignalConnect("PositionClosed", func(args ...interface{}) {
|
||||
t.Broker.SignalConnect("PositionClosed", t, func(args ...interface{}) {
|
||||
position := args[0].(Position)
|
||||
t.stats.returnsThisCandle += position.PL()
|
||||
})
|
||||
|
Reference in New Issue
Block a user