Documentation
¶
Index ¶
- func FloatToStringPrecision(input_num float64, precision int) string
- func PointToPeriod(nbPoints int) string
- func StrToFloat(input string) float64
- type AbstractRule
- type AndRule
- type AskBidTrade
- func (f *AskBidTrade) GetBuyValue() float64
- func (f *AskBidTrade) GetFromSource(source RecordDataSource) float64
- func (f *AskBidTrade) GetSellValue() float64
- func (f *AskBidTrade) HasZero() bool
- func (f *AskBidTrade) PingAsk(askPrice float64, inputDate time.Time)
- func (f *AskBidTrade) PingBid(bidPrice float64, inputDate time.Time)
- func (f *AskBidTrade) PingTrade(transactionPrice float64, volume float64, inputDate time.Time)
- func (f *AskBidTrade) Similar(abd *AskBidTrade, percentage float64) bool
- type BooleanRule
- type CommonRule
- func (cr *CommonRule) And(rule IRule) IRule
- func (cr *CommonRule) Index() int
- func (cr *CommonRule) IsCalculated(date int64) bool
- func (cr *CommonRule) Name() string
- func (cr *CommonRule) Negation() IRule
- func (cr *CommonRule) Or(rule IRule) IRule
- func (cr *CommonRule) SetIndex(index int)
- func (cr *CommonRule) TriggerId() int
- func (cr *CommonRule) Xor(rule IRule) IRule
- type ConstantIndicator
- type CrossDownIndicatorRule
- type CrossPosition
- type CrossUpIndicatorRule
- type Crosser
- type DiffData
- type IIndicator
- func NewIndicatorAbstractEma(indicatorType IndicatorType, source IIndicator, barCount float64, ...) IIndicator
- func NewIndicatorConstant(constant float64, cache *IndicatorCache) IIndicator
- func NewIndicatorEMA(nbPoints float64, source IIndicator, cache *IndicatorCache) IIndicator
- func NewIndicatorLive(source RecordDataSource, cache *IndicatorCache, ...) IIndicator
- func NewIndicatorMMA(source IIndicator, barCount float64, cache *IndicatorCache) IIndicator
- func NewIndicatorSMA(nbPoints float64, source IIndicator, cache *IndicatorCache) IIndicator
- type IRule
- func NewAndRule(rule1, rule2 IRule, cache *RuleCache) IRule
- func NewBooleanRule(val bool, cache *RuleCache) IRule
- func NewCrossDownIndicatorRule(indicator1, indicator2 IIndicator, threshold float64, cache *RuleCache) IRule
- func NewCrossUpIndicatorRule(indicator1, indicator2 IIndicator, threshold float64, cache *RuleCache) IRule
- func NewNotRule(rule IRule, cache *RuleCache) IRule
- func NewOrRule(rule1, rule2 IRule, cache *RuleCache) IRule
- func NewOverIndicatorRule(indicator1, indicator2 IIndicator, thresholdInPercent float64, ...) IRule
- func NewXorRule(rule1, rule2 IRule, cache *RuleCache) IRule
- type IndicatorAbstractEma
- type IndicatorCache
- func (ic *IndicatorCache) Calculate(record *AskBidTrade, add bool) error
- func (ic *IndicatorCache) Get(name string) IIndicator
- func (ic *IndicatorCache) GetFirstLive() IIndicator
- func (ic *IndicatorCache) Has(name string) bool
- func (ic *IndicatorCache) History() *PerformanceAskBidTradeHistory
- func (ic *IndicatorCache) List() []string
- func (ic *IndicatorCache) Set(indicator IIndicator)
- type IndicatorCommon
- func (ic *IndicatorCommon) GetLastValues(nb int) []float64
- func (ic *IndicatorCommon) GetValue(index int) float64
- func (ic *IndicatorCommon) GetValues(fromIndex, toIndex int) []float64
- func (ic *IndicatorCommon) IsCalculated(date int64) bool
- func (ic *IndicatorCommon) Len() int
- func (ic *IndicatorCommon) Length() int
- func (ic *IndicatorCommon) Name() string
- func (ic *IndicatorCommon) SetCache(cache *IndicatorCache)
- func (ic *IndicatorCommon) SetHistory(history *PerformanceAskBidTradeHistory)
- func (ic *IndicatorCommon) Type() IndicatorType
- func (ic *IndicatorCommon) Val() float64
- func (ic *IndicatorCommon) Values() []float64
- type IndicatorLive
- type IndicatorSMA
- type IndicatorType
- type NotRule
- type OrRule
- type OverIndicatorRule
- type PerformanceAskBidTradeHistory
- func (p *PerformanceAskBidTradeHistory) Append(record *AskBidTrade)
- func (p *PerformanceAskBidTradeHistory) Current() *AskBidTrade
- func (p *PerformanceAskBidTradeHistory) GetPoint(index int) (*AskBidTrade, error)
- func (p *PerformanceAskBidTradeHistory) IncludeCurrent(record *AskBidTrade) *PerformanceAskBidTradeHistory
- func (p *PerformanceAskBidTradeHistory) Len() int
- func (p *PerformanceAskBidTradeHistory) SetCurrent(record *AskBidTrade)
- type Record
- type RecordDataSource
- type RecordSource
- type RuleCache
- func (rc *RuleCache) AddBuyProcessor(ruleIndex int, processorIndex int)
- func (rc *RuleCache) AddSellProcessor(ruleIndex int, processorIndex int)
- func (rc *RuleCache) Calculate(date time.Time) error
- func (rc *RuleCache) GetById(index int) IRule
- func (rc *RuleCache) GetByName(name string) IRule
- func (rc *RuleCache) GetSatisfiedProcessors() ([]int, []int)
- func (rc *RuleCache) GetSatisfiedRules() []string
- func (rc *RuleCache) IsSatisfied(date int64, index int) (bool, error)
- func (rc *RuleCache) Len() int
- func (rc *RuleCache) Set(rule IRule) IRule
- type SatisfactionStatus
- type XorRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FloatToStringPrecision ¶
func PointToPeriod ¶
func StrToFloat ¶
Types ¶
type AbstractRule ¶
type AbstractRule struct{}
type AndRule ¶
type AndRule struct {
*CommonRule
// contains filtered or unexported fields
}
type AskBidTrade ¶
func NewAskBidTradeFromAskBid ¶
func NewAskBidTradeFromAskBid(askPrice float64, bidPrice float64, inputDate time.Time) *AskBidTrade
func NewAskBidTradeFromTrade ¶
func NewAskBidTradeFromTrade(transactionsPrice float64, volume float64, inputDate time.Time) *AskBidTrade
func (*AskBidTrade) GetBuyValue ¶
func (f *AskBidTrade) GetBuyValue() float64
func (*AskBidTrade) GetFromSource ¶
func (f *AskBidTrade) GetFromSource(source RecordDataSource) float64
func (*AskBidTrade) GetSellValue ¶
func (f *AskBidTrade) GetSellValue() float64
func (*AskBidTrade) HasZero ¶
func (f *AskBidTrade) HasZero() bool
func (*AskBidTrade) PingTrade ¶
func (f *AskBidTrade) PingTrade(transactionPrice float64, volume float64, inputDate time.Time)
func (*AskBidTrade) Similar ¶
func (f *AskBidTrade) Similar(abd *AskBidTrade, percentage float64) bool
type BooleanRule ¶
type BooleanRule struct {
*CommonRule
// contains filtered or unexported fields
}
func (*BooleanRule) IsSatisfied ¶
func (r *BooleanRule) IsSatisfied(date int64) (bool, error)
type CommonRule ¶
type CommonRule struct {
// contains filtered or unexported fields
}
func (*CommonRule) And ¶
func (cr *CommonRule) And(rule IRule) IRule
func (*CommonRule) Index ¶
func (cr *CommonRule) Index() int
func (*CommonRule) IsCalculated ¶
func (cr *CommonRule) IsCalculated(date int64) bool
func (*CommonRule) Name ¶
func (cr *CommonRule) Name() string
func (*CommonRule) Negation ¶
func (cr *CommonRule) Negation() IRule
func (*CommonRule) Or ¶
func (cr *CommonRule) Or(rule IRule) IRule
func (*CommonRule) SetIndex ¶
func (cr *CommonRule) SetIndex(index int)
func (*CommonRule) TriggerId ¶
func (cr *CommonRule) TriggerId() int
func (*CommonRule) Xor ¶
func (cr *CommonRule) Xor(rule IRule) IRule
type ConstantIndicator ¶
type ConstantIndicator struct {
*IndicatorCommon
// contains filtered or unexported fields
}
type CrossDownIndicatorRule ¶
type CrossDownIndicatorRule struct {
*CommonRule
// contains filtered or unexported fields
}
func (*CrossDownIndicatorRule) IsSatisfied ¶
func (r *CrossDownIndicatorRule) IsSatisfied(date int64) (bool, error)
type CrossPosition ¶
type CrossPosition string
const ( CrossPositionOver CrossPosition = "Over" CrossPositionUnder CrossPosition = "Under" CrossPositionZero CrossPosition = "Zero" )
type CrossUpIndicatorRule ¶
type CrossUpIndicatorRule struct {
*CommonRule
// contains filtered or unexported fields
}
func (*CrossUpIndicatorRule) IsSatisfied ¶
func (r *CrossUpIndicatorRule) IsSatisfied(date int64) (bool, error)
type Crosser ¶
type Crosser struct {
// contains filtered or unexported fields
}
func NewCrosser ¶
func NewCrosser(threshold float64, position CrossPosition) *Crosser
type DiffData ¶
type DiffData struct {
Ratio float64
}
func NewDiffData ¶
func (*DiffData) Sign ¶
func (d *DiffData) Sign(zeroThreshold float64) CrossPosition
type IIndicator ¶
type IIndicator interface {
Calculate(date int64, add bool) error
GetLastValues(nb int) []float64
GetValue(index int) float64
GetValues(fromIndex, toIndex int) []float64
IsCalculated(date int64) bool
Len() int
Name() string
SetCache(cache *IndicatorCache)
SetHistory(history *PerformanceAskBidTradeHistory)
Type() IndicatorType
Values() []float64
Val() float64
}
func NewIndicatorAbstractEma ¶
func NewIndicatorAbstractEma(indicatorType IndicatorType, source IIndicator, barCount float64, multiplier float64, cache *IndicatorCache) IIndicator
func NewIndicatorConstant ¶
func NewIndicatorConstant(constant float64, cache *IndicatorCache) IIndicator
func NewIndicatorEMA ¶
func NewIndicatorEMA(nbPoints float64, source IIndicator, cache *IndicatorCache) IIndicator
func NewIndicatorLive ¶
func NewIndicatorLive(source RecordDataSource, cache *IndicatorCache, history *PerformanceAskBidTradeHistory) IIndicator
func NewIndicatorMMA ¶
func NewIndicatorMMA(source IIndicator, barCount float64, cache *IndicatorCache) IIndicator
func NewIndicatorSMA ¶
func NewIndicatorSMA(nbPoints float64, source IIndicator, cache *IndicatorCache) IIndicator
type IRule ¶
type IRule interface {
IsCalculated(date int64) bool
IsSatisfied(date int64) (bool, error)
And(rule IRule) IRule
Or(rule IRule) IRule
Xor(rule IRule) IRule
Negation() IRule
Index() int
SetIndex(index int)
Name() string
}
func NewAndRule ¶
func NewBooleanRule ¶
func NewCrossDownIndicatorRule ¶
func NewCrossDownIndicatorRule(indicator1, indicator2 IIndicator, threshold float64, cache *RuleCache) IRule
func NewCrossUpIndicatorRule ¶
func NewCrossUpIndicatorRule(indicator1, indicator2 IIndicator, threshold float64, cache *RuleCache) IRule
func NewNotRule ¶
func NewOverIndicatorRule ¶
func NewOverIndicatorRule(indicator1, indicator2 IIndicator, thresholdInPercent float64, cache *RuleCache) IRule
* threshold is a percentage, for example threshold = 0.1, means 0.10%
if zero, it takes strict value ind1>ind2 otherwise - it takes percentage of ind1 > (1 + thresholdInPercent/100) * ind2
ind1 - ind2 -
func NewXorRule ¶
type IndicatorAbstractEma ¶
type IndicatorAbstractEma struct {
*IndicatorCommon
// contains filtered or unexported fields
}
type IndicatorCache ¶
type IndicatorCache struct {
// contains filtered or unexported fields
}
func NewIndicatorCache ¶
func NewIndicatorCache(history *PerformanceAskBidTradeHistory) *IndicatorCache
func (*IndicatorCache) Calculate ¶
func (ic *IndicatorCache) Calculate(record *AskBidTrade, add bool) error
func (*IndicatorCache) Get ¶
func (ic *IndicatorCache) Get(name string) IIndicator
func (*IndicatorCache) GetFirstLive ¶
func (ic *IndicatorCache) GetFirstLive() IIndicator
func (*IndicatorCache) Has ¶
func (ic *IndicatorCache) Has(name string) bool
func (*IndicatorCache) History ¶
func (ic *IndicatorCache) History() *PerformanceAskBidTradeHistory
func (*IndicatorCache) List ¶
func (ic *IndicatorCache) List() []string
func (*IndicatorCache) Set ¶
func (ic *IndicatorCache) Set(indicator IIndicator)
type IndicatorCommon ¶
type IndicatorCommon struct {
// contains filtered or unexported fields
}
func NewIndicatorCommon ¶
func NewIndicatorCommon(indicatorType IndicatorType, name string, sourceName string) *IndicatorCommon
func (*IndicatorCommon) GetLastValues ¶
func (ic *IndicatorCommon) GetLastValues(nb int) []float64
func (*IndicatorCommon) GetValue ¶
func (ic *IndicatorCommon) GetValue(index int) float64
func (*IndicatorCommon) GetValues ¶
func (ic *IndicatorCommon) GetValues(fromIndex, toIndex int) []float64
func (*IndicatorCommon) IsCalculated ¶
func (ic *IndicatorCommon) IsCalculated(date int64) bool
func (*IndicatorCommon) Len ¶
func (ic *IndicatorCommon) Len() int
func (*IndicatorCommon) Length ¶
func (ic *IndicatorCommon) Length() int
func (*IndicatorCommon) Name ¶
func (ic *IndicatorCommon) Name() string
func (*IndicatorCommon) SetCache ¶
func (ic *IndicatorCommon) SetCache(cache *IndicatorCache)
func (*IndicatorCommon) SetHistory ¶
func (ic *IndicatorCommon) SetHistory(history *PerformanceAskBidTradeHistory)
func (*IndicatorCommon) Type ¶
func (ic *IndicatorCommon) Type() IndicatorType
func (*IndicatorCommon) Val ¶
func (ic *IndicatorCommon) Val() float64
func (*IndicatorCommon) Values ¶
func (ic *IndicatorCommon) Values() []float64
type IndicatorLive ¶
type IndicatorLive struct {
*IndicatorCommon
// contains filtered or unexported fields
}
func (*IndicatorLive) GetRecordSource ¶
func (sma *IndicatorLive) GetRecordSource() RecordSource
type IndicatorSMA ¶
type IndicatorSMA struct {
*IndicatorCommon
// contains filtered or unexported fields
}
type IndicatorType ¶
type IndicatorType string
const ( CONSTANT IndicatorType = "CONSTANT" BOOL IndicatorType = "BOOL" SMA IndicatorType = "SMA" EMA IndicatorType = "EMA" ROC IndicatorType = "ROC" LOSS IndicatorType = "LOSS Average" OBV IndicatorType = "OBV" RSI IndicatorType = "RSI" LIVE IndicatorType = "LIVE" EMPTY IndicatorType = "" ADX IndicatorType = "ADX" MMA IndicatorType = "MMA" )
type NotRule ¶
type NotRule struct {
*CommonRule
}
type OrRule ¶
type OrRule struct {
*CommonRule
// contains filtered or unexported fields
}
type OverIndicatorRule ¶
type OverIndicatorRule struct {
*CommonRule
// contains filtered or unexported fields
}
func (*OverIndicatorRule) IsSatisfied ¶
func (r *OverIndicatorRule) IsSatisfied(date int64) (bool, error)
type PerformanceAskBidTradeHistory ¶
type PerformanceAskBidTradeHistory struct {
Volumes []float64 // 0
TradeLow []float64 // 1
TradeHigh []float64 // 2
TradeOpen []float64 // 3
TradeClose []float64 // 4
AskLow []float64 // 5
AskHigh []float64 // 6
AskOpen []float64 // 7
AskClose []float64 // 8
BidLow []float64 // 9
BidHigh []float64 // 10
BidOpen []float64 // 11
BidClose []float64 // 12
InputDate []time.Time
InputDateStr []string
// contains filtered or unexported fields
}
func NewPerformanceAskBidTradeHistory ¶
func NewPerformanceAskBidTradeHistory() *PerformanceAskBidTradeHistory
func (*PerformanceAskBidTradeHistory) Append ¶
func (p *PerformanceAskBidTradeHistory) Append(record *AskBidTrade)
func (*PerformanceAskBidTradeHistory) Current ¶
func (p *PerformanceAskBidTradeHistory) Current() *AskBidTrade
func (*PerformanceAskBidTradeHistory) GetPoint ¶
func (p *PerformanceAskBidTradeHistory) GetPoint(index int) (*AskBidTrade, error)
func (*PerformanceAskBidTradeHistory) IncludeCurrent ¶
func (p *PerformanceAskBidTradeHistory) IncludeCurrent(record *AskBidTrade) *PerformanceAskBidTradeHistory
func (*PerformanceAskBidTradeHistory) Len ¶
func (p *PerformanceAskBidTradeHistory) Len() int
func (*PerformanceAskBidTradeHistory) SetCurrent ¶
func (p *PerformanceAskBidTradeHistory) SetCurrent(record *AskBidTrade)
type Record ¶
func NewEmptyRecord ¶
func NewEmptyRecord() Record
type RecordDataSource ¶
type RecordDataSource int
const ( AskLow RecordDataSource = 1 AskHigh RecordDataSource = 2 AskClose RecordDataSource = 3 BidLow RecordDataSource = 4 BidHigh RecordDataSource = 5 BidClose RecordDataSource = 6 Volume RecordDataSource = 7 Invalid RecordDataSource = 8 )
func (RecordDataSource) RecordSource ¶
func (r RecordDataSource) RecordSource() RecordSource
func (RecordDataSource) String ¶
func (r RecordDataSource) String() string
type RecordSource ¶
type RecordSource int
const ( Ask RecordSource = 1 Bid RecordSource = 2 )
func (RecordSource) String ¶
func (r RecordSource) String() string
type RuleCache ¶
type RuleCache struct {
// contains filtered or unexported fields
}
Satisfaction cache
func NewRuleCache ¶
func NewRuleCache(history *PerformanceAskBidTradeHistory) *RuleCache
func (*RuleCache) AddBuyProcessor ¶
func (*RuleCache) AddSellProcessor ¶
func (*RuleCache) GetSatisfiedProcessors ¶
func (*RuleCache) GetSatisfiedRules ¶
func (*RuleCache) IsSatisfied ¶
type SatisfactionStatus ¶
type SatisfactionStatus int
type XorRule ¶
type XorRule struct {
*CommonRule
// contains filtered or unexported fields
}
Source Files
¶
- ask_bid_trade.go
- constants.go
- crosser.go
- dummy.go
- indicator_abstract_ema.go
- indicator_cache.go
- indicator_common.go
- indicator_constant.go
- indicator_ema.go
- indicator_live.go
- indicator_modified_ma.go
- indicator_sma.go
- interfaces.go
- performance_history.go
- rule_and.go
- rule_boolean.go
- rule_cache.go
- rule_common.go
- rule_crossdown.go
- rule_crossup.go
- rule_not.go
- rule_or.go
- rule_over_indicator.go
- rule_xor.go
Click to show internal directories.
Click to hide internal directories.