Beispiel #1
0
    def GetDataMarket(self, market_obj, path, date, scrip, windowInterval):
        common_functions_obj = CCommonFunctions()
        filename = path + '/' + common_functions_obj.FormatDate(
            date) + '/' + scrip.replace(
                ':', '') + '_' + common_functions_obj.FormatDate(
                    date) + '_trades.csv'
        with open(filename, 'rb') as marketTrade_file_obj:
            marketTrade_file_contents = csv.reader(marketTrade_file_obj)
            market_obj.m_strScripName = scrip

            for row in marketTrade_file_contents:
                if row[0].strip() == scrip:
                    market_obj.m_nCountOfRows += 1
                    market_obj.m_DatetimeList.append(
                        common_functions_obj.GetDateTime(
                            row[2].strip(), row[3].strip()))
                    market_obj.m_fPriceList.append(float(row[4].strip()))
                    market_obj.m_nSizeList.append(int(row[5].strip()))
            market_obj.m_strTimeWindowList = common_functions_obj.GetDateTimeList(
                date,
                common_functions_obj.GetWindowList(windowInterval)[0])
            market_obj.m_strTimeWindowPlotList = common_functions_obj.GetDateTimeList(
                date,
                common_functions_obj.GetWindowList(windowInterval)[1])
            CCommonFunctions.total_daily_market_volume = sum(
                market_obj.m_nSizeList)
        return True
Beispiel #2
0
 def GetDataCash(self, cash_obj, path, date, scrip, windowInterval):
     common_functions_obj = CCommonFunctions()
     filename = path + '/' + common_functions_obj.FormatDate(
         date) + '/' + scrip + '_' + common_functions_obj.FormatDate(
             date) + '_trades.csv'
     with open(filename, 'rb') as cash_file_obj:
         cash_file_contents = csv.reader(cash_file_obj)
         cash_obj.m_strScripName = scrip
         for row in cash_file_contents:
             if row[0].strip() == scrip:
                 cash_obj.m_nCountOfRows += 1
                 cash_obj.m_DatetimeList.append(
                     common_functions_obj.GetDateTime(
                         row[2].strip(), row[3].strip()))
                 cash_obj.m_fPriceList.append(float(row[4].strip()))
         cash_obj.m_strTimeWindowList = common_functions_obj.GetDateTimeList(
             date,
             common_functions_obj.GetWindowList(windowInterval)[0])
         cash_obj.m_strTimeWindowPlotList = common_functions_obj.GetDateTimeList(
             date,
             common_functions_obj.GetWindowList(windowInterval)[1])
     return True
Beispiel #3
0
    def GetDataPredicted(self, predicted_obj, path, date, scrip,
                         windowInterval):
        common_functions_obj = CCommonFunctions()
        filename = path + '/' + common_functions_obj.FormatDate(
            date) + '/' + scrip.replace(':', '') + '.csv'
        with open(filename, 'rb') as predicted_file_obj:
            predicted_file_contents = csv.reader(predicted_file_obj)
            predicted_obj.m_strScripName = scrip

            for row in predicted_file_contents:
                predicted_obj.m_nCountOfRows += 1
                predicted_obj.m_DatetimeList.append(
                    common_functions_obj.GetDateTime(
                        date, common_functions_obj.FormatTime(row[0].strip())))
                predicted_obj.m_nSizeList.append(float(row[1].strip()))
            predicted_obj.m_strTimeWindowList = common_functions_obj.GetDateTimeList(
                date,
                common_functions_obj.GetWindowList(windowInterval)[0])
            predicted_obj.m_strTimeWindowPlotList = common_functions_obj.GetDateTimeList(
                date,
                common_functions_obj.GetWindowList(windowInterval)[1])
        return True