CassandraHistoricalDataStore extends AbstractDataStoreProvider { @Override public void onBar(Bar bar) { PreparedStatement statement = session.prepare(BAR_INSERT_STATEMENT); BoundStatement boundStatement = new BoundStatement(statement); session.execute(boundStatement.bind(bar.instId, bar.size, new Date(bar.dateTime), bar.open, bar.high, bar.low, bar.close, bar.volume, bar.openInt)); } @Inject  CassandraHistoricalDataStore(ProviderManager providerManager, CassandraHistoricalDataStoreConfig config, MarketDataEventBus marketDataEventBus); @Override ProviderId providerId(); @Override boolean connected(); @Override void connect(); @Override void disconnect(); @Override void onBar(Bar bar); @Override void onQuote(Quote quote); @Override void onTrade(Trade trade); @Override boolean subscribeHistoricalData(HistoricalSubscriptionKey subscriptionKey); @Override List<MarketDataContainer> loadHistoricalData(HistoricalSubscriptionKey subscriptionKey); static final ProviderId PROVIDER_ID; }
@Test public void testInsertBar(){ Bar bar1 = new Bar(1, 60,Calendar.getInstance().getTime().getTime(), 500, 9999, 100, 600); Bar bar2 = new Bar(1, 60, Calendar.getInstance().getTime().getTime()+1, 600, 20000, 120, 700); cassandraHistoricalDataStore.onBar(bar1); cassandraHistoricalDataStore.onBar(bar2); }