|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.fr.plugin.market.update; |
|
|
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.plugin.PluginLicenseManager; |
|
|
|
|
import com.fr.plugin.context.PluginContexts; |
|
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
@ -27,46 +28,46 @@ public class FunConstants {
|
|
|
|
|
|
|
|
|
|
//股市
|
|
|
|
|
static final String[] StockArgs={ |
|
|
|
|
//"股票名字","今日开盘价","昨日收盘价","当前价格","今日最高价","今日最低价","竞买价","竞卖价","成交股票数","成交金额",
|
|
|
|
|
i18nText("Plugin.Function.Market_Update_Stock_Name"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Begin_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_End_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Now_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_High_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Low_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Bid_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Auction_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Trade_Volume"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Trade_Amount"), |
|
|
|
|
// "买一手数","买一报价","买二手数","买二报价","买三手数","买三报价","买四手数","买四报价","买五手数","买五报价",
|
|
|
|
|
i18nText("Plugin.Function.Market_Update_Buy_1_Number"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Buy_1_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Buy_2_Number"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Buy_2_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Buy_3_Number"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Buy_3_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Buy_4_Number"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Buy_4_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Buy_5_Number"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Buy_5_Price"), |
|
|
|
|
// "卖一手数","卖一报价","卖二手数","卖二报价","卖三手数","卖三报价","卖四手数","卖四报价","卖五手数","卖五报价",
|
|
|
|
|
i18nText("Plugin.Function.Market_Update_Sell_1_Number"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Sell_1_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Sell_2_Number"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Sell_2_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Sell_3_Number"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Sell_3_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Sell_4_Number"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Sell_4_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Sell_5_Number"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Sell_5_Price"), |
|
|
|
|
// "日期","时间"
|
|
|
|
|
i18nText("Plugin.Function.Market_Update_Stock_Date"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Stock_Time"), |
|
|
|
|
"股票名字","今日开盘价","昨日收盘价","当前价格","今日最高价","今日最低价","竞买价","竞卖价","成交股票数","成交金额", |
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Stock_Name"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Begin_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_End_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Now_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_High_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Low_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Bid_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Auction_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Trade_Volume"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Trade_Amount"),
|
|
|
|
|
"买一手数","买一报价","买二手数","买二报价","买三手数","买三报价","买四手数","买四报价","买五手数","买五报价", |
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Buy_1_Number"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Buy_1_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Buy_2_Number"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Buy_2_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Buy_3_Number"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Buy_3_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Buy_4_Number"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Buy_4_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Buy_5_Number"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Buy_5_Price"),
|
|
|
|
|
"卖一手数","卖一报价","卖二手数","卖二报价","卖三手数","卖三报价","卖四手数","卖四报价","卖五手数","卖五报价", |
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Sell_1_Number"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Sell_1_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Sell_2_Number"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Sell_2_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Sell_3_Number"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Sell_3_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Sell_4_Number"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Sell_4_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Sell_5_Number"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Sell_5_Price"),
|
|
|
|
|
"日期","时间" |
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Stock_Date"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Stock_Time"),
|
|
|
|
|
}; |
|
|
|
|
static final String[] StockCity={ |
|
|
|
|
// "上海","深圳",
|
|
|
|
|
i18nText("Plugin.Function.Market_Update_Shang_Hai"), i18nText("Plugin.Function.Market_Update_Shen_Zhen") |
|
|
|
|
"上海","深圳", |
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Shang_Hai"), i18nText("Plugin.Function.Market_Update_Shen_Zhen")
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//金银
|
|
|
|
@ -74,49 +75,49 @@ public class FunConstants {
|
|
|
|
|
"伦敦金","伦敦银","COMEX黄金","COMEX白银","黄金T+D","白银T+D" |
|
|
|
|
}; |
|
|
|
|
static final String[] GoldName={ |
|
|
|
|
// "最新价","涨跌","涨跌幅","最高价","最低价","今开价","昨收价"
|
|
|
|
|
i18nText("Plugin.Function.Market_Update_New_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Rise_Fall"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Rise_Fall_Amount"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_High_Price1"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Low_Price1"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Begin_Price1"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_End_Price1"), |
|
|
|
|
"最新价","涨跌","涨跌幅","最高价","最低价","今开价","昨收价" |
|
|
|
|
// i18nText("Plugin.Function.Market_Update_New_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Rise_Fall"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Rise_Fall_Amount"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_High_Price1"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Low_Price1"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Begin_Price1"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_End_Price1"),
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//期货
|
|
|
|
|
static final String[] ForwardType={ |
|
|
|
|
// "WTI原油","伦敦布伦特原油","黄金","白银","天然气","铜","美国大豆"
|
|
|
|
|
i18nText("Plugin.Function.Market_Update_Crude_Oil"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Brent_Oil"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Gold"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Silver"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Natural_Gas"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Copper"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Us_Soybeans"), |
|
|
|
|
"WTI原油","伦敦布伦特原油","黄金","白银","天然气","铜","美国大豆" |
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Crude_Oil"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Brent_Oil"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Gold"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Silver"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Natural_Gas"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Copper"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Us_Soybeans"),
|
|
|
|
|
}; |
|
|
|
|
static final String[] ForwardURL={ |
|
|
|
|
"crude-oil","brent-oil","gold","silver","natural-gas","copper","us-soybeans" |
|
|
|
|
}; |
|
|
|
|
static final String[] ForwardAndIndexArgs={ |
|
|
|
|
// "最新","昨收","开盘","最低","最高"
|
|
|
|
|
i18nText("Plugin.Function.Market_Update_Forward_New_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Forward_End_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Forward_Begin_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Forward_Low_Price"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Forward_High_Price"), |
|
|
|
|
"最新","昨收","开盘","最低","最高" |
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Forward_New_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Forward_End_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Forward_Begin_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Forward_Low_Price"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Forward_High_Price"),
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//指数
|
|
|
|
|
static final String[] IndexType={ |
|
|
|
|
// "上证指数","富时中国A50指数","恒生指数","日经225","道琼斯30(F)","美国标普500(F)","美元指数期货"
|
|
|
|
|
i18nText("Plugin.Function.Market_Update_Shanghai_Composite"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Ftse_China_A50"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Hang_Sen"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_Japan_Ni225"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_US_30-Futures"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_US_Spx_500_futures"), |
|
|
|
|
i18nText("Plugin.Function.Market_Update_US_Dollar_Index"), |
|
|
|
|
"上证指数","富时中国A50指数","恒生指数","日经225","道琼斯30(F)","美国标普500(F)","美元指数期货" |
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Shanghai_Composite"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Ftse_China_A50"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Hang_Sen"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_Japan_Ni225"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_US_30-Futures"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_US_Spx_500_futures"),
|
|
|
|
|
// i18nText("Plugin.Function.Market_Update_US_Dollar_Index"),
|
|
|
|
|
}; |
|
|
|
|
static final String[] IndexURL={ |
|
|
|
|
"shanghai-composite","ftse-china-a50","hang-sen-40","japan-ni225","us-30-futures","us-spx-500-futures","us-dollar-index" |
|
|
|
@ -178,6 +179,7 @@ public class FunConstants {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
static final String GetIndexData(String indexType ,String indexdArgs) throws IOException { |
|
|
|
|
FineLoggerFactory.getLogger().info("ForwardAndIndexArgs[0]:{}",ForwardAndIndexArgs[0]); |
|
|
|
|
if(!ArrayUtils.contains(IndexType,indexType)||!ArrayUtils.contains(ForwardAndIndexArgs,indexdArgs)){ |
|
|
|
|
return ARGS_ERROR; |
|
|
|
|
} |
|
|
|
@ -186,6 +188,7 @@ public class FunConstants {
|
|
|
|
|
final String CHINA_BANK_URI = "https://cn.investing.com/indices/"+IndexURL[i]; |
|
|
|
|
String agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Edg/89.0.774.54"; |
|
|
|
|
Document doc = Jsoup.connect(CHINA_BANK_URI).ignoreContentType(true).userAgent(agent).get(); |
|
|
|
|
|
|
|
|
|
if(ForwardAndIndexArgs[0].equals(indexdArgs)){ |
|
|
|
|
return doc.getElementById("last_last").text(); |
|
|
|
|
} |
|
|
|
|