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 between two bars are added.
        Returns:
        temporal amount
      • getStrategy

        public abstract org.ta4j.core.Strategy getStrategy()
        Implements this method to tell the bot which strategy to apply.
        Returns:
        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
      • accountUpdate

        public final void accountUpdate​(AccountDTO account)
        Description copied from interface: CassandreStrategyInterface
        Method called by streams at every account update.
        Parameters:
        account - account
      • tickerUpdate

        public final void tickerUpdate​(TickerDTO ticker)
        Description copied from interface: CassandreStrategyInterface
        Method called by streams at every ticker update.
        Parameters:
        ticker - ticker
      • orderUpdate

        public final void orderUpdate​(OrderDTO order)
        Description copied from interface: CassandreStrategyInterface
        Method called by streams on every order update.
        Parameters:
        order - order
      • tradeUpdate

        public final void tradeUpdate​(TradeDTO trade)
        Description copied from interface: CassandreStrategyInterface
        Method called by streams on every trade update.
        Parameters:
        trade - trade
      • positionUpdate

        public final void positionUpdate​(PositionDTO position)
        Description copied from interface: CassandreStrategyInterface
        Method called by streams on every position update.
        Parameters:
        position - trade
      • canBuy

        public final boolean canBuy​(BigDecimal amount)
        Returns true if we have enough assets to buy.
        Parameters:
        amount - amount
        Returns:
        true if we there is enough money 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 there is enough money 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 there is enough money 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 there is enough money 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 there is enough money to buy
      • canSell

        public final boolean canSell​(BigDecimal amount)
        Returns true if we have enough assets to sell.
        Parameters:
        amount - amount
        Returns:
        true if we there is enough money to buy
      • 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 there is enough money to buy
      • 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 there is enough money to buy
      • shouldEnter

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

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

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

        public void onAccountUpdate​(AccountDTO account)
        Description copied from interface: CassandreStrategyInterface
        Method triggered at every account update.
        Parameters:
        account - account
      • onTickerUpdate

        public void onTickerUpdate​(TickerDTO ticker)
        Description copied from interface: CassandreStrategyInterface
        Method triggered at every ticker update.
        Parameters:
        ticker - ticker
      • onOrderUpdate

        public void onOrderUpdate​(OrderDTO order)
        Description copied from interface: CassandreStrategyInterface
        Method triggered on every order update.
        Parameters:
        order - order
      • onTradeUpdate

        public void onTradeUpdate​(TradeDTO trade)
        Description copied from interface: CassandreStrategyInterface
        Method triggered on every trade update.
        Parameters:
        trade - trade
      • onPositionUpdate

        public void onPositionUpdate​(PositionDTO position)
        Description copied from interface: CassandreStrategyInterface
        Method triggered on every position update.
        Parameters:
        position - position
      • onPositionStatusUpdate

        public void onPositionStatusUpdate​(PositionDTO position)
        Description copied from interface: CassandreStrategyInterface
        Method triggered on every position status update.
        Parameters:
        position - position