By creating your project with the Cassandre trading bot archetype, you should have a class named SimpleStrategy in src/main/java/tech/cassandre/trading/strategy.

Creating a time series.

We will first declare a BarSeries in SimpleStrategy :

/** Series. */
private BarSeries series;

In SimpleStrategy constructor, we create the time series :

 * Constructor.
public SimpleStrategy() {
    // Define series (we keep 100 bars).
    series = new BaseBarSeriesBuilder().withNumTypeOf(DoubleNum.class).withName("ETH/BTC").build();

Adding data to the time series.

We will take advantage of the method onTickerUpdate(final TickerDTO ticker) from Cassandre trading bot. This method is called by the bot every time a new ticker is available.

public void onTickerUpdate(final TickerDTO ticker) {
    // Here we will receive a TickerDTO each time a new one is available.
    // TODO there is a bug with Kucoin Xchange lib, open is always null.
    System.out.println("Adding a bar with : " + ticker);
    series.addBar(ticker.getTimestamp(), 0, ticker.getHigh(), ticker.getLow(), ticker.getLast(), ticker.getVolume());