feat(newPrice): 添加K线时间粒度参数支持
- 在KlineVo中新增bar字段用于指定时间粒度
- 修改OKX常量配置,启用历史K线接口
- 更新符号服务实现,传递bar参数并设置默认limit为300
| | |
| | | private String instId; |
| | | |
| | | @NotNull |
| | | @ApiModelProperty(value = "时间粒度,默认值1m", example = "时间粒度,默认值1m,如 [1s/1m/3m/5m/15m/30m/1H/2H/4H]") |
| | | private String bar; |
| | | |
| | | @NotNull |
| | | @ApiModelProperty(value = "类型 1-币币2-合约", example = "1") |
| | | private Integer type; |
| | | |
| | |
| | | * https://www.okx.com/docs-v5/zh/#rest-api-public-data-get-instruments</a> |
| | | */ |
| | | public static final String INSTRUMENTS = "/api/v5/public/instruments"; |
| | | // public static final String K_LINE_HISTORY = "/api/v5/market/history-candles"; |
| | | public static final String K_LINE_HISTORY = "/api/v5/market/history-mark-price-candles"; |
| | | public static final String K_LINE_HISTORY = "/api/v5/market/history-candles"; |
| | | // public static final String K_LINE_HISTORY = "/api/v5/market/history-mark-price-candles"; |
| | | /** |
| | | * 查看账户余额 |
| | | * 获取交易账户中资金余额信息。 |
| | |
| | | }else{ |
| | | return Result.fail("参数错误"); |
| | | } |
| | | String bar = klineDetailDto.getBar(); |
| | | LinkedHashMap<String, Object> requestParam = new LinkedHashMap<>(); |
| | | requestParam.put("instId",instId); |
| | | requestParam.put("bar",bar); |
| | | requestParam.put("limit","300"); |
| | | String result = ExchangeLoginService.getInstance(ExchangeInfoEnum.OKX_UAT.name()).lineHistory(requestParam); |
| | | log.info("加载OKX-KLINE,{}", result); |
| | | JSONObject json = JSON.parseObject(result); |