Ejemplo n.º 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public List<AbhiGoalCustomData> GetData()
 {
     int count = 0;
     var list = new List<AbhiGoalCustomData>();
     using (StreamReader inputStream = new StreamReader(_dataSourceUri))
     {
         downloadedData = inputStream.ReadToEnd();
         var inputProcessor = new AhiGoalLineParser();
         list = inputProcessor.ProcessStreamIntoList(downloadedData);
     }
     // For Development just get a few symbols
     // return list.Where(s => s.symbol == "FAST" || s.symbol == "DNB" || s.symbol == "JNJ" || s.symbol == "LLL").Cast<AbhiGoalCustomData>().ToList();
     return list;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieves the data from the web
        /// </summary>
        /// <returns>a list of AbhiGoalCustomData objects, one for each row in the csv file</returns>
        public List<AbhiGoalCustomData> GetData()
        {
            int count = 0;
            var list = new List<AbhiGoalCustomData>();

            using (WebClient wClient = new WebClient())
            {
                downloadedData = wClient.DownloadString(_dataSourceUri);
            }
            var inputProcessor = new AhiGoalLineParser();
            list = inputProcessor.ProcessStreamIntoList(downloadedData);

            //return list.Where(s => s.symbol == "FAST" || s.symbol == "DNB" || s.symbol == "JNJ" || s.symbol == "LLL").Cast<AbhiGoalCustomData>().ToList();
            return list;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 3. READER METHOD: Read 1 line from data source and convert it into Object.
        /// Each line of the CSV File is presented in here. The backend downloads your file, loads it into memory and then line by line
        /// feeds it into your algorithm
        /// </summary>
        /// <param name="line">string line from the data source file submitted above</param>
        /// <param name="config">Subscription data, symbol name, data type</param>
        /// <param name="currentDate">Current date we're requesting. This allows you to break up the data source into daily files.</param>
        /// <param name="isLiveMode">true if we're in live mode, false for backtesting mode</param>
        /// <returns>New Bitcoin Object which extends BaseData.</returns>
        public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime currentDate, bool isLiveMode)
        {
            var instruction = new AbhiGoalCustomData();
            if (isLiveMode)
            {
                //Example Line Format:
                //{"high": "441.00", "last": "421.86", "timestamp": "1411606877", "bid": "421.96", "vwap": "428.58", "volume": "14120.40683975", "low": "418.83", "ask": "421.99"}
                try
                {
                    AhiGoalLineParser dp = new AhiGoalLineParser();
                    instruction = dp.ParceRowIntoObject(line);
                }
                catch { /* Do nothing, possible error in json decoding */ }
                return instruction;
            }

            //Example Line Format:
            //date,next_date,next_close,symbol,close,kno,w,h,e,n,rd,pct,cr,bsval1,bsval2,bsval3,bsval4
            //07/07/2015,12/31/1969,,CLF,3.53,415,1,3,1,4,R,83,5,B,U,Y,N
            try
            {
                AhiGoalLineParser dp = new AhiGoalLineParser();
                instruction = dp.ParceRowIntoObject(line);

            }
            catch { /* Do nothing, skip first title row */ }

            return instruction;
        }