|
|
@ -264,7 +264,12 @@ public class CrossChainResource { |
|
|
|
description = "Maximum number of trades to include in price calculation", |
|
|
|
description = "Maximum number of trades to include in price calculation", |
|
|
|
example = "10", |
|
|
|
example = "10", |
|
|
|
schema = @Schema(type = "integer", defaultValue = "10") |
|
|
|
schema = @Schema(type = "integer", defaultValue = "10") |
|
|
|
) @QueryParam("maxtrades") Integer maxtrades) { |
|
|
|
) @QueryParam("maxtrades") Integer maxtrades, |
|
|
|
|
|
|
|
@Parameter( |
|
|
|
|
|
|
|
description = "Display price in terms of foreign currency per unit QORT", |
|
|
|
|
|
|
|
example = "false", |
|
|
|
|
|
|
|
schema = @Schema(type = "boolean", defaultValue = "false") |
|
|
|
|
|
|
|
) @QueryParam("inverse") Boolean inverse) { |
|
|
|
// foreignBlockchain is required
|
|
|
|
// foreignBlockchain is required
|
|
|
|
if (foreignBlockchain == null) |
|
|
|
if (foreignBlockchain == null) |
|
|
|
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.INVALID_CRITERIA); |
|
|
|
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.INVALID_CRITERIA); |
|
|
@ -295,7 +300,7 @@ public class CrossChainResource { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return Amounts.scaledDivide(totalQort, totalForeign); |
|
|
|
return inverse ? Amounts.scaledDivide(totalForeign, totalQort) : Amounts.scaledDivide(totalQort, totalForeign); |
|
|
|
} catch (DataException e) { |
|
|
|
} catch (DataException e) { |
|
|
|
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.REPOSITORY_ISSUE, e); |
|
|
|
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.REPOSITORY_ISSUE, e); |
|
|
|
} |
|
|
|
} |
|
|
|