class TradingDataController {

    @GET
    @Path("/chart")
    @Produces(MediaType.APPLICATION_JSON)
    @Operation(tags = {"dex"}, summary = "Get candlesticks, APL/ETH, APL/PAX",
        description = "Retrieve candlesticks using buy orders history and stored candlesticks for specified currency pair. Time bounds are represented by unix seconds. Entirely UDF compatible.",
        responses = @ApiResponse(description = "trading data output with request parameters and candlesticks data",
            content = @Content(schema = @Schema(implementation = TradingDataOutputDTO.class), mediaType = "application/json"))
    )
    public Response getCandlesticks(
        @Parameter(description = "Second currency symbol in the trading pair, for example - ETH, PAX OR entire currency pair, for example APL_ETH or APL/ETH (second symbol will be resolved as paired currency)", required = true) @QueryParam("symbol") DexCurrency symbol,
        @Parameter(description = "Upper timestamp bound for candlesticks", required = true) @QueryParam(TO_PARAM) Integer toTs,
        @Parameter(description = "Lower timestamp bound for candlesticks", required = true) @QueryParam(FROM_PARAM) Integer fromTs,
        @Parameter(description = "Time frame for which trading candlesticks should be returned. Possible values: QUARTER, HOUR, FOUR_HOURS, DAY or tv compatible 15, 60, 240, D ", required = true) @QueryParam("resolution") TimeFrame timeFrame
    ) {

        if (symbol == DexCurrency.APL) {
            return ResponseBuilder.apiError(ApiErrors.INCORRECT_PARAM, "symbol", "Paired currency should not be equal to 'APL'").build();
        }
        if (fromTs >= toTs) {
            return ResponseBuilder.apiError(ApiErrors.PARAM_GREATER_OR_EQUAL_ERROR, FROM_PARAM, TO_PARAM).build();
        }
        TradingDataOutput tradingDataOutput = dataService.getBars(fromTs, toTs, symbol, timeFrame);
        return Response.ok(converter.apply(tradingDataOutput)).build();

    }

    public  TradingDataController();
    @Inject public  TradingDataController(DexTradingDataService dataService, TimeService timeService, DexService dexService);

}