From 0ebdfd97b5400c864584147bd72a0de768172d6e Mon Sep 17 00:00:00 2001
From: dd <gitluke@outlook.com>
Date: Tue, 27 Jan 2026 10:19:48 +0800
Subject: [PATCH] 1
---
src/main/java/com/nq/enums/EStockType.java | 75 +++++++++++++++++++++++++++----------
1 files changed, 55 insertions(+), 20 deletions(-)
diff --git a/src/main/java/com/nq/enums/EStockType.java b/src/main/java/com/nq/enums/EStockType.java
index 2b965f2..baa0561 100644
--- a/src/main/java/com/nq/enums/EStockType.java
+++ b/src/main/java/com/nq/enums/EStockType.java
@@ -10,17 +10,12 @@
public enum EStockType {
- IN("IN","印度股票","14", PropertiesUtil.getProperty("IN_HTTP_API"),PropertiesUtil.getProperty("IN_KEY")),
- US("US","美国股票","5",PropertiesUtil.getProperty("US_HTTP_API"),PropertiesUtil.getProperty("US_KEY")),
- HK("HK","香港股票","39",PropertiesUtil.getProperty("HK_HTTP_API"),PropertiesUtil.getProperty("HK_KEY")),
- MAS("MAS","马来西亚股票","42",PropertiesUtil.getProperty("MAS_HTTP_API"),PropertiesUtil.getProperty("MAS_KEY")),
- TH("TH","泰国股票","41",PropertiesUtil.getProperty("TH_HTTP_API"),PropertiesUtil.getProperty("TH_KEY")),
+
+ US("US","美国股票","5",PropertiesUtil.getProperty("US_HTTP_API"),PropertiesUtil.getProperty("US_KEY"),"USD","$"),
+
+ JP("JP","日本股票","35",PropertiesUtil.getProperty("JP_HTTP_API"),PropertiesUtil.getProperty("JP_KEY"),"JPY","¥");
-
- HG("HG","韩国股票","11",PropertiesUtil.getProperty("HG_HTTP_API"),PropertiesUtil.getProperty("TG_KEY")),
-
- SZHB("SZHB","数字货币","41",PropertiesUtil.getProperty("SZHB_HTTP_API"),PropertiesUtil.getProperty("SZHB_KEY"));
private String code;
private String typeDesc;
public String contryId;
@@ -28,28 +23,52 @@
public String stockUrl;
public String stockKey;
+ private String symbol;
- EStockType(String code, String typeDesc, String contryId, String stockUrl, String stockKey) {
+ private String symbol1;
+
+ public static EStockType getDefault() {
+ return US; // 指定默认
+ }
+
+ EStockType(String code, String typeDesc, String contryId, String stockUrl, String stockKey,String symbol,String symbol1) {
this.code = code;
this.typeDesc = typeDesc;
this.contryId = contryId;
this.stockUrl = stockUrl;
this.stockKey = stockKey;
+ this.symbol = symbol;
+ this.symbol1 = symbol1;
}
public static EStockType getEStockTypeByCode(String code){
if(EStockType.US.getCode().equals(code)){
return US;
- }else if(EStockType.IN.getCode().equals(code)){
- return IN;
- }else if(EStockType.HK.getCode().equals(code)){
- return HK;
- }else if(EStockType.MAS.getCode().equals(code)){
- return MAS;
- }else if(EStockType.SZHB.getCode().equals(code)){
- return SZHB;
- }else {
- return TH;
+ }else if(EStockType.JP.getCode().equals(code)){
+ return JP;
+ }else{
+ return US;
+ }
+ }
+
+ public static boolean isExistByCode(String code){
+ if(EStockType.US.getCode().equals(code)){
+ return true;
+ }else if(EStockType.JP.getCode().equals(code)){
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+ //根据货币获取类型
+ public static EStockType getEStockTypeBySymbol(String symbol){
+ if(EStockType.US.getSymbol().equals(symbol)){
+ return US;
+ }else if(EStockType.JP.getSymbol().equals(symbol)){
+ return JP;
+ }else{
+ return null;
}
}
@@ -69,6 +88,22 @@
return code;
}
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+
+ public String getSymbol1() {
+ return symbol1;
+ }
+
+ public void setSymbol1(String symbol1) {
+ this.symbol1 = symbol1;
+ }
+
public String getTypeDesc() {
return typeDesc;
}
--
Gitblit v1.9.3