Documentation
¶
Index ¶
- Variables
- type Backtest
- func (bt *Backtest) AddOrder(ord order.Order, cs candlestick.Candlestick) error
- func (bt *Backtest) Advance() (done bool, err error)
- func (bt *Backtest) CreateTickSubscription(exchange string, pair string) (tick.Subscription, error)
- func (bt Backtest) CurrentTime() string
- func (bt Backtest) Done() bool
- func (bt Backtest) MarshalBinary() ([]byte, error)
- func (bt *Backtest) SetCurrentTime(ts time.Time)
- func (bt *Backtest) UnmarshalBinary(data []byte) error
- type CurrentCandlestick
- type Mode
- type Parameters
- type Settings
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrTickSubscriptionAlreadyExists is the error for a tick subscription already existing. ErrTickSubscriptionAlreadyExists = errors.New("tick subscription already exists") // ErrInvalidExchange is the error for an invalid exchange. ErrInvalidExchange = errors.New("invalid exchange") // ErrNoDataForOrderValidation is the error for no data for order validation. ErrNoDataForOrderValidation = errors.New("no data for order validation") // ErrStartAfterEnd is the error for starting after ending. ErrStartAfterEnd = errors.New("start after end") // ErrInvalidPricePeriod is the error for an invalid price period. ErrInvalidPricePeriod = errors.New("invalid price period") )
View Source
var ( // ErrInvalidMode is returned when the mode is invalid. ErrInvalidMode = errors.New("invalid mode") )
Functions ¶
This section is empty.
Types ¶
type Backtest ¶
type Backtest struct {
ID uuid.UUID `json:"id"`
Parameters Settings `json:"settings"`
CurrentCandlestick CurrentCandlestick `json:"current_candlestick"`
Accounts map[string]account.Account `json:"accounts"`
PricesSubscriptions []tick.Subscription `json:"tick_subscriptions"`
Orders []order.Order `json:"orders"`
}
Backtest is the struct for a backtest.
func (*Backtest) AddOrder ¶
func (bt *Backtest) AddOrder(ord order.Order, cs candlestick.Candlestick) error
AddOrder adds an order to the backtest.
func (*Backtest) CreateTickSubscription ¶
CreateTickSubscription creates a new tick subscription for the backtest.
func (Backtest) CurrentTime ¶
CurrentTime returns the current time of the backtest.
func (Backtest) MarshalBinary ¶
MarshalBinary marshals a backtest to binary data.
func (*Backtest) SetCurrentTime ¶
SetCurrentTime sets the current time of the backtest.
func (*Backtest) UnmarshalBinary ¶
UnmarshalBinary unmarshals a backtest from binary data.
type CurrentCandlestick ¶
type CurrentCandlestick struct {
Time time.Time
Price candlestick.PriceType
}
CurrentCandlestick represent the current price based on candlestick step.
type Mode ¶
type Mode string
Mode is the mode of the backtest.
type Parameters ¶
type Parameters struct {
Accounts map[string]account.Account
StartTime time.Time
EndTime *time.Time
Mode *Mode
PricePeriod *period.Symbol
}
Parameters is the struct for the backtest parameters.
func (*Parameters) EmptyFieldsToDefault ¶
func (params *Parameters) EmptyFieldsToDefault() *Parameters
EmptyFieldsToDefault sets empty fields to default values.
func (Parameters) Validate ¶
func (params Parameters) Validate() error
Validate validates the backtest parameters.
Click to show internal directories.
Click to hide internal directories.