use of com.axibase.tsd.api.model.financial.InstrumentStatistics in project atsd-api-test by axibase.
the class TestJoinWithTradesWhereClauseCondition method prepareData.
@BeforeClass
public void prepareData() throws Exception {
List<Trade> trades = new ArrayList<>();
trades.add(fromISOString("2020-06-15T20:21:49.123457Z").setNumber(1).setExchange(MOEX).setPrice(new BigDecimal("3.5")).setQuantity(4).setSession(Trade.Session.N).setSide(Trade.Side.BUY));
trades.add(fromISOString("2020-06-15T20:22:01.567899Z").setNumber(2).setExchange(MOEX).setPrice(new BigDecimal("5")).setQuantity(10).setSession(Trade.Session.S).setSide(Trade.Side.SELL));
insert(trades);
InstrumentStatistics one = new InstrumentStatistics().setClazz(clazz()).setSymbol(symbol()).setTimestamp(ZonedDateTime.parse("2020-06-15T20:21:49.123456Z")).addValue(2, // numoffers
"1234").addValue(5, // numbids
"5060").addValue(10, // bid
"196.04");
InstrumentStatistics two = new InstrumentStatistics().setClazz(clazz()).setSymbol(symbol()).setTimestamp(ZonedDateTime.parse("2020-06-15T20:22:00.567899Z")).addValue(2, // numoffers
"1235").addValue(5, // numbids
"5060").addValue(10, // bid
"196.04");
InstrumentStatisticsSender.send(one, two).waitUntilStatisticsHistoryInsertedAtMost(1, TimeUnit.MINUTES);
}
use of com.axibase.tsd.api.model.financial.InstrumentStatistics in project atsd-api-test by axibase.
the class StatisticsDailyTimeRangeTest method prepareData.
@BeforeClass
public void prepareData() throws Exception {
List<Trade> trades = new ArrayList<>();
long quantity = 1;
for (String[] row : ROWS_STAT_AND_TRADES) {
trades.add(fromISOString(row[0]).setExchange(MOEX).setQuantity(quantity++));
}
insert(trades);
List<InstrumentStatistics> stats = new ArrayList<>();
for (String[] row : ROWS_STAT) {
ZonedDateTime zonedDateTime = ZonedDateTime.parse(row[0]);
stats.add(new InstrumentStatistics().setClazz(clazz()).setSymbol(symbol()).setTimestamp(zonedDateTime).addValue(0, // rptseq
row[1]));
}
InstrumentStatisticsSender.send(stats).waitUntilStatisticsHistoryInsertedAtMost(1, TimeUnit.MINUTES);
}
Aggregations