-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
1,013 additions
and
262 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.bst.pro; | ||
|
||
import org.apache.log4j.Logger; | ||
|
||
import com.bst.pro.util.BasicHttpClient; | ||
import com.bst.pro.util.IFHQ; | ||
|
||
public class HXNetTest extends BasicHttpClient { | ||
|
||
static Logger log = Logger.getLogger(GTradeTest.class.getName()); | ||
|
||
public static void main(String[] args) { | ||
//use proxy | ||
// setProxy("10.100.0.6", 8080, "http"); | ||
|
||
// String username = "[email protected]"; | ||
// String password = "bgtyhnmju"; | ||
|
||
// fixSelfSignedCertificate(); | ||
setLocalCookieManger(); | ||
|
||
String frmTrackUrl = "http://utrack.hexun.com/frmTrack.aspx?site=http%3A//quote.futures.hexun.com/IF1207.shtml&time=1342440043890&rsite="; | ||
getText(frmTrackUrl); | ||
|
||
String userTrackUrl = "http://utrack.hexun.com/UserTrack.aspx?time=1342440043890&site=http%3a%2f%2fquote.futures.hexun.com%2fIF1207.shtml&rsite="; | ||
// cookie info | ||
// ASP.NET_SessionId Sent fu0urqqkceo5uh25rmu2lyjd / .utrack.hexun.com (Session) Server Yes No | ||
// HexunTrack Received SID=2504118437&CITY=31 / .hexun.com Sat, 11-Apr-2015 16:00:00 GMT Server No No | ||
getText(userTrackUrl); | ||
|
||
|
||
String fRunTimeQuoteUrl = "http://quote.futures.hexun.com/2010/JsData/FRunTimeQuote.aspx?code=IF1207&market=9&&time=195130"; | ||
// cookie info | ||
// ASP.NET_SessionId Sent txne1d453tmmrf45waov1v45 / .quote.futures.hexun.com (Session) No No | ||
// HexunTrack Sent SID=2503658023&CITY=31 / .hexun.com Sat, 11-Apr-2015 16:00:00 GMT Stored No No | ||
String retStr = getTextAsString(fRunTimeQuoteUrl); | ||
//var dataArr=['IF1207', 'IF1207', 3, 2417, 2457, -38.8,'-1.58%', 2462, 2464.8, 2413.6, 347330, 45844,0, 0, 0, 2416.2, 2455.8,2701.38, 2210.22, 2429.802]; FRunTimeQuote.GetData(dataArr) | ||
String hqStr = (String) retStr.subSequence(retStr.indexOf("[") + 1, retStr.indexOf("]")); | ||
hqStr = hqStr.replaceAll(" ", ""); | ||
String[] hqArr = hqStr.split(","); | ||
IFHQ ifhq = IFHQ.creator(hqArr[0], hqArr[1], hqArr[3], hqArr[5], hqArr[6], hqArr[7], hqArr[8], hqArr[9], hqArr[10], hqArr[11], hqArr[12], hqArr[13], hqArr[14], hqArr[15], hqArr[16], hqArr[17], hqArr[18], hqArr[19]); | ||
|
||
|
||
|
||
|
||
shutdown(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.bst.pro; | ||
|
||
import com.bst.pro.service.MService; | ||
|
||
public class IFTip { | ||
private MService smsService; | ||
private MService ifhqService; | ||
|
||
private void init() { | ||
smsService.init(); | ||
ifhqService.init(); | ||
} | ||
private void shutdown() { | ||
smsService.shutdown(); | ||
ifhqService.shutdown(); | ||
} | ||
|
||
public static void main(String[] args) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
package com.bst.pro.bo; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.jsoup.Jsoup; | ||
import org.jsoup.nodes.Document; | ||
import org.jsoup.nodes.Element; | ||
import org.jsoup.select.Elements; | ||
|
||
public class ZQZCObject { | ||
|
||
public static void main(String[] args) { | ||
try { | ||
Document doc = Jsoup.parse(new File( | ||
"D:\\html\\searchStackDetailUrl.html"), "utf-8"); | ||
ZQZCObject zqzc = new ZQZCObject(doc); | ||
|
||
} catch (IOException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
public ZQZCObject(Document zqzcDoc) { | ||
|
||
// 构造资产账户状况对象 | ||
Elements zjzkzkDoc = zqzcDoc.select("table:contains(资产总值(含基金))"); | ||
Elements zjzkzkItem = zjzkzkDoc.get(3).select("tr:eq(1)"); | ||
zjzkzk.zjzh = zjzkzkItem.select("td:eq(0)").html().trim().toString(); | ||
zjzkzk.bz = zjzkzkItem.select("td:eq(1)").html().trim().toString(); | ||
zjzkzk.zjye = Double.parseDouble(zjzkzkItem.select("td:eq(2)").html() | ||
.trim().toString()); | ||
zjzkzk.kyye = Double.parseDouble(zjzkzkItem.select("td:eq(3)").html() | ||
.trim().toString()); | ||
zjzkzk.ktqye = Double.parseDouble(zjzkzkItem.select("td:eq(4)").html() | ||
.trim().toString()); | ||
zjzkzk.zqsz = Double.parseDouble(zjzkzkItem.select("td:eq(5)").html() | ||
.trim().toString()); | ||
zjzkzk.zczz = Double.parseDouble(zjzkzkItem.select("td:eq(6)").html() | ||
.trim().toString()); | ||
zjzkzk.yhmc = zjzkzkItem.select("td:eq(7)").html().trim().toString(); | ||
|
||
// 构造证券资产状况对象列表 | ||
Elements itemsDoc = zqzcDoc.select("table:contains(浮动盈亏(元))"); | ||
|
||
// 取得记录个数 | ||
int itemNum = Integer.parseInt(zqzcDoc.select("td:containsOwn(记录个数:") | ||
.html().trim().substring(5)); | ||
if (itemNum > 0) { | ||
Element itemList = itemsDoc.get(1); | ||
ZQZCItem item = null; | ||
for (int i = 1; i <= itemNum; i++) { | ||
item = new ZQZCItem(); | ||
String selectStr = "tr:eq(" + i + ")"; | ||
Elements itemEle = itemList.select(selectStr); | ||
item.cz = itemEle.select("td:eq(0)").html().trim(); | ||
item.zqdm = itemEle.select("td:eq(1)").html().trim(); | ||
item.zqmc = itemEle.select("td:eq(2)").html().trim(); | ||
item.zjsl = Long.parseLong(itemEle.select("td:eq(3)").html() | ||
.trim()); | ||
item.kyslsz = Double.parseDouble(itemEle.select("td:eq(4)") | ||
.html().trim()); | ||
item.zxjg = Double.parseDouble(itemEle.select("td:eq(5)") | ||
.html().trim()); | ||
item.cbj = Double.parseDouble(itemEle.select("td:eq(6)").html() | ||
.trim()); | ||
item.fdyk = Double.parseDouble(itemEle.select("td:eq(7)") | ||
.html().trim()); | ||
zqzcList.add(item); | ||
} | ||
} | ||
|
||
} | ||
|
||
ZJZHZK zjzkzk = new ZJZHZK(); | ||
List<ZQZCItem> zqzcList = new ArrayList<ZQZCItem>(); | ||
|
||
// 资金帐户状况 | ||
class ZJZHZK { | ||
// 资金账号 10206(主) | ||
public String zjzh = null; | ||
|
||
// 币种 人民币 | ||
public String bz = null; | ||
|
||
// 资金余额 5000.00 | ||
public double zjye; | ||
|
||
// 可用余额 5000.00 | ||
public double kyye; | ||
|
||
// 可提取余额 5000.00 | ||
public double ktqye; | ||
|
||
// 证券市值 ) 0.00 | ||
public double zqsz; | ||
|
||
// 资产总值(含基金) 5000.00 | ||
public double zczz; | ||
|
||
// 银行名称 建行三方 | ||
public String yhmc = null; | ||
} | ||
|
||
// 证券资产状况 | ||
class ZQZCItem { | ||
// 操作 | ||
public String cz = null; | ||
|
||
// 证券代码 | ||
public String zqdm = null; | ||
|
||
// 证券名称 | ||
public String zqmc = null; | ||
|
||
// 实际数量 | ||
public long zjsl; | ||
|
||
// 可用数量 市值(元) | ||
public double kyslsz; | ||
|
||
// 最新价格 | ||
public double zxjg; | ||
|
||
// 成本价(元) | ||
public double cbj; | ||
|
||
// 浮动盈亏(元) | ||
public double fdyk; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.bst.pro.service; | ||
|
||
public interface MService { | ||
public void init(); | ||
public void shutdown(); | ||
} |
Oops, something went wrong.