Class BasicTa4jCassandreStrategy

    • Constructor Detail

      • BasicTa4jCassandreStrategy

        public BasicTa4jCassandreStrategy()
        Constructor.
    • Method Detail

      • getRequestedCurrencyPair

        public abstract CurrencyPairDTO getRequestedCurrencyPair()
        Implements this method to tell the bot which currency pair your strategy will receive.
        Returns:
        the list of currency pairs tickers your want to receive
      • getMaximumBarCount

        public abstract int getMaximumBarCount()
        Implements this method to tell the bot how many bars you want to keep in your bar series.
        Returns:
        maximum bar count.
      • getDelayBetweenTwoBars

        public abstract Duration getDelayBetweenTwoBars()
        Implements this method to set the time that should separate two bars.
        Returns:
        temporal amount
      • getStrategy

        public abstract org.ta4j.core.Strategy getStrategy()
        Implements this method to tell the bot which strategy to apply.
        Returns:
        strategy
      • getExecutedStrategy

        public final org.ta4j.core.Strategy getExecutedStrategy()
        Returns the executed strategy.
        Returns:
        strategy
      • updateStrategy

        public void updateStrategy​(org.ta4j.core.Strategy newStrategy)
        Update the Ta4j strategy used by Cassandre strategy.
        Parameters:
        newStrategy - strategy
      • getRequestedCurrencyPairs

        public final Set<CurrencyPairDTO> getRequestedCurrencyPairs()
        Description copied from interface: CassandreStrategyInterface
        Implements this method to tell the bot which currency pairs your strategy will receive.
        Returns:
        the list of currency pairs tickers your want to receive in this strategy
      • canBuy

        public final boolean canBuy​(BigDecimal amount)
        Returns true if we have enough assets to buy.
        Parameters:
        amount - amount
        Returns:
        true if we have enough assets to buy
      • canBuy

        public final boolean canBuy​(BigDecimal amount,
                                    BigDecimal minimumBalanceAfter)
        Returns true if we have enough assets to buy.
        Parameters:
        amount - amount
        minimumBalanceAfter - minimum balance that should be left after buying
        Returns:
        true if we have enough assets to buy
      • canBuy

        public final boolean canBuy​(AccountDTO account,
                                    BigDecimal amount)
        Returns true if we have enough assets to buy.
        Parameters:
        account - account
        amount - amount
        Returns:
        true if we have enough assets to buy
      • canBuy

        public final boolean canBuy​(AccountDTO account,
                                    BigDecimal amount,
                                    BigDecimal minimumBalanceAfter)
        Returns true if we have enough assets to buy and if minimumBalanceAfter is left on the account after.
        Parameters:
        account - account
        amount - amount
        minimumBalanceAfter - minimum balance that should be left after buying
        Returns:
        true if we have enough assets to buy
      • canSell

        public final boolean canSell​(BigDecimal amount,
                                     BigDecimal minimumBalanceAfter)
        Returns true if we have enough assets to sell.
        Parameters:
        amount - amount
        minimumBalanceAfter - minimum balance that should be left after buying
        Returns:
        true if we have enough assets to sell
      • canSell

        public final boolean canSell​(BigDecimal amount)
        Returns true if we have enough assets to sell.
        Parameters:
        amount - amount
        Returns:
        true if we have enough assets to sell
      • canSell

        public final boolean canSell​(AccountDTO account,
                                     BigDecimal amount)
        Returns true if we have enough assets to sell.
        Parameters:
        account - account
        amount - amount
        Returns:
        true if we have enough assets to sell
      • canSell

        public final boolean canSell​(AccountDTO account,
                                     BigDecimal amount,
                                     BigDecimal minimumBalanceAfter)
        Returns true if we have enough assets to sell and if minimumBalanceAfter is left on the account after.
        Parameters:
        account - account
        amount - amount
        minimumBalanceAfter - minimum balance that should be left after selling
        Returns:
        true if we have enough assets to sell
      • shouldEnter

        public abstract void shouldEnter()
        Called when your strategy think you should enter.
      • shouldExit

        public abstract void shouldExit()
        Called when your strategy think you should exit.
      • getSeries

        public final org.ta4j.core.BarSeries getSeries()
        Getter for series.
        Returns:
        series
      • isHistoricalImport

        public boolean isHistoricalImport()
        Getter for historical data import.
        Returns:
        isHistoricalImport
      • setHistoricalImport

        public void setHistoricalImport​(boolean historicalImport)
        Setter for historical data import.
        Parameters:
        historicalImport - historicalImport