Interface CassandreStrategyInterface

All Known Implementing Classes:
BasicCassandreStrategy, CassandreStrategy, CassandreStrategyImplementation

public interface CassandreStrategyInterface
CassandreStrategyInterface list the methods a strategy type must implement to be able to interact with the Cassandre framework.

These are the classes used by Cassandre to manage a position. - CassandreStrategyInterface list the methods a strategy type must implement to be able to interact with the Cassandre framework. - CassandreStrategyConfiguration contains the configuration of the strategy. - CassandreStrategyDependencies contains all the dependencies required by a strategy and provided by the Cassandre framework. - CassandreStrategyImplementation is the default implementation of CassandreStrategyInterface, this code manages the interaction between Cassandre framework and a strategy. - CassandreStrategy (class) is the class that every strategy used by user (BasicCassandreStrategy must extend. It contains methods to access data and manage orders, trades, positions. There are the classes used by the developer. - CassandreStrategy (interface) is the annotation allowing you Cassandre to recognize a user strategy. - BasicCassandreStrategy - User inherits this class this one to make a basic strategy.

  • Method Details

    • setConfiguration

      void setConfiguration(CassandreStrategyConfiguration cassandreStrategyConfiguration)
      Set strategy configuration.
      Parameters:
      cassandreStrategyConfiguration - cassandre strategy configuration
    • getConfiguration

      CassandreStrategyConfiguration getConfiguration()
      Get strategy configuration.
      Returns:
      cassandre strategy configuration
    • setDependencies

      void setDependencies(CassandreStrategyDependencies cassandreStrategyDependencies)
      Set strategy dependencies.
      Parameters:
      cassandreStrategyDependencies - cassandre strategy dependencies
    • getRequestedCurrencyPairs

      Set<CurrencyPairDTO> getRequestedCurrencyPairs()
      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
    • getTradeAccount

      Optional<AccountDTO> getTradeAccount(Set<AccountDTO> accounts)
      Implements this method to tell the bot which account from the accounts you own is the one you use for trading.
      Parameters:
      accounts - all your accounts
      Returns:
      your trading account
    • initializeAccounts

      void initializeAccounts(Map<String,AccountDTO> accounts)
      Initialize strategy accounts with exchange accounts data retrieved at Cassandre startup.
      Parameters:
      accounts - accounts
    • initialize

      default void initialize()
      This method is called by Cassandre before flux are started. For example, you can implement this method to integrate your historical data.
    • accountsUpdates

      void accountsUpdates(Set<AccountDTO> accounts)
      Method called by streams on accounts updates.
      Parameters:
      accounts - accounts updates
    • tickersUpdates

      void tickersUpdates(Set<TickerDTO> tickers)
      Method called by streams on tickers updates.
      Parameters:
      tickers - tickers updates
    • ordersUpdates

      void ordersUpdates(Set<OrderDTO> orders)
      Method called by streams on orders updates.
      Parameters:
      orders - orders updates
    • tradesUpdates

      void tradesUpdates(Set<TradeDTO> trades)
      Method called by streams on trades updates.
      Parameters:
      trades - trades updates
    • positionsUpdates

      void positionsUpdates(Set<PositionDTO> positions)
      Method called by streams on positions updates.
      Parameters:
      positions - positions updates
    • onAccountsUpdates

      default void onAccountsUpdates(Map<String,AccountDTO> accounts)
      Method called by Cassandre when there are accounts updates.
      Parameters:
      accounts - accounts updates
    • onTickersUpdates

      default void onTickersUpdates(Map<CurrencyPairDTO,TickerDTO> tickers)
      Method called by Cassandre when there are tickers updates.
      Parameters:
      tickers - tickers updates
    • onOrdersUpdates

      default void onOrdersUpdates(Map<String,OrderDTO> orders)
      Method called by Cassandre when there are orders updates.
      Parameters:
      orders - orders updates
    • onTradesUpdates

      default void onTradesUpdates(Map<String,TradeDTO> trades)
      Method called by Cassandre when there are trades updates.
      Parameters:
      trades - trades updates
    • onPositionsUpdates

      default void onPositionsUpdates(Map<Long,PositionDTO> positions)
      Method called by Cassandre when there are positions updates.
      Parameters:
      positions - positions updates
    • onPositionsStatusUpdates

      default void onPositionsStatusUpdates(Map<Long,PositionDTO> positions)
      Method called by Cassandre when there are positions status updates.
      Parameters:
      positions - positions status updates
    • getLastPriceForCurrencyPair

      BigDecimal getLastPriceForCurrencyPair(CurrencyPairDTO currencyPair)
      Returns the last price received for a currency pair.
      Parameters:
      currencyPair - currency pair
      Returns:
      last price