BitmexHistoricalDataProvider implements IHistoricalDataProvider { protected List<BarData> convertToBarData(Ticker ticker, int barlength, BarData.LengthUnit lengthUnit, List<BitmexChartData> chartData) { List<BarData> barList = new ArrayList<>(); for (BitmexChartData data : chartData) { barList.add(HistoricalDataUtils.buildBarData(ticker, barlength, lengthUnit, data)); } return barList; }  @Override boolean isConnected(); @Override void connect(); @Override void init(Properties props); @Override List<BarData> requestHistoricalData(Ticker ticker, int duration, BarData.LengthUnit durationLengthUnit, int barSize, BarData.LengthUnit barSizeUnit, ShowProperty whatToShow, boolean useRTH); @Override List<BarData> requestHistoricalData(Ticker ticker, Date endDateTime, int duration, BarData.LengthUnit durationLengthUnit, int barSize, BarData.LengthUnit barSizeUnit, ShowProperty whatToShow, boolean useRTH);  }
@Test public void testConvertToBarData() { int barLength = 1; BarData.LengthUnit lengthUnit = BarData.LengthUnit.MINUTE; Ticker ticker = new GenericTicker("ABC"); BigDecimal open = new BigDecimal(123.23); BigDecimal high = new BigDecimal(234.45); BigDecimal low = new BigDecimal(100.23); BigDecimal close = new BigDecimal(145.54); BigDecimal volume = new BigDecimal(2231); ZonedDateTime timestamp = ZonedDateTime.of(2018, 6, 13, 14, 50, 0, 0, ZoneId.of("UTC")); BitmexChartData chartData = new BitmexChartData(); chartData.setTimestamp(timestamp); chartData.setOpen(open.doubleValue()); chartData.setHigh(high.doubleValue()); chartData.setLow(low.doubleValue()); chartData.setClose(close.doubleValue()); chartData.setVolume(volume.doubleValue()); BarData expectedData = new BarData(ticker, LocalDateTime.of(2018, 6, 13, 7, 50, 0), open, high, low, close, volume, barLength, lengthUnit); List<BitmexChartData> chartDataList = new ArrayList<>(); chartDataList.add(chartData); List<BarData> expectedDataList = new ArrayList<>(); expectedDataList.add(expectedData); List<BarData> actualDataList = testProvider.convertToBarData(ticker, barLength, lengthUnit, chartDataList); assertEquals(1, actualDataList.size() ); assertEquals(expectedData, actualDataList.get(0)); }