Exemplo n.º 1
0
        public object[,] MarketDataGetHistDailyQuotes(string securityID, string fieldsStr, DateUtilities.CALDate startDate, DateUtilities.CALDate endDate)
        {
            Dictionary <string, string> tmp = server_config[server];
            string requestString            = tmp["host"];

            requestString = (tmp["port"] != "" ? requestString + ":" + tmp["port"] : requestString);
            requestString = requestString + api_config["MarketDataGetHistDailyQuotes"][server];
            requestString = requestString + "securityID=" + securityID;
            requestString = requestString + "&field=";
            string[] fields = fieldsStr.Split(',');
            if (fields.Length != 0)
            {
                foreach (object field in fields)
                {
                    string tmpStr = field.ToString();
                    requestString = requestString + tmpStr + ",";
                }
                requestString = requestString.Remove(requestString.Length - 1);
            }

            requestString = requestString + "&startDate=" + startDate.plainRepr();
            requestString = requestString + "&endDate=" + endDate.plainRepr();
            WebRequest  wReq       = System.Net.WebRequest.Create(requestString);
            WebResponse wResp      = wReq.GetResponse();
            Stream      respStream = wResp.GetResponseStream();

            return(CSVHelper.parseCSVString(respStream));
        }
Exemplo n.º 2
0
        public object[,] SecurityCategory(string standard, int level, string fieldsStr, DateUtilities.CALDate date)
        {
            Dictionary <string, string> tmp = server_config[server];
            string requestString            = tmp["host"];

            requestString = (tmp["port"] != "" ? requestString + ":" + tmp["port"] : requestString);
            requestString = requestString + api_config["SecurityCategory"][server];
            requestString = requestString + "standard=" + standard + level;
            requestString = requestString + "&date=" + date.plainRepr();
            requestString = requestString + "&field=";
            string[] fields = fieldsStr.Split(',');
            if (fields.Length != 0)
            {
                foreach (object field in fields)
                {
                    string tmpStr = field.ToString();
                    requestString = requestString + tmpStr + ",";
                }
                requestString = requestString.Remove(requestString.Length - 1);
            }

            WebRequest  wReq       = System.Net.WebRequest.Create(requestString);
            WebResponse wResp      = wReq.GetResponse();
            Stream      respStream = wResp.GetResponseStream();

            return(CSVHelper.parseCSVString(respStream));
        }
Exemplo n.º 3
0
        public object[,] FundamentalBalanceSheetRange(string securityID,
                                                      DateUtilities.CALDate startDate,
                                                      DateUtilities.CALDate endDate,
                                                      string fieldsStr,
                                                      string reportType)
        {
            Dictionary <string, string> tmp = server_config[server];
            string requestString            = tmp["host"];

            requestString = (tmp["port"] != "" ? requestString + ":" + tmp["port"] : requestString);
            requestString = requestString + api_config["FundamentalBalanceSheetRange"][server];
            requestString = requestString + "stockID=" + securityID;
            requestString = requestString + "&startDate=" + startDate.plainRepr();
            requestString = requestString + "&endDate=" + endDate.plainRepr();
            requestString = requestString + "&reportType=" + reportType;
            requestString = requestString + "&field=";
            string[] fields = fieldsStr.Split(',');
            if (fields.Length != 0)
            {
                foreach (object field in fields)
                {
                    string tmpStr = field.ToString();
                    requestString = requestString + tmpStr + ",";
                }
                requestString = requestString.Remove(requestString.Length - 1);
            }
            WebRequest  wReq       = System.Net.WebRequest.Create(requestString);
            WebResponse wResp      = wReq.GetResponse();
            Stream      respStream = wResp.GetResponseStream();

            //return requestString;
            return(CSVHelper.parseCSVString(respStream));
        }