| | |
| | | private ItemService itemService; |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | XinLangDataServiceImpl service = new XinLangDataServiceImpl(); |
| | | List<Realtime> usdsgd = service.realtimeSingle("USDSGD"); |
| | | for (Realtime re : usdsgd) { |
| | | System.out.println(JSONObject.toJSONString(re)); |
| | | } |
| | | // List<Kline> sz300750 = service.buildOneYearPeriod("AAPL"); |
| | | // System.out.println(sz300750.size()); |
| | | // List<Kline> eurusd = service.getTimeseriesByPeriodOneDay("EURUSD"); |
| | | // System.out.println(JSONObject.toJSONString(eurusd)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | return list; |
| | | } |
| | | |
| | | public List<Realtime> realtime(String symbols) { |
| | | List<Realtime> realtimeList = realtimeSingle(symbols); |
| | | return realtimeList; |
| | | } |
| | | // public List<Realtime> realtime(String symbols) { |
| | | // List<Realtime> realtimeList = realtimeSingle(symbols); |
| | | // return realtimeList; |
| | | // } |
| | | |
| | | /** |
| | | * 1day 历史数据 : 周期 1年 |
| | |
| | | |
| | | public List<Kline> getTimeseriesByPeriodMinute(String currency, int scale, String period) { |
| | | |
| | | // https://vip.stock.finance.sina.com.cn/forex/api/jsonp.php/var%20_fx_seurusd_1_1688818651726=/NewForexService.getMinKline?symbol=fx_seurusd&scale=1&datalen=2000 |
| | | long nowTs = System.currentTimeMillis(); |
| | | String url = klineUrl.replace("{1}", currency.toLowerCase()).replace("{3}", nowTs + "").replace("{2}", scale + ""); |
| | | List<Kline> resList = new ArrayList<>(); |