Documentation
¶
Index ¶
- type FinalResultsHolder
- type Handler
- type ResultEvent
- type ResultTransactions
- type Results
- type Statistic
- func (s *Statistic) AddComplianceSnapshotForTime(c compliance.Snapshot, e fill.Event) error
- func (s *Statistic) AddHoldingsForTime(h *holdings.Holding) error
- func (s *Statistic) CalculateAllResults() error
- func (s *Statistic) GetBestMarketPerformer(results []FinalResultsHolder) *FinalResultsHolder
- func (s *Statistic) GetBestStrategyPerformer(results []FinalResultsHolder) *FinalResultsHolder
- func (s *Statistic) GetTheBiggestDrawdownAcrossCurrencies(results []FinalResultsHolder) *FinalResultsHolder
- func (s *Statistic) PrintAllEvents()
- func (s *Statistic) PrintTotalResults()
- func (s *Statistic) Reset()
- func (s *Statistic) Serialise() (string, error)
- func (s *Statistic) SetEventForOffset(e common.EventHandler) error
- func (s *Statistic) SetStrategyName(name string)
- func (s *Statistic) SetupEventForTime(e common.DataEventHandler) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FinalResultsHolder ¶
type FinalResultsHolder struct { Exchange string `json:"exchange"` Asset asset.Item `json:"asset"` Pair currency.Pair `json:"currency"` MaxDrawdown currencystatistics.Swing `json:"max-drawdown"` MarketMovement float64 `json:"market-movement"` StrategyMovement float64 `json:"strategy-movement"` }
FinalResultsHolder holds important stats about a currency's performance
type Handler ¶
type Handler interface { SetStrategyName(string) SetupEventForTime(common.DataEventHandler) error SetEventForOffset(e common.EventHandler) error AddHoldingsForTime(*holdings.Holding) error AddComplianceSnapshotForTime(compliance.Snapshot, fill.Event) error CalculateAllResults() error Reset() Serialise() (string, error) }
Handler interface details what a statistic is expected to do
type ResultEvent ¶
ResultEvent stores the time
type ResultTransactions ¶
type ResultTransactions struct { Time time.Time `json:"time"` Direction gctorder.Side `json:"direction"` Price float64 `json:"price"` Amount float64 `json:"amount"` Reason string `json:"reason,omitempty"` }
ResultTransactions stores details on a transaction
type Results ¶
type Results struct { Pair string `json:"pair"` TotalEvents int `json:"totalEvents"` TotalTransactions int `json:"totalTransactions"` Events []ResultEvent `json:"events"` Transactions []ResultTransactions `json:"transactions"` StrategyName string `json:"strategyName"` }
Results holds some statistics on results
type Statistic ¶
type Statistic struct { StrategyName string `json:"strategy-name"` StrategyDescription string `json:"strategy-description"` StrategyNickname string `json:"strategy-nickname"` StrategyGoal string `json:"strategy-goal"` ExchangeAssetPairStatistics map[string]map[asset.Item]map[currency.Pair]*currencystatistics.CurrencyStatistic `json:"-"` RiskFreeRate float64 `json:"risk-free-rate"` TotalBuyOrders int64 `json:"total-buy-orders"` TotalSellOrders int64 `json:"total-sell-orders"` TotalOrders int64 `json:"total-orders"` BiggestDrawdown *FinalResultsHolder `json:"biggest-drawdown,omitempty"` BestStrategyResults *FinalResultsHolder `json:"best-start-results,omitempty"` BestMarketMovement *FinalResultsHolder `json:"best-market-movement,omitempty"` AllStats []currencystatistics.CurrencyStatistic `json:"results"` // as ExchangeAssetPairStatistics cannot be rendered via json.Marshall, we append all result to this slice instead WasAnyDataMissing bool `json:"was-any-data-missing"` }
Statistic holds all statistical information for a backtester run, from drawdowns to ratios. Any currency specific information is handled in currencystatistics
func (*Statistic) AddComplianceSnapshotForTime ¶
AddComplianceSnapshotForTime adds the compliance snapshot to the statistics at the time period
func (*Statistic) AddHoldingsForTime ¶
AddHoldingsForTime adds all holdings to the statistics at the time period
func (*Statistic) CalculateAllResults ¶
CalculateAllResults calculates the statistics of all exchange asset pair holdings, orders, ratios and drawdowns
func (*Statistic) GetBestMarketPerformer ¶
func (s *Statistic) GetBestMarketPerformer(results []FinalResultsHolder) *FinalResultsHolder
GetBestMarketPerformer returns the best final market movement
func (*Statistic) GetBestStrategyPerformer ¶
func (s *Statistic) GetBestStrategyPerformer(results []FinalResultsHolder) *FinalResultsHolder
GetBestStrategyPerformer returns the best performing strategy result
func (*Statistic) GetTheBiggestDrawdownAcrossCurrencies ¶
func (s *Statistic) GetTheBiggestDrawdownAcrossCurrencies(results []FinalResultsHolder) *FinalResultsHolder
GetTheBiggestDrawdownAcrossCurrencies returns the biggest drawdown across all currencies in a backtesting run
func (*Statistic) PrintAllEvents ¶
func (s *Statistic) PrintAllEvents()
PrintAllEvents outputs all event details in the CMD
func (*Statistic) PrintTotalResults ¶
func (s *Statistic) PrintTotalResults()
PrintTotalResults outputs all results to the CMD
func (*Statistic) SetEventForOffset ¶
func (s *Statistic) SetEventForOffset(e common.EventHandler) error
SetEventForOffset sets the event for the time period in the event
func (*Statistic) SetStrategyName ¶
SetStrategyName sets the name for statistical identification
func (*Statistic) SetupEventForTime ¶
func (s *Statistic) SetupEventForTime(e common.DataEventHandler) error
SetupEventForTime sets up the big map for to store important data at each time interval