Beispiel #1
0
    def GetStrategyList(self, strategy_log_obj, portfolio_twap_obj):
        index_strategy = 0
        index_portfolio = 0
        common_functions_obj = CCommonFunctions()

        while index_strategy < strategy_log_obj.m_nCountOfRows and index_portfolio < len(
                portfolio_twap_obj.m_fOrderExecutionFillPriceList):
            if common_functions_obj.CompareTime(
                    strategy_log_obj.m_DatetimeList[index_strategy],
                    portfolio_twap_obj.m_DatetimeList[index_portfolio]) == -1:
                index_strategy += 1

            elif common_functions_obj.CompareTime(
                    strategy_log_obj.m_DatetimeList[index_strategy],
                    portfolio_twap_obj.m_DatetimeList[index_portfolio]
            ) == 0 or common_functions_obj.CompareTime(
                    strategy_log_obj.m_DatetimeList[index_strategy],
                    portfolio_twap_obj.m_DatetimeList[index_portfolio]) == 1:
                strategy_log_obj.m_strStrategyExecutionList.append(
                    strategy_log_obj.m_strStrategyList[index_strategy - 1])
                index_portfolio += 1

        # print "displaying Strategy execution list"
        # for iter in range(0, len(strategy_log_obj.m_strStrategyExecutionList)):
        #     print str(strategy_log_obj.m_strStrategyExecutionList[iter])
        return True
Beispiel #2
0
    def GetVwapWindow(self, data_object, list_index, time_window_index):
        common_functions_obj = CCommonFunctions()
        temp_vol = 0
        temp_vwap = 0

        while common_functions_obj.CompareTime(
                data_object.m_DatetimeList[list_index],
                data_object.m_strTimeWindowList[time_window_index]) == -1:
            if not data_object.m_nSizeList[list_index] == "NULL":
                temp_vol = temp_vol + float(
                    data_object.m_nSizeList[list_index])
                temp_vwap = temp_vwap + float(
                    data_object.m_nSizeList[list_index]) * float(
                        data_object.m_fPriceList[list_index])

            list_index += 1

            if list_index >= len(data_object.m_nSizeList):
                break

        if not temp_vol == 0:
            temp_vwap = temp_vwap / temp_vol
            data_object.m_fVwapWindowList.append(temp_vwap)

        return list_index
Beispiel #3
0
    def GetStrategyList(self, strategy_log_obj, portfolio_twap_obj):
        index_strategy = 0
        index_portfolio = 0
        common_functions_obj = CCommonFunctions()

        while index_strategy < strategy_log_obj.m_nCountOfRows and index_portfolio < len(
                portfolio_twap_obj.m_fOrderExecutionFillPriceList):
            if common_functions_obj.CompareTime(
                    strategy_log_obj.m_DatetimeList[index_strategy],
                    portfolio_twap_obj.m_DatetimeList[index_portfolio]) == -1:
                index_strategy += 1

            elif common_functions_obj.CompareTime(
                    strategy_log_obj.m_DatetimeList[index_strategy],
                    portfolio_twap_obj.m_DatetimeList[index_portfolio]
            ) == 0 or common_functions_obj.CompareTime(
                    strategy_log_obj.m_DatetimeList[index_strategy],
                    portfolio_twap_obj.m_DatetimeList[index_portfolio]) == 1:
                strategy_log_obj.m_strStrategyExecutionList.append(
                    strategy_log_obj.m_strStrategyList[index_strategy - 1])
                index_portfolio += 1
        return True
Beispiel #4
0
    def GetVolWindow(self, data_object, list_index, time_window_index):
        common_functions_obj = CCommonFunctions()
        temp_vol = 0

        while common_functions_obj.CompareTime(
                data_object.m_DatetimeList[list_index],
                data_object.m_strTimeWindowList[time_window_index]) == -1:
            if not data_object.m_nSizeList[list_index] == "NULL":
                temp_vol = temp_vol + float(
                    data_object.m_nSizeList[list_index])

            list_index += 1

            if list_index >= len(data_object.m_nSizeList):
                break

        data_object.m_nVolumeWindowList.append(temp_vol)

        return list_index