Documentation ¶
Index ¶
- type Event
- type Signal
- func (s *Signal) GetAmount() decimal.Decimal
- func (s *Signal) GetBuyLimit() decimal.Decimal
- func (s *Signal) GetClosePrice() decimal.Decimal
- func (s *Signal) GetCollateralCurrency() currency.Code
- func (s *Signal) GetDirection() order.Side
- func (s *Signal) GetFillDependentEvent() Event
- func (s *Signal) GetHighPrice() decimal.Decimal
- func (s *Signal) GetLowPrice() decimal.Decimal
- func (s *Signal) GetOpenPrice() decimal.Decimal
- func (s *Signal) GetSellLimit() decimal.Decimal
- func (s *Signal) GetUnderlyingPair() currency.Pair
- func (s *Signal) GetVolume() decimal.Decimal
- func (s *Signal) IsNil() bool
- func (s *Signal) IsSignal() bool
- func (s *Signal) MatchOrderAmount() bool
- func (s *Signal) Pair() currency.Pair
- func (s *Signal) SetAmount(d decimal.Decimal)
- func (s *Signal) SetBuyLimit(f decimal.Decimal)
- func (s *Signal) SetDirection(st order.Side)
- func (s *Signal) SetPrice(f decimal.Decimal)
- func (s *Signal) SetSellLimit(f decimal.Decimal)
- func (s *Signal) ToKline() kline.Event
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event interface { common.Event common.Directioner ToKline() kline.Event GetClosePrice() decimal.Decimal GetHighPrice() decimal.Decimal GetOpenPrice() decimal.Decimal GetLowPrice() decimal.Decimal GetVolume() decimal.Decimal IsSignal() bool GetSellLimit() decimal.Decimal GetBuyLimit() decimal.Decimal GetAmount() decimal.Decimal GetFillDependentEvent() Event GetCollateralCurrency() currency.Code SetAmount(decimal.Decimal) MatchOrderAmount() bool IsNil() bool }
Event handler is used for getting trade signal details Example Amount and Price of current candle tick
type Signal ¶
type Signal struct { *event.Base OpenPrice decimal.Decimal HighPrice decimal.Decimal LowPrice decimal.Decimal ClosePrice decimal.Decimal Volume decimal.Decimal // BuyLimit sets a maximum buy from the strategy // it differs from amount as it is more a suggestion // use Amount if you wish to have a fillOrKill style amount BuyLimit decimal.Decimal // SellLimit sets a maximum sell from the strategy // it differs from amount as it is more a suggestion // use Amount if you wish to have a fillOrKill style amount SellLimit decimal.Decimal // Amount set the amount when you wish to allow // a strategy to dictate order quantities // if the amount is not allowed by the portfolio manager // the order will not be placed Amount decimal.Decimal Direction order.Side // FillDependentEvent ensures that an order can only be placed // if there is corresponding collateral in the selected currency // this enabled cash and carry strategies for example FillDependentEvent Event // CollateralCurrency is an optional parameter // when using futures to limit the collateral available // to a singular currency // eg with $5000 usd and 1 BTC, specifying BTC ensures // the USD value won't be utilised when sizing an order CollateralCurrency currency.Code // MatchOrderAmount flags to other event handlers // that the order amount must match the set Amount property MatchesOrderAmount bool }
Signal contains everything needed for a strategy to raise a signal event
func (*Signal) GetBuyLimit ¶
GetBuyLimit returns the buy limit
func (*Signal) GetClosePrice ¶
GetClosePrice returns the price
func (*Signal) GetCollateralCurrency ¶
GetCollateralCurrency returns the collateral currency
func (*Signal) GetDirection ¶
GetDirection returns the direction
func (*Signal) GetFillDependentEvent ¶
GetFillDependentEvent returns the fill dependent event so it can be added to the event queue
func (*Signal) GetHighPrice ¶
GetHighPrice returns the high price of a signal
func (*Signal) GetLowPrice ¶
GetLowPrice returns the low price of a signal
func (*Signal) GetOpenPrice ¶
GetOpenPrice returns the open price of a signal
func (*Signal) GetSellLimit ¶
GetSellLimit returns the sell limit
func (*Signal) GetUnderlyingPair ¶
GetUnderlyingPair returns the underlying currency pair
func (*Signal) MatchOrderAmount ¶
MatchOrderAmount ensures an order must match its set amount or fail
func (*Signal) SetBuyLimit ¶
SetBuyLimit sets the buy limit
func (*Signal) SetDirection ¶
SetDirection sets the direction
func (*Signal) SetSellLimit ¶
SetSellLimit sets the sell limit