private static void getinfo(String code) {
String url = "http://hq.sinajs.cn/list="+code;
RestTemplate restTemplate = new RestTemplate();
String forObject = restTemplate.getForObject(url, String.class);
String s = forObject.split(",")[3];
String s1 = forObject.split(",")[2];
String s2 = forObject.split(",")[1];
String s3 = forObject.split(",")[0];
BigDecimal now = new BigDecimal(s);
BigDecimal old = new BigDecimal(s1);
BigDecimal base = new BigDecimal(s2);
System.out.println(code+":::"+s3.split("=")[1]);
System.out.println(now);
System.out.println(now.subtract(old).divide(base, 4).multiply(new BigDecimal(100)));
System.out.println("--------------------");
}
06-24