Beispiel #1
0
 //批量转id
 public static NET_ERROR IdConvert(ref List<string> stockid)
 {
     List<string> shid=new List<string>();
     List<string> szid=new List<string>();
     foreach (string id in stockid)
     {
         shid.Add("0" + id);
         szid.Add("1" + id);
     }
     stockid.Clear();
     StockInfo si = new Netease();
     Dictionary<string, StockInfoEntity> ds;
     NET_ERROR NE = si.StockGetWithCheck(ref shid, out ds);
     if (NE == NET_ERROR.NET_REQ_OK)
         foreach (var s in ds)
         {
             stockid.Add(s.Key);
         }
     else
         return NE;
     NE = si.StockGetWithCheck(ref szid, out ds);
     if (NE == NET_ERROR.NET_REQ_OK)
         foreach (var s in ds)
         {
             stockid.Add(s.Key);
         }
     return NE;
 }
Beispiel #2
0
 //批量获取名称
 public static NET_ERROR CheckName(List<string> stockid, out Dictionary<string, string> name)
 {
     StockInfo si = new Netease();
     Dictionary<string, StockInfoEntity> ds;
     NET_ERROR NE = si.StockGetWithCheck(ref stockid, out ds);
     name = new Dictionary<string, string>();
     if (NE == NET_ERROR.NET_REQ_OK)
         foreach(var s in ds)
         {
             name[s.Key] = s.Value.name;
         }
     return NE;
 }
Beispiel #3
0
 //获取股票名称
 public static NET_ERROR CheckName(string stockid,out string name)
 {
     StockInfo si = new Netease();
     List<string> id = new List<string>();
     id.Add(stockid);
     Dictionary<string, StockInfoEntity> ds;
     NET_ERROR NE = si.StockGetWithCheck(ref id, out ds);
     if (NE == NET_ERROR.NET_REQ_OK && ds.Count > 0)
         name = ds.First().Value.name;
     else
         name = "";
     return NE;
 }
Beispiel #4
0
 //id转带sh或sz
 public static NET_ERROR IdConvert(ref string stockid)
 {
     List<string> shid = new List<string>();
     List<string> szid = new List<string>();
     shid.Add("0" + stockid);
     szid.Add("1" + stockid);
     StockInfo si = new Netease();
     Dictionary<string, StockInfoEntity> ds;
     NET_ERROR NE = si.StockGetWithCheck(ref shid, out ds);
     if (NE == NET_ERROR.NET_REQ_OK && ds.Count > 0)
         stockid = ds.First().Key;
     else
         return NE;
     NE = si.StockGetWithCheck(ref szid, out ds);
     if (NE == NET_ERROR.NET_REQ_OK && ds.Count > 0)
         stockid = ds.First().Key;
     return NE;
 }
Beispiel #5
0
        public override NET_ERROR HistoryMoney(string id, DateTime date, DateTime enddate, out Dictionary <DateTime, double> money)
        {
            Netease si = new Netease();

            return(si.HistoryMoney(id, date, enddate, out money));
        }
Beispiel #6
0
 //获取当前价
 public static double PriceGet(string id)
 {
     StockInfo si = new Netease();
     List<string> idl=new List<string>();
     idl.Add(id);
     Dictionary<string,StockInfoEntity> dict;
     si.StockGet(ref idl, out dict);
     if (dict.Count == 0)
         return 0;
     else
         return Convert.ToDouble(dict[id].price);
 }
Beispiel #7
0
 public override NET_ERROR HistoryMoney(string id, DateTime date, DateTime enddate, out Dictionary<DateTime, double> money)
 {
     Netease si = new Netease();
     return si.HistoryMoney(id, date, enddate, out money);
 }