What is a strategy ?

A strategy is a class you write to describe what your want to do (buy, sell, create position...) depending on the assets you own, the market data (tickers) or any other data you can or want to grab.

To be managed by Cassandre, your strategy must have the @CassandreStrategyopen in new window annotation and inherits from BasicCassandreStrategyopen in new window .

You have to implement :

You will find below the minimal strategy with:

package com.mycompany.app;

import tech.cassandre.trading.bot.dto.user.AccountDTO;
import tech.cassandre.trading.bot.strategy.BasicCassandreStrategy;
import tech.cassandre.trading.bot.strategy.CassandreStrategy;
import tech.cassandre.trading.bot.util.dto.CurrencyDTO;
import tech.cassandre.trading.bot.util.dto.CurrencyPairDTO;

import java.util.Map;
import java.util.Set;

 * Simple strategy.
public final class SimpleStrategy extends BasicCassandreStrategy {

    public Set<CurrencyPairDTO> getRequestedCurrencyPairs() {
        // We only ask for BTC/USDT tickers (Base currency : BTC / Quote currency : USDT).
        return Set.of(new CurrencyPairDTO(BTC, USDT));

    public Optional<AccountDTO> getTradeAccount(Set<AccountDTO> accounts) {
        // From all the accounts we have on the exchange,
        // we must return the one we use for trading.
        return accounts.stream()
                .filter(a -> "trade".equalsIgnoreCase(a.getName()))



You can run several strategies in a single bot, but they will all be connected to a single exchange.