資源簡介
通過子/母基金代碼,從 [ 東方財富網,天天基金網,新浪 ] 抓取分級基金的子母基金數據(代碼,名稱,凈值,價格),并計算出子基金(A基金,B基金)以及母基金的溢價率與折價率,便于投資/投機客從中套利。
數據通過網站獲取,使用基金凈值,非估值,一般晚間網站會更新當天基金凈值,不可用于實時計算。

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.IO;
using?System.Linq;
using?System.Net;
using?System.Text;
namespace?fundGetAndCal
{
????public?static?class?CONST
????{
????????//獲取母子基金代碼
????????public?static?string?fundF10Url?=?“http://fund.eastmoney.com/f10/jbgk_{%fundCode%}.html“;
????????//獲取凈值
????????public?static?string?fundValUrl?=?“http://fund.eastmoney.com/{%fundCode%}.html“;
????????//獲取價格
????????public?static?string?fundPriceUrl?=?“http://hq.sinajs.cn/?list={%fundAllCode%}“;
????????//母子基金列表
????????public?static?List?allFunCodeLst;
????????//讀取完了
????????public?static?bool?okFlg?=?false;
????????//狀態顯示文字
????????public?static?string?show?=?“就緒“;
????????public?static?int?barMax?=?100;
????????public?static?int?barNow?=?100;
????????public?static?string?GetHtml(string?url?Encoding?encode)
????????{
????????????string?strBuff?=?““;//定義文本字符串,用來保存下載的html
????????????try
????????????{
????????????????HttpWebRequest?webRequest?=?(HttpWebRequest)WebRequest.Create(url);
????????????????HttpWebResponse?webResponse?=?(HttpWebResponse)webRequest.GetResponse();
????????????????//若成功取得網頁的內容,則以System.IO.Stream形式返回,若失敗則產生ProtoclViolationException錯?誤。在此正確的做法應將以下的代碼放到一個try塊中處理。這里簡單處理
????????????????Stream?reader?=?webResponse.GetResponseStream();
????????????????///返回的內容是Stream形式的,所以可以利用StreamReader類獲取GetResponseStream的內容,并以StreamReader類的Read方法依次讀取網頁源程序代碼每一行的內容,直至行尾(讀取的編碼格式:UTF8)
????????????????StreamReader?respStreamReader?=?new?StreamReader(reader/*Encoding.UTF8*/encode);
????????????????strBuff?=?respStreamReader.ReadToEnd();
????????????}
????????????catch?(Exception?e)
????????????{
????????????????Console.Write(url+“\n“+e.Message);
????????????}
????????????return?strBuff;
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????919??2015-05-30?11:27??fundGetAndCal\fundGetAndCal\App.config
?????文件???????2138??2015-05-30?13:21??fundGetAndCal\fundGetAndCal\CONST.cs
?????文件??????11886??2015-05-30?13:03??fundGetAndCal\fundGetAndCal\Form1.cs
?????文件??????10777??2015-05-30?12:55??fundGetAndCal\fundGetAndCal\Form1.Designer.cs
?????文件???????8535??2015-05-30?12:55??fundGetAndCal\fundGetAndCal\Form1.resx
?????文件???????3814??2015-05-30?09:01??fundGetAndCal\fundGetAndCal\fundGetAndCal.csproj
?????文件????????494??2015-05-30?08:09??fundGetAndCal\fundGetAndCal\Program.cs
?????文件???????1346??2015-05-30?08:09??fundGetAndCal\fundGetAndCal\Properties\AssemblyInfo.cs
?????文件???????2878??2015-05-30?08:09??fundGetAndCal\fundGetAndCal\Properties\Resources.Designer.cs
?????文件???????5612??2015-05-30?08:09??fundGetAndCal\fundGetAndCal\Properties\Resources.resx
?????文件???????1100??2015-05-30?08:09??fundGetAndCal\fundGetAndCal\Properties\Settings.Designer.cs
?????文件????????249??2015-05-30?08:09??fundGetAndCal\fundGetAndCal\Properties\Settings.settings
?????文件????????929??2015-05-30?08:11??fundGetAndCal\fundGetAndCal.sln
????..A..H.?????28672??2015-05-30?11:50??fundGetAndCal\fundGetAndCal.v11.suo
?????目錄??????????0??2015-05-30?08:09??fundGetAndCal\fundGetAndCal\Properties
?????目錄??????????0??2015-05-30?08:55??fundGetAndCal\fundGetAndCal
?????目錄??????????0??2015-05-30?08:11??fundGetAndCal
?????文件??????19968??2015-05-30?13:26??EXE\fundGetAndCal.exe
?????文件????????165??2015-05-30?13:28??EXE\fundGetAndCal.exe.config
?????目錄??????????0??2015-05-30?13:29??EXE
-----------?---------??----------?-----??----
????????????????99482????????????????????20
評論
共有 條評論