update index
This commit is contained in:
@@ -1067,6 +1067,20 @@ public class StockService {
|
||||
// List kline = HomeApiIndex.convertToJsonList(kLines);
|
||||
vo1.setKLine(kLines);
|
||||
indexVoList.add(vo1);
|
||||
List<String> order = Arrays.asList(
|
||||
"IBEX 35 Index",
|
||||
"Dow Jones Industrial Average",
|
||||
"S&P 500 Index",
|
||||
"DAX Index"
|
||||
);
|
||||
|
||||
|
||||
Map<String, Integer> orderMap = new HashMap<>();
|
||||
for (int i = 0; i < order.size(); i++) {
|
||||
orderMap.put(order.get(i), i);
|
||||
}
|
||||
|
||||
indexVoList.sort(Comparator.comparingInt(o -> orderMap.getOrDefault(o.getIndexVo().getName(), Integer.MAX_VALUE)));
|
||||
}
|
||||
|
||||
return ServerResponse.createBySuccess(indexVoList);
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
public class HomeApiIndex {
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
static Config config = SpringUtils.getBean(Config.class);
|
||||
private static final String API_URL = config.getStockUrlPrefix() + "/api/ger-market/stocks/query-list?symbols=DAX,MDAX,SDXP,HDAX";
|
||||
private static final String API_URL = config.getStockUrlPrefix() + "/api/ger-market/stocks/query-list?symbols=IBC:BME,DAX,^DJI:NASDAQ,^SPX:NASDAQ";
|
||||
private static final String BASE_URL = config.getStockUrlPrefix() + "/api/ger-market/chart";
|
||||
|
||||
public static List<StockIndex> fetchStockIndices() throws Exception {
|
||||
@@ -51,10 +51,12 @@ public class HomeApiIndex {
|
||||
index.setName("DAX Index");
|
||||
}else if (index.getSymbol().equals("MDAX")) {
|
||||
index.setName("MDAX Index");
|
||||
}else if (index.getSymbol().equals("HDAX")) {
|
||||
index.setName("HDAX PERFORMANCE-INDEX");
|
||||
}else if (index.getSymbol().equals("IBC:BME")) {
|
||||
index.setName("IBEX 35 Index");
|
||||
} else if (index.getSymbol().equals("SDXP")) {
|
||||
index.setName("SDAX Index");
|
||||
}else {
|
||||
index.setName(obj.optString("name"));
|
||||
}
|
||||
index.setExchange(obj.optString("exchange"));
|
||||
index.setMicCode(obj.optString("mic_code"));
|
||||
|
||||
Reference in New Issue
Block a user