コード例 #1
0
 def test_isSymbolInCollection(self):
     expected_symbol = 'A'
     newCollection = SymbolDataCollection()
     is_symbol_in_collection = newCollection.isSymbolInCollection(expected_symbol)
     self.assertFalse(is_symbol_in_collection, 'SymbolDataCollection did not return False for a symbol not yet in the collection, returned {0}'.format(is_symbol_in_collection))
     other_expected_symbol = 'B'
     newCollection.addSymbolToCollection(expected_symbol)
     is_other_symbol_in_collection = newCollection.isSymbolInCollection(other_expected_symbol)
     self.assertFalse(is_other_symbol_in_collection, 'Collection did not return False for a symbol not yet in the collection after a different symbol had been added, returned {0}'.format(is_other_symbol_in_collection))
     testSymbolData = newCollection.getSymbolData(expected_symbol)
     self.assertIsInstance(testSymbolData, SymbolData, 'An object of type SymbolData was not returned for a symbol which should be in the SymbolDataCollection, returned was {0}'.format(testSymbolData))
     test_symbol_from_collection = testSymbolData.symbol
     self.assertEqual(expected_symbol, test_symbol_from_collection, 'The symbol {0} from a SymbolData object returned from a SymbolDataCollection did not match the symbol passed into newCollection.getSymbolData() {1}'.format(test_symbol_from_collection, expected_symbol))
     newCollection.addSymbolToCollection(other_expected_symbol)
     otherSymbolData = newCollection.getSymbolData(other_expected_symbol)
     other_symbol_from_data = otherSymbolData.symbol
     self.assertEqual(other_symbol_from_data, other_expected_symbol, 'The symbol {0} from another SymbolData object returned from a SymbolDataCollection did not match the other symbol passed into newCollection.getSymbolData() {1}'.format(other_symbol_from_data, other_expected_symbol))
コード例 #2
0
 def test_getSortedSpanDeltaValuesByCode(self):
     expected_sorted_by_delta_dict = OrderedDict()
     expected_sorted_by_delta_dict['B'] = -9.1
     expected_sorted_by_delta_dict['C'] = -3.5
     expected_sorted_by_delta_dict['A'] = 0.9
     expected_sorted_by_delta_dict['D'] = 13.0
     expected_sorted_by_delta_percentages_dict = OrderedDict()
     expected_sorted_by_delta_percentages_dict['B'] = -15.166666666666666
     expected_sorted_by_delta_percentages_dict['C'] = -0.6140350877192983
     expected_sorted_by_delta_percentages_dict['A'] = 1.5
     expected_sorted_by_delta_percentages_dict['D'] = 1.5116279069767442
     span_code = 'test_sorted_span_deltas'
     test_unit_label_list = ['test_unit_code']
     other_unit_label_list = ['some_other_label']
     newCollection = SymbolDataCollection()
     testSymbolDataA = newCollection.addSymbolToCollection('A')
     testSymbolDataA.initializeSpanByCode(span_code)
     testSymbolDataA.addSpanValueByCode(span_code, test_unit_label_list, 1.0, 0.6)
     testSymbolDataA.addSpanValueByCode(span_code, test_unit_label_list, 1.5, 1.0)
     testSymbolDataA.addSpanValueByCode(span_code, other_unit_label_list, 1.4, 1.5)
     testSymbolDataB = newCollection.addSymbolToCollection('B')
     testSymbolDataB.initializeSpanByCode(span_code)
     testSymbolDataB.addSpanValueByCode(span_code, test_unit_label_list, -4.0, 0.6)
     testSymbolDataB.addSpanValueByCode(span_code, test_unit_label_list, -8.5, 4.0)
     testSymbolDataB.addSpanValueByCode(span_code, other_unit_label_list, 4.5, -8.5)
     testSymbolDataC = newCollection.addSymbolToCollection('C')
     testSymbolDataC.initializeSpanByCode(span_code)
     testSymbolDataC.addSpanValueByCode(span_code, test_unit_label_list, 1.2, 5.7)
     testSymbolDataC.addSpanValueByCode(span_code, test_unit_label_list, 2.2, 1.2)
     testSymbolDataC.addSpanValueByCode(span_code, other_unit_label_list, 1.2, 2.2)
     testSymbolDataD = newCollection.addSymbolToCollection('D')
     testSymbolDataD.initializeSpanByCode(span_code)
     testSymbolDataD.addSpanValueByCode(span_code, test_unit_label_list, 4.0, -8.6)
     testSymbolDataD.addSpanValueByCode(span_code, test_unit_label_list, 4.4, 4.0)
     testSymbolDataD.addSpanValueByCode(span_code, other_unit_label_list, 2.3, 4.4)
     testOtherLabelOnlySymbolData = newCollection.addSymbolToCollection('E')
     testOtherLabelOnlySymbolData.initializeSpanByCode(span_code)
     testOtherLabelOnlySymbolData.addSpanValueByCode(span_code, other_unit_label_list, 3.4, 5.9)
     sorted_span_delta_values_by_code_dict = newCollection.getSortedSpanDeltaValuesByCode(span_code, 'test_unit_code')
     self.assertEqual(expected_sorted_by_delta_dict, sorted_span_delta_values_by_code_dict, 'test_getSortedDeltaValuesByCode failed to return the expected sorted dictionary, returned {0}\nexpected: {1}'.format(sorted_span_delta_values_by_code_dict, expected_sorted_by_delta_dict))
     # Test delta percentages
     sorted_span_delta_percentage_values_by_code_dict = newCollection.getSortedSpanDeltaValuesByCode(span_code, 'test_unit_code', get_percentages = True)
     self.assertEqual(expected_sorted_by_delta_percentages_dict, sorted_span_delta_percentage_values_by_code_dict)
コード例 #3
0
    def test_getSortedTodayPricePercentageOffSpanAveragesByCode(self):
        test_span_code = 'percentage_price_off_span_average_test'
        testCollection = SymbolDataCollection()
        first_today_price = 2.3
        first_span_prices = [5.7, 8.9, 7.7]
        second_today_price = 3.4
        second_span_prices = [2.3, 2.7, 3.3]
        third_today_price = 1.2
        third_span_prices = [4.6, 2.7, 5.6]
        fourth_today_price = 3.4
        fourth_span_prices = [-2.0, 0.0, 2.0]
        firstSymbolData = testCollection.addSymbolToCollection('A')
        firstSymbolData.setTodayPrice(first_today_price)
        firstSymbolData.initializeSpanByCode(test_span_code)
        unit_label_prefix = 'units_'
        i = 0
        for price in first_span_prices:
            unit_label_suffix = 'even' if ((i % 2) == 0) else 'odd'
            unit_label = unit_label_prefix + unit_label_suffix
            unit_labels_list = [unit_label, i]
            firstSymbolData.addSpanValueByCode(test_span_code, unit_labels_list, price)
            i += 1
        secondSymbolData = testCollection.addSymbolToCollection('B')
        secondSymbolData.initializeSpanByCode(test_span_code)
        secondSymbolData.setTodayPrice(second_today_price)
        i = 0
        for price in second_span_prices:
            unit_label_suffix = 'even' if ((i % 2) == 0) else 'odd'
            unit_label = unit_label_prefix + unit_label_suffix
            unit_labels_list = [unit_label, i]
            secondSymbolData.addSpanValueByCode(test_span_code, unit_labels_list, price)
            i += 1
        thirdSymbolData = testCollection.addSymbolToCollection('C')
        thirdSymbolData.initializeSpanByCode(test_span_code)
        thirdSymbolData.setTodayPrice(third_today_price)
        i = 0
        for price in third_span_prices:
            unit_label_suffix = 'even' if ((i % 2) == 0) else 'odd'
            unit_label = unit_label_prefix + unit_label_suffix
            unit_labels_list = [unit_label, i]
            thirdSymbolData.addSpanValueByCode(test_span_code, unit_labels_list, price)
            i += 1

        testNoneSymbolData = testCollection.addSymbolToCollection('D')
        testNoneSymbolData.initializeSpanByCode(test_span_code)
        testNoneSymbolData.addSpanValueByCode(test_span_code, 'irrelevant_label', 12.3)
        testNoneSymbolData.setTodayPrice(13.3)

        test_price_off_average_values_by_symbol = testCollection.getSortedTodayPricePercentageOffSpanAveragesByCode(test_span_code)
        expected_price_off_average_values_by_symbol = OrderedDict()
        expected_price_off_average_values_by_symbol['C'] = -0.7209302325581395
        expected_price_off_average_values_by_symbol['A'] = -0.6905829596412556
        expected_price_off_average_values_by_symbol['D'] = 0.08130081300813008
        expected_price_off_average_values_by_symbol['B'] = 0.2289156626506022
        self.assertEqual(test_price_off_average_values_by_symbol, expected_price_off_average_values_by_symbol, 'The expected_price_off_average_values_by_symbol was {0}, but {1} was returned while testing getting the percentage delta of today price off of span average'.format(expected_price_off_average_values_by_symbol, test_price_off_average_values_by_symbol))
        price_threshold = 2.0
        test_sorted_dictionary_of_values_above_price_threshold = testCollection.getSortedDictionaryOfValuesAboveTodayPriceThreshold(test_price_off_average_values_by_symbol, price_threshold)
        expected_price_off_average_values_by_symbol_above_threshold = OrderedDict()
        expected_price_off_average_values_by_symbol_above_threshold['A'] = -0.6905829596412556
        expected_price_off_average_values_by_symbol_above_threshold['D'] = 0.08130081300813008
        expected_price_off_average_values_by_symbol_above_threshold['B'] = 0.2289156626506022
        self.assertEqual(test_sorted_dictionary_of_values_above_price_threshold, expected_price_off_average_values_by_symbol_above_threshold, 'The expected_price_off_average_values_by_symbol_above_threshold was {0} but {1} was returned'.format(expected_price_off_average_values_by_symbol_above_threshold, test_sorted_dictionary_of_values_above_price_threshold))
        # Test for even/odd unit labels
        even_units_label = unit_label_prefix + 'even'
        odd_units_label = unit_label_prefix + 'odd'
        test_price_off_even_average_values_by_symbol = testCollection.getSortedTodayPricePercentageOffSpanAveragesByCode(test_span_code, even_units_label)
        test_price_off_odd_average_values_by_symbol = testCollection.getSortedTodayPricePercentageOffSpanAveragesByCode(test_span_code, odd_units_label)
        expected_price_off_even_average_values = OrderedDict()
        expected_price_off_even_average_values['C'] = -0.7647058823529411
        expected_price_off_even_average_values['A'] = -0.6567164179104478
        expected_price_off_even_average_values['B'] = 0.21428571428571433
        self.assertEqual(expected_price_off_even_average_values, test_price_off_even_average_values_by_symbol)
        expected_price_off_odd_average_values = OrderedDict()
        expected_price_off_odd_average_values['A'] = -0.7415730337078652
        expected_price_off_odd_average_values['C'] = -0.5555555555555556
        expected_price_off_odd_average_values['B'] = 0.25925925925925913
        self.assertEqual(test_price_off_odd_average_values_by_symbol, expected_price_off_odd_average_values)
        test_sorted_dictionary_of_even_values_above_price_threshold = testCollection.getSortedDictionaryOfValuesAboveTodayPriceThreshold(test_price_off_even_average_values_by_symbol, price_threshold)
        expected_price_off_even_average_values_by_symbol_above_threshold = OrderedDict()
        expected_price_off_even_average_values_by_symbol_above_threshold['A'] = -0.6567164179104478
        expected_price_off_even_average_values_by_symbol_above_threshold['B'] = 0.21428571428571433
        self.assertEqual(expected_price_off_even_average_values_by_symbol_above_threshold, test_sorted_dictionary_of_even_values_above_price_threshold)
        test_sorted_dictionary_of_odd_values_above_price_threshold = testCollection.getSortedDictionaryOfValuesAboveTodayPriceThreshold(test_price_off_odd_average_values_by_symbol, price_threshold)
        expected_price_off_odd_average_values_by_symbol_above_threshold = OrderedDict()
        expected_price_off_odd_average_values_by_symbol_above_threshold['A'] = -0.7415730337078652
        expected_price_off_odd_average_values_by_symbol_above_threshold['B'] = 0.25925925925925913
        self.assertEqual(expected_price_off_odd_average_values_by_symbol_above_threshold, test_sorted_dictionary_of_odd_values_above_price_threshold)
コード例 #4
0
    def setUp(self):
        self.get_symbol_span_value_vectors_all_length_list_dict = {}

        self.unitDeltaTestsSymbolCollection = SymbolDataCollection()
        self.unit_delta_test_symbol = 'tud'
        self.unitDeltaTestsSymbolOne = self.unitDeltaTestsSymbolCollection.addSymbolToCollection(self.unit_delta_test_symbol)
        self.tud_span_code = 'tud_span'
        self.unitDeltaTestsSymbolOne.initializeSpanByCode(self.tud_span_code)
        self.unit_label_one = 'unit_one'
        self.unit_delta_test_list_one = [0.3, 13.4, 0.8]
        self.unit_label_two = 'unit_two'
        self.unit_delta_test_list_two = [2.8, 13.7, 0.9]
        self.unit_label_three = 'unit_three'
        self.unit_delta_test_list_three = [10.9, 14.4, 15.3]
        self.unit_label_four = 'unit_four'
        self.unit_delta_test_list_four = [15.3, 16.3, 17.3]
        self.unit_label_five = 'unit_five'
        self.unit_delta_test_list_five = [37.3, 16.3, 34.1]
        self.unit_dict = {self.unit_label_one : self.unit_delta_test_list_one,
                          self.unit_label_two : self.unit_delta_test_list_two,
                          self.unit_label_three : self.unit_delta_test_list_three,
                          self.unit_label_four : self.unit_delta_test_list_four,
                          self.unit_label_five : self.unit_delta_test_list_five}
        self.get_symbol_span_value_vectors_all_length_list_dict[self.unit_delta_test_symbol] = list()
        for label, list_of_prices in self.unit_dict.items():
            for price in list_of_prices:
                self.unitDeltaTestsSymbolOne.addSpanValueByCode(self.tud_span_code, [label], close_price = price, open_price = price)
                self.get_symbol_span_value_vectors_all_length_list_dict[self.unit_delta_test_symbol].append(price)
        self.tud_span_code_two = 'tud_span_two'
        self.tud_span_two_unit_label_one = 'span_two_unit_one'
        self.tud_span_two_unit_delta_test_list_one = [14.3, 13.4, 115.1]
        self.tud_span_two_unit_label_two = 'span_two_unit_two'
        self.tud_span_two_unit_delta_test_list_two = [32.8, 13.7, 0.9]
        self.unitDeltaTestsSymbolOne.initializeSpanByCode(self.tud_span_code_two)
        self.unit_dict_two = {self.tud_span_two_unit_label_one : self.tud_span_two_unit_delta_test_list_one,
                              self.tud_span_two_unit_label_two : self.tud_span_two_unit_delta_test_list_two}
        for label, list_of_prices in self.unit_dict_two.items():
            for price in list_of_prices:
                self.unitDeltaTestsSymbolOne.addSpanValueByCode(self.tud_span_code_two, [label], close_price = price, open_price = price)

        self.unit_delta_test_symbol_two = 'tud_two'
        self.unitDeltaTestsSymbolTwo = self.unitDeltaTestsSymbolCollection.addSymbolToCollection(self.unit_delta_test_symbol_two)
        self.unitDeltaTestsSymbolTwo.initializeSpanByCode(self.tud_span_code)
        self.unitDeltaTestsSymbolTwo.initializeSpanByCode(self.tud_span_code_two)
        self.unit_delta_test_list_one_two = [2.5, 6.7, 4.5]
        self.unit_delta_test_list_two_two = [6.7, 7.6, 6.9]
        self.unit_delta_test_list_three_two = [7.6, 7.8, 6.6]
        self.unit_delta_test_list_four_two = [12.4, 23.4, 6.6]
        self.unit_delta_test_list_five_two = [0.2, 0.5, 0.9]
        self.unit_dict_two = {self.unit_label_one : self.unit_delta_test_list_one_two,
                          self.unit_label_two : self.unit_delta_test_list_two_two,
                          self.unit_label_three : self.unit_delta_test_list_three_two,
                          self.unit_label_four : self.unit_delta_test_list_four_two,
                          self.unit_label_five : self.unit_delta_test_list_five_two}
        self.get_symbol_span_value_vectors_all_length_list_dict[self.unit_delta_test_symbol_two] = list()
        for label, list_of_prices in self.unit_dict_two.items():
            for price in list_of_prices:
                self.unitDeltaTestsSymbolTwo.addSpanValueByCode(self.tud_span_code, [label], close_price = price, open_price = price)
                self.get_symbol_span_value_vectors_all_length_list_dict[self.unit_delta_test_symbol_two].append(price)

        self.tud_span_two_unit_delta_test_list_one_two = [10.5, 8.5, 5.4]
        self.tud_span_two_unit_delta_test_list_two_two = [5.5, 6.5, 11.9]
        self.unit_dict_two_two = {self.tud_span_two_unit_label_one : self.tud_span_two_unit_delta_test_list_one_two,
                                    self.tud_span_two_unit_label_two : self.tud_span_two_unit_delta_test_list_two_two}
        for label, list_of_prices in self.unit_dict_two_two.items():
            for price in list_of_prices:
                self.unitDeltaTestsSymbolTwo.addSpanValueByCode(self.tud_span_code_two, [label], close_price = price, open_price = price)

        self.unit_delta_test_symbol_three = 'tud_three'
        self.unitDeltaTestsSymbolThree = self.unitDeltaTestsSymbolCollection.addSymbolToCollection(self.unit_delta_test_symbol_three)
        self.unitDeltaTestsSymbolThree.initializeSpanByCode(self.tud_span_code)
        self.unitDeltaTestsSymbolThree.initializeSpanByCode(self.tud_span_code_two)
        self.unit_delta_test_list_one_three = [12.4, 15.6, 14.5]
        self.unit_delta_test_list_two_three = [16.7, 17.6, 16.9]
        self.unit_delta_test_list_three_three = [10.1, 11.3, 12.5]
        self.unit_delta_test_list_four_three = [5.6, 7.8, 5.5]
        self.unit_delta_test_list_five_three = [3.4, 4.5, 4.0]
        self.unit_dict_three = {self.unit_label_one : self.unit_delta_test_list_one_three,
                              self.unit_label_two : self.unit_delta_test_list_two_three,
                              self.unit_label_three : self.unit_delta_test_list_three_three,
                              self.unit_label_four : self.unit_delta_test_list_four_three,
                              self.unit_label_five : self.unit_delta_test_list_five_three}
        self.get_symbol_span_value_vectors_all_length_list_dict[self.unit_delta_test_symbol_three] = list()
        for label, list_of_prices in self.unit_dict_three.items():
            for price in list_of_prices:
                self.unitDeltaTestsSymbolThree.addSpanValueByCode(self.tud_span_code, [label], close_price = price, open_price = price)
                self.get_symbol_span_value_vectors_all_length_list_dict[self.unit_delta_test_symbol_three].append(price)

        self.tud_span_two_unit_delta_test_list_one_three = [8.8, 8.9, 9.4]
        self.tud_span_two_unit_delta_test_list_two_three = [4.5, 5.5, 4.0]
        self.unit_dict_two_three = {self.tud_span_two_unit_label_one : self.tud_span_two_unit_delta_test_list_one_three,
                                    self.tud_span_two_unit_label_two : self.tud_span_two_unit_delta_test_list_two_three}
        for label, list_of_prices in self.unit_dict_two_three.items():
            for price in list_of_prices:
                self.unitDeltaTestsSymbolThree.addSpanValueByCode(self.tud_span_code_two, [label], close_price = price, open_price = price)
        self.expected_sorted_max_span_delta_ratio = OrderedDict()
        self.expected_sorted_max_span_delta_ratio[self.unit_delta_test_symbol] = -3.0454545454545454
        self.expected_sorted_max_span_delta_ratio[self.unit_delta_test_symbol_three] = -2
        self.expected_sorted_max_span_delta_ratio[self.unit_delta_test_symbol_two] = 0.7000000000000002
        self.expected_sorted_max_span_delta_percentage_ratio = OrderedDict()
        self.expected_sorted_max_span_delta_percentage_ratio[self.unit_delta_test_symbol_three] = -2.2954545454545454
        self.expected_sorted_max_span_delta_percentage_ratio[self.unit_delta_test_symbol] = -0.5622377622377622
        self.expected_sorted_max_span_delta_percentage_ratio[self.unit_delta_test_symbol_two] = 0.038095238095238106
        self.expected_sorted_min_span_delta_ratio = OrderedDict()
        self.expected_sorted_min_span_delta_ratio[self.unit_delta_test_symbol_two] = -0.24137931034482762
        self.expected_sorted_min_span_delta_ratio[self.unit_delta_test_symbol] = 4.187500000000005
        self.expected_sorted_min_span_delta_ratio[self.unit_delta_test_symbol_three] = 48.00000000000018
        self.expected_sorted_min_span_delta_percentage_ratio = OrderedDict()
        self.expected_sorted_min_span_delta_percentage_ratio[self.unit_delta_test_symbol_two] = -0.28505747126436787
        self.expected_sorted_min_span_delta_percentage_ratio[self.unit_delta_test_symbol] = 1.3809348546190652
        self.expected_sorted_min_span_delta_percentage_ratio[self.unit_delta_test_symbol_three] = 30.545454545454657

        self.symbol_span_value_vectors_test_span = 'symbol_span_value_vectors_test'
        self.spanValueVectorsTestSymbol = self.unitDeltaTestsSymbolCollection.addSymbolToCollection(self.symbol_span_value_vectors_test_span)
        self.spanValueVectorsTestSymbol.initializeSpanByCode(self.tud_span_code)
        self.spanValueVectorsTestSymbol.initializeSpanByCode(self.tud_span_code_two)
        self.symbol_span_value_vectors_test_open_prices = [1.0, 2.0, 3.0, 4.0]
        self.symbol_span_value_vectors_test_close_prices = [5.0, 6.0, 7.0]

        self.get_symbol_span_value_vectors_open_price_all_length_list_dict = copy.deepcopy(self.get_symbol_span_value_vectors_all_length_list_dict)
        self.get_symbol_span_value_vectors_close_price_all_length_list_dict = copy.deepcopy(self.get_symbol_span_value_vectors_all_length_list_dict)
        self.get_symbol_span_value_vectors_open_price_max_length_list_dict = copy.deepcopy(self.get_symbol_span_value_vectors_all_length_list_dict)
        self.get_symbol_span_value_vectors_close_price_max_length_list_dict = copy.deepcopy(self.get_symbol_span_value_vectors_all_length_list_dict)

        self.get_symbol_span_value_vectors_open_price_all_length_list_dict[self.symbol_span_value_vectors_test_span] = list()
        self.get_symbol_span_value_vectors_close_price_all_length_list_dict[self.symbol_span_value_vectors_test_span] = list()

        for price in self.symbol_span_value_vectors_test_open_prices:
            self.spanValueVectorsTestSymbol.addSpanValueByCode(self.tud_span_code, [], open_price = price)
            self.get_symbol_span_value_vectors_open_price_all_length_list_dict[self.symbol_span_value_vectors_test_span].append(price)

        for price in self.symbol_span_value_vectors_test_close_prices:
            self.spanValueVectorsTestSymbol.addSpanValueByCode(self.tud_span_code, [], close_price = price)
            self.get_symbol_span_value_vectors_close_price_all_length_list_dict[self.symbol_span_value_vectors_test_span].append(price)
コード例 #5
0
class TestSymbolDataCollection(unittest.TestCase):

    def tearDown(self):
        self.unitDeltaTestsSymbol = None

    def setUp(self):
        self.get_symbol_span_value_vectors_all_length_list_dict = {}

        self.unitDeltaTestsSymbolCollection = SymbolDataCollection()
        self.unit_delta_test_symbol = 'tud'
        self.unitDeltaTestsSymbolOne = self.unitDeltaTestsSymbolCollection.addSymbolToCollection(self.unit_delta_test_symbol)
        self.tud_span_code = 'tud_span'
        self.unitDeltaTestsSymbolOne.initializeSpanByCode(self.tud_span_code)
        self.unit_label_one = 'unit_one'
        self.unit_delta_test_list_one = [0.3, 13.4, 0.8]
        self.unit_label_two = 'unit_two'
        self.unit_delta_test_list_two = [2.8, 13.7, 0.9]
        self.unit_label_three = 'unit_three'
        self.unit_delta_test_list_three = [10.9, 14.4, 15.3]
        self.unit_label_four = 'unit_four'
        self.unit_delta_test_list_four = [15.3, 16.3, 17.3]
        self.unit_label_five = 'unit_five'
        self.unit_delta_test_list_five = [37.3, 16.3, 34.1]
        self.unit_dict = {self.unit_label_one : self.unit_delta_test_list_one,
                          self.unit_label_two : self.unit_delta_test_list_two,
                          self.unit_label_three : self.unit_delta_test_list_three,
                          self.unit_label_four : self.unit_delta_test_list_four,
                          self.unit_label_five : self.unit_delta_test_list_five}
        self.get_symbol_span_value_vectors_all_length_list_dict[self.unit_delta_test_symbol] = list()
        for label, list_of_prices in self.unit_dict.items():
            for price in list_of_prices:
                self.unitDeltaTestsSymbolOne.addSpanValueByCode(self.tud_span_code, [label], close_price = price, open_price = price)
                self.get_symbol_span_value_vectors_all_length_list_dict[self.unit_delta_test_symbol].append(price)
        self.tud_span_code_two = 'tud_span_two'
        self.tud_span_two_unit_label_one = 'span_two_unit_one'
        self.tud_span_two_unit_delta_test_list_one = [14.3, 13.4, 115.1]
        self.tud_span_two_unit_label_two = 'span_two_unit_two'
        self.tud_span_two_unit_delta_test_list_two = [32.8, 13.7, 0.9]
        self.unitDeltaTestsSymbolOne.initializeSpanByCode(self.tud_span_code_two)
        self.unit_dict_two = {self.tud_span_two_unit_label_one : self.tud_span_two_unit_delta_test_list_one,
                              self.tud_span_two_unit_label_two : self.tud_span_two_unit_delta_test_list_two}
        for label, list_of_prices in self.unit_dict_two.items():
            for price in list_of_prices:
                self.unitDeltaTestsSymbolOne.addSpanValueByCode(self.tud_span_code_two, [label], close_price = price, open_price = price)

        self.unit_delta_test_symbol_two = 'tud_two'
        self.unitDeltaTestsSymbolTwo = self.unitDeltaTestsSymbolCollection.addSymbolToCollection(self.unit_delta_test_symbol_two)
        self.unitDeltaTestsSymbolTwo.initializeSpanByCode(self.tud_span_code)
        self.unitDeltaTestsSymbolTwo.initializeSpanByCode(self.tud_span_code_two)
        self.unit_delta_test_list_one_two = [2.5, 6.7, 4.5]
        self.unit_delta_test_list_two_two = [6.7, 7.6, 6.9]
        self.unit_delta_test_list_three_two = [7.6, 7.8, 6.6]
        self.unit_delta_test_list_four_two = [12.4, 23.4, 6.6]
        self.unit_delta_test_list_five_two = [0.2, 0.5, 0.9]
        self.unit_dict_two = {self.unit_label_one : self.unit_delta_test_list_one_two,
                          self.unit_label_two : self.unit_delta_test_list_two_two,
                          self.unit_label_three : self.unit_delta_test_list_three_two,
                          self.unit_label_four : self.unit_delta_test_list_four_two,
                          self.unit_label_five : self.unit_delta_test_list_five_two}
        self.get_symbol_span_value_vectors_all_length_list_dict[self.unit_delta_test_symbol_two] = list()
        for label, list_of_prices in self.unit_dict_two.items():
            for price in list_of_prices:
                self.unitDeltaTestsSymbolTwo.addSpanValueByCode(self.tud_span_code, [label], close_price = price, open_price = price)
                self.get_symbol_span_value_vectors_all_length_list_dict[self.unit_delta_test_symbol_two].append(price)

        self.tud_span_two_unit_delta_test_list_one_two = [10.5, 8.5, 5.4]
        self.tud_span_two_unit_delta_test_list_two_two = [5.5, 6.5, 11.9]
        self.unit_dict_two_two = {self.tud_span_two_unit_label_one : self.tud_span_two_unit_delta_test_list_one_two,
                                    self.tud_span_two_unit_label_two : self.tud_span_two_unit_delta_test_list_two_two}
        for label, list_of_prices in self.unit_dict_two_two.items():
            for price in list_of_prices:
                self.unitDeltaTestsSymbolTwo.addSpanValueByCode(self.tud_span_code_two, [label], close_price = price, open_price = price)

        self.unit_delta_test_symbol_three = 'tud_three'
        self.unitDeltaTestsSymbolThree = self.unitDeltaTestsSymbolCollection.addSymbolToCollection(self.unit_delta_test_symbol_three)
        self.unitDeltaTestsSymbolThree.initializeSpanByCode(self.tud_span_code)
        self.unitDeltaTestsSymbolThree.initializeSpanByCode(self.tud_span_code_two)
        self.unit_delta_test_list_one_three = [12.4, 15.6, 14.5]
        self.unit_delta_test_list_two_three = [16.7, 17.6, 16.9]
        self.unit_delta_test_list_three_three = [10.1, 11.3, 12.5]
        self.unit_delta_test_list_four_three = [5.6, 7.8, 5.5]
        self.unit_delta_test_list_five_three = [3.4, 4.5, 4.0]
        self.unit_dict_three = {self.unit_label_one : self.unit_delta_test_list_one_three,
                              self.unit_label_two : self.unit_delta_test_list_two_three,
                              self.unit_label_three : self.unit_delta_test_list_three_three,
                              self.unit_label_four : self.unit_delta_test_list_four_three,
                              self.unit_label_five : self.unit_delta_test_list_five_three}
        self.get_symbol_span_value_vectors_all_length_list_dict[self.unit_delta_test_symbol_three] = list()
        for label, list_of_prices in self.unit_dict_three.items():
            for price in list_of_prices:
                self.unitDeltaTestsSymbolThree.addSpanValueByCode(self.tud_span_code, [label], close_price = price, open_price = price)
                self.get_symbol_span_value_vectors_all_length_list_dict[self.unit_delta_test_symbol_three].append(price)

        self.tud_span_two_unit_delta_test_list_one_three = [8.8, 8.9, 9.4]
        self.tud_span_two_unit_delta_test_list_two_three = [4.5, 5.5, 4.0]
        self.unit_dict_two_three = {self.tud_span_two_unit_label_one : self.tud_span_two_unit_delta_test_list_one_three,
                                    self.tud_span_two_unit_label_two : self.tud_span_two_unit_delta_test_list_two_three}
        for label, list_of_prices in self.unit_dict_two_three.items():
            for price in list_of_prices:
                self.unitDeltaTestsSymbolThree.addSpanValueByCode(self.tud_span_code_two, [label], close_price = price, open_price = price)
        self.expected_sorted_max_span_delta_ratio = OrderedDict()
        self.expected_sorted_max_span_delta_ratio[self.unit_delta_test_symbol] = -3.0454545454545454
        self.expected_sorted_max_span_delta_ratio[self.unit_delta_test_symbol_three] = -2
        self.expected_sorted_max_span_delta_ratio[self.unit_delta_test_symbol_two] = 0.7000000000000002
        self.expected_sorted_max_span_delta_percentage_ratio = OrderedDict()
        self.expected_sorted_max_span_delta_percentage_ratio[self.unit_delta_test_symbol_three] = -2.2954545454545454
        self.expected_sorted_max_span_delta_percentage_ratio[self.unit_delta_test_symbol] = -0.5622377622377622
        self.expected_sorted_max_span_delta_percentage_ratio[self.unit_delta_test_symbol_two] = 0.038095238095238106
        self.expected_sorted_min_span_delta_ratio = OrderedDict()
        self.expected_sorted_min_span_delta_ratio[self.unit_delta_test_symbol_two] = -0.24137931034482762
        self.expected_sorted_min_span_delta_ratio[self.unit_delta_test_symbol] = 4.187500000000005
        self.expected_sorted_min_span_delta_ratio[self.unit_delta_test_symbol_three] = 48.00000000000018
        self.expected_sorted_min_span_delta_percentage_ratio = OrderedDict()
        self.expected_sorted_min_span_delta_percentage_ratio[self.unit_delta_test_symbol_two] = -0.28505747126436787
        self.expected_sorted_min_span_delta_percentage_ratio[self.unit_delta_test_symbol] = 1.3809348546190652
        self.expected_sorted_min_span_delta_percentage_ratio[self.unit_delta_test_symbol_three] = 30.545454545454657

        self.symbol_span_value_vectors_test_span = 'symbol_span_value_vectors_test'
        self.spanValueVectorsTestSymbol = self.unitDeltaTestsSymbolCollection.addSymbolToCollection(self.symbol_span_value_vectors_test_span)
        self.spanValueVectorsTestSymbol.initializeSpanByCode(self.tud_span_code)
        self.spanValueVectorsTestSymbol.initializeSpanByCode(self.tud_span_code_two)
        self.symbol_span_value_vectors_test_open_prices = [1.0, 2.0, 3.0, 4.0]
        self.symbol_span_value_vectors_test_close_prices = [5.0, 6.0, 7.0]

        self.get_symbol_span_value_vectors_open_price_all_length_list_dict = copy.deepcopy(self.get_symbol_span_value_vectors_all_length_list_dict)
        self.get_symbol_span_value_vectors_close_price_all_length_list_dict = copy.deepcopy(self.get_symbol_span_value_vectors_all_length_list_dict)
        self.get_symbol_span_value_vectors_open_price_max_length_list_dict = copy.deepcopy(self.get_symbol_span_value_vectors_all_length_list_dict)
        self.get_symbol_span_value_vectors_close_price_max_length_list_dict = copy.deepcopy(self.get_symbol_span_value_vectors_all_length_list_dict)

        self.get_symbol_span_value_vectors_open_price_all_length_list_dict[self.symbol_span_value_vectors_test_span] = list()
        self.get_symbol_span_value_vectors_close_price_all_length_list_dict[self.symbol_span_value_vectors_test_span] = list()

        for price in self.symbol_span_value_vectors_test_open_prices:
            self.spanValueVectorsTestSymbol.addSpanValueByCode(self.tud_span_code, [], open_price = price)
            self.get_symbol_span_value_vectors_open_price_all_length_list_dict[self.symbol_span_value_vectors_test_span].append(price)

        for price in self.symbol_span_value_vectors_test_close_prices:
            self.spanValueVectorsTestSymbol.addSpanValueByCode(self.tud_span_code, [], close_price = price)
            self.get_symbol_span_value_vectors_close_price_all_length_list_dict[self.symbol_span_value_vectors_test_span].append(price)

    def test_getSymbolSpanValueVectors(self):
        test_all_open_price_values_list_dict = self.unitDeltaTestsSymbolCollection.getSymbolSpanValueVectors(self.tud_span_code, 'open_price', only_vectors_at_max_length = False)
        test_all_open_price_values_list_value = test_all_open_price_values_list_dict['value_vectors']
        test_all_open_price_values_list = test_all_open_price_values_list_dict['symbols_list']
        index = 0
        for symbol in test_all_open_price_values_list:
            test_value_vector = test_all_open_price_values_list_value[index]
            expected_value_vector = self.get_symbol_span_value_vectors_open_price_all_length_list_dict[symbol]
            self.assertEqual(test_value_vector, expected_value_vector)
            index += 1

        test_all_close_price_values_list_dict = self.unitDeltaTestsSymbolCollection.getSymbolSpanValueVectors(self.tud_span_code, 'close_price', only_vectors_at_max_length = False)
        test_all_close_price_values_list_value = test_all_close_price_values_list_dict['value_vectors']
        test_all_close_price_values_list = test_all_close_price_values_list_dict['symbols_list']
        index = 0
        for symbol in test_all_close_price_values_list:
            test_value_vector = test_all_close_price_values_list_value[index]
            expected_value_vector = self.get_symbol_span_value_vectors_close_price_all_length_list_dict[symbol]
            self.assertEqual(test_value_vector, expected_value_vector)
            index += 1

        test_max_open_price_values_list_dict = self.unitDeltaTestsSymbolCollection.getSymbolSpanValueVectors(self.tud_span_code, 'open_price', only_vectors_at_max_length = True)
        test_max_open_price_values_list_value = test_max_open_price_values_list_dict['value_vectors']
        test_max_open_price_values_list = test_max_open_price_values_list_dict['symbols_list']
        index = 0
        for symbol in test_max_open_price_values_list:
            test_value_vector = test_max_open_price_values_list_value[index]
            expected_value_vector = self.get_symbol_span_value_vectors_open_price_max_length_list_dict[symbol]
            self.assertEqual(test_value_vector, expected_value_vector)
            index += 1

        test_max_close_price_values_list_dict = self.unitDeltaTestsSymbolCollection.getSymbolSpanValueVectors(self.tud_span_code, 'close_price', only_vectors_at_max_length = True)
        test_max_close_price_values_list_value = test_max_close_price_values_list_dict['value_vectors']
        test_max_close_price_values_list = test_max_close_price_values_list_dict['symbols_list']
        index = 0
        for symbol in test_max_close_price_values_list:
            test_value_vector = test_max_close_price_values_list_value[index]
            expected_value_vector = self.get_symbol_span_value_vectors_close_price_max_length_list_dict[symbol]
            self.assertEqual(test_value_vector, expected_value_vector)
            index += 1

    def test_getSortedSpanDeltaValueToSpanMaxDeltaRatios(self):
        test_sorted_max_span_delta_ratio = self.unitDeltaTestsSymbolCollection.getSortedSpanDeltaValueToSpanMaxDeltaRatios(self.tud_span_code_two, self.tud_span_code)
        self.assertEqual(test_sorted_max_span_delta_ratio, self.expected_sorted_max_span_delta_ratio)
        test_sorted_max_span_delta_percentage_ratio = self.unitDeltaTestsSymbolCollection.getSortedSpanDeltaValueToSpanMaxDeltaRatios(self.tud_span_code_two, self.tud_span_code, get_percentage = True)
        self.assertEqual(test_sorted_max_span_delta_percentage_ratio, self.expected_sorted_max_span_delta_percentage_ratio)

    def test_getSortedSpanDeltaValueToSpanMinDeltaRatios(self):
        test_sorted_min_span_delta_ratio = self.unitDeltaTestsSymbolCollection.getSortedSpanDeltaValueToSpanMinDeltaRatios(self.tud_span_code_two, self.tud_span_code)
        self.assertEqual(test_sorted_min_span_delta_ratio, self.expected_sorted_min_span_delta_ratio)
        test_sorted_min_span_delta_percentage_ratio = self.unitDeltaTestsSymbolCollection.getSortedSpanDeltaValueToSpanMinDeltaRatios(self.tud_span_code_two, self.tud_span_code, get_percentage = True)
        self.assertEqual(test_sorted_min_span_delta_percentage_ratio, self.expected_sorted_min_span_delta_percentage_ratio)

    def test_isSymbolInCollection(self):
        expected_symbol = 'A'
        newCollection = SymbolDataCollection()
        is_symbol_in_collection = newCollection.isSymbolInCollection(expected_symbol)
        self.assertFalse(is_symbol_in_collection, 'SymbolDataCollection did not return False for a symbol not yet in the collection, returned {0}'.format(is_symbol_in_collection))
        other_expected_symbol = 'B'
        newCollection.addSymbolToCollection(expected_symbol)
        is_other_symbol_in_collection = newCollection.isSymbolInCollection(other_expected_symbol)
        self.assertFalse(is_other_symbol_in_collection, 'Collection did not return False for a symbol not yet in the collection after a different symbol had been added, returned {0}'.format(is_other_symbol_in_collection))
        testSymbolData = newCollection.getSymbolData(expected_symbol)
        self.assertIsInstance(testSymbolData, SymbolData, 'An object of type SymbolData was not returned for a symbol which should be in the SymbolDataCollection, returned was {0}'.format(testSymbolData))
        test_symbol_from_collection = testSymbolData.symbol
        self.assertEqual(expected_symbol, test_symbol_from_collection, 'The symbol {0} from a SymbolData object returned from a SymbolDataCollection did not match the symbol passed into newCollection.getSymbolData() {1}'.format(test_symbol_from_collection, expected_symbol))
        newCollection.addSymbolToCollection(other_expected_symbol)
        otherSymbolData = newCollection.getSymbolData(other_expected_symbol)
        other_symbol_from_data = otherSymbolData.symbol
        self.assertEqual(other_symbol_from_data, other_expected_symbol, 'The symbol {0} from another SymbolData object returned from a SymbolDataCollection did not match the other symbol passed into newCollection.getSymbolData() {1}'.format(other_symbol_from_data, other_expected_symbol))

    def test_getSortedSpanDeltaValuesByCode(self):
        expected_sorted_by_delta_dict = OrderedDict()
        expected_sorted_by_delta_dict['B'] = -9.1
        expected_sorted_by_delta_dict['C'] = -3.5
        expected_sorted_by_delta_dict['A'] = 0.9
        expected_sorted_by_delta_dict['D'] = 13.0
        expected_sorted_by_delta_percentages_dict = OrderedDict()
        expected_sorted_by_delta_percentages_dict['B'] = -15.166666666666666
        expected_sorted_by_delta_percentages_dict['C'] = -0.6140350877192983
        expected_sorted_by_delta_percentages_dict['A'] = 1.5
        expected_sorted_by_delta_percentages_dict['D'] = 1.5116279069767442
        span_code = 'test_sorted_span_deltas'
        test_unit_label_list = ['test_unit_code']
        other_unit_label_list = ['some_other_label']
        newCollection = SymbolDataCollection()
        testSymbolDataA = newCollection.addSymbolToCollection('A')
        testSymbolDataA.initializeSpanByCode(span_code)
        testSymbolDataA.addSpanValueByCode(span_code, test_unit_label_list, 1.0, 0.6)
        testSymbolDataA.addSpanValueByCode(span_code, test_unit_label_list, 1.5, 1.0)
        testSymbolDataA.addSpanValueByCode(span_code, other_unit_label_list, 1.4, 1.5)
        testSymbolDataB = newCollection.addSymbolToCollection('B')
        testSymbolDataB.initializeSpanByCode(span_code)
        testSymbolDataB.addSpanValueByCode(span_code, test_unit_label_list, -4.0, 0.6)
        testSymbolDataB.addSpanValueByCode(span_code, test_unit_label_list, -8.5, 4.0)
        testSymbolDataB.addSpanValueByCode(span_code, other_unit_label_list, 4.5, -8.5)
        testSymbolDataC = newCollection.addSymbolToCollection('C')
        testSymbolDataC.initializeSpanByCode(span_code)
        testSymbolDataC.addSpanValueByCode(span_code, test_unit_label_list, 1.2, 5.7)
        testSymbolDataC.addSpanValueByCode(span_code, test_unit_label_list, 2.2, 1.2)
        testSymbolDataC.addSpanValueByCode(span_code, other_unit_label_list, 1.2, 2.2)
        testSymbolDataD = newCollection.addSymbolToCollection('D')
        testSymbolDataD.initializeSpanByCode(span_code)
        testSymbolDataD.addSpanValueByCode(span_code, test_unit_label_list, 4.0, -8.6)
        testSymbolDataD.addSpanValueByCode(span_code, test_unit_label_list, 4.4, 4.0)
        testSymbolDataD.addSpanValueByCode(span_code, other_unit_label_list, 2.3, 4.4)
        testOtherLabelOnlySymbolData = newCollection.addSymbolToCollection('E')
        testOtherLabelOnlySymbolData.initializeSpanByCode(span_code)
        testOtherLabelOnlySymbolData.addSpanValueByCode(span_code, other_unit_label_list, 3.4, 5.9)
        sorted_span_delta_values_by_code_dict = newCollection.getSortedSpanDeltaValuesByCode(span_code, 'test_unit_code')
        self.assertEqual(expected_sorted_by_delta_dict, sorted_span_delta_values_by_code_dict, 'test_getSortedDeltaValuesByCode failed to return the expected sorted dictionary, returned {0}\nexpected: {1}'.format(sorted_span_delta_values_by_code_dict, expected_sorted_by_delta_dict))
        # Test delta percentages
        sorted_span_delta_percentage_values_by_code_dict = newCollection.getSortedSpanDeltaValuesByCode(span_code, 'test_unit_code', get_percentages = True)
        self.assertEqual(expected_sorted_by_delta_percentages_dict, sorted_span_delta_percentage_values_by_code_dict)

    def test_getSortedTodayPricePercentageOffSpanAveragesByCode(self):
        test_span_code = 'percentage_price_off_span_average_test'
        testCollection = SymbolDataCollection()
        first_today_price = 2.3
        first_span_prices = [5.7, 8.9, 7.7]
        second_today_price = 3.4
        second_span_prices = [2.3, 2.7, 3.3]
        third_today_price = 1.2
        third_span_prices = [4.6, 2.7, 5.6]
        fourth_today_price = 3.4
        fourth_span_prices = [-2.0, 0.0, 2.0]
        firstSymbolData = testCollection.addSymbolToCollection('A')
        firstSymbolData.setTodayPrice(first_today_price)
        firstSymbolData.initializeSpanByCode(test_span_code)
        unit_label_prefix = 'units_'
        i = 0
        for price in first_span_prices:
            unit_label_suffix = 'even' if ((i % 2) == 0) else 'odd'
            unit_label = unit_label_prefix + unit_label_suffix
            unit_labels_list = [unit_label, i]
            firstSymbolData.addSpanValueByCode(test_span_code, unit_labels_list, price)
            i += 1
        secondSymbolData = testCollection.addSymbolToCollection('B')
        secondSymbolData.initializeSpanByCode(test_span_code)
        secondSymbolData.setTodayPrice(second_today_price)
        i = 0
        for price in second_span_prices:
            unit_label_suffix = 'even' if ((i % 2) == 0) else 'odd'
            unit_label = unit_label_prefix + unit_label_suffix
            unit_labels_list = [unit_label, i]
            secondSymbolData.addSpanValueByCode(test_span_code, unit_labels_list, price)
            i += 1
        thirdSymbolData = testCollection.addSymbolToCollection('C')
        thirdSymbolData.initializeSpanByCode(test_span_code)
        thirdSymbolData.setTodayPrice(third_today_price)
        i = 0
        for price in third_span_prices:
            unit_label_suffix = 'even' if ((i % 2) == 0) else 'odd'
            unit_label = unit_label_prefix + unit_label_suffix
            unit_labels_list = [unit_label, i]
            thirdSymbolData.addSpanValueByCode(test_span_code, unit_labels_list, price)
            i += 1

        testNoneSymbolData = testCollection.addSymbolToCollection('D')
        testNoneSymbolData.initializeSpanByCode(test_span_code)
        testNoneSymbolData.addSpanValueByCode(test_span_code, 'irrelevant_label', 12.3)
        testNoneSymbolData.setTodayPrice(13.3)

        test_price_off_average_values_by_symbol = testCollection.getSortedTodayPricePercentageOffSpanAveragesByCode(test_span_code)
        expected_price_off_average_values_by_symbol = OrderedDict()
        expected_price_off_average_values_by_symbol['C'] = -0.7209302325581395
        expected_price_off_average_values_by_symbol['A'] = -0.6905829596412556
        expected_price_off_average_values_by_symbol['D'] = 0.08130081300813008
        expected_price_off_average_values_by_symbol['B'] = 0.2289156626506022
        self.assertEqual(test_price_off_average_values_by_symbol, expected_price_off_average_values_by_symbol, 'The expected_price_off_average_values_by_symbol was {0}, but {1} was returned while testing getting the percentage delta of today price off of span average'.format(expected_price_off_average_values_by_symbol, test_price_off_average_values_by_symbol))
        price_threshold = 2.0
        test_sorted_dictionary_of_values_above_price_threshold = testCollection.getSortedDictionaryOfValuesAboveTodayPriceThreshold(test_price_off_average_values_by_symbol, price_threshold)
        expected_price_off_average_values_by_symbol_above_threshold = OrderedDict()
        expected_price_off_average_values_by_symbol_above_threshold['A'] = -0.6905829596412556
        expected_price_off_average_values_by_symbol_above_threshold['D'] = 0.08130081300813008
        expected_price_off_average_values_by_symbol_above_threshold['B'] = 0.2289156626506022
        self.assertEqual(test_sorted_dictionary_of_values_above_price_threshold, expected_price_off_average_values_by_symbol_above_threshold, 'The expected_price_off_average_values_by_symbol_above_threshold was {0} but {1} was returned'.format(expected_price_off_average_values_by_symbol_above_threshold, test_sorted_dictionary_of_values_above_price_threshold))
        # Test for even/odd unit labels
        even_units_label = unit_label_prefix + 'even'
        odd_units_label = unit_label_prefix + 'odd'
        test_price_off_even_average_values_by_symbol = testCollection.getSortedTodayPricePercentageOffSpanAveragesByCode(test_span_code, even_units_label)
        test_price_off_odd_average_values_by_symbol = testCollection.getSortedTodayPricePercentageOffSpanAveragesByCode(test_span_code, odd_units_label)
        expected_price_off_even_average_values = OrderedDict()
        expected_price_off_even_average_values['C'] = -0.7647058823529411
        expected_price_off_even_average_values['A'] = -0.6567164179104478
        expected_price_off_even_average_values['B'] = 0.21428571428571433
        self.assertEqual(expected_price_off_even_average_values, test_price_off_even_average_values_by_symbol)
        expected_price_off_odd_average_values = OrderedDict()
        expected_price_off_odd_average_values['A'] = -0.7415730337078652
        expected_price_off_odd_average_values['C'] = -0.5555555555555556
        expected_price_off_odd_average_values['B'] = 0.25925925925925913
        self.assertEqual(test_price_off_odd_average_values_by_symbol, expected_price_off_odd_average_values)
        test_sorted_dictionary_of_even_values_above_price_threshold = testCollection.getSortedDictionaryOfValuesAboveTodayPriceThreshold(test_price_off_even_average_values_by_symbol, price_threshold)
        expected_price_off_even_average_values_by_symbol_above_threshold = OrderedDict()
        expected_price_off_even_average_values_by_symbol_above_threshold['A'] = -0.6567164179104478
        expected_price_off_even_average_values_by_symbol_above_threshold['B'] = 0.21428571428571433
        self.assertEqual(expected_price_off_even_average_values_by_symbol_above_threshold, test_sorted_dictionary_of_even_values_above_price_threshold)
        test_sorted_dictionary_of_odd_values_above_price_threshold = testCollection.getSortedDictionaryOfValuesAboveTodayPriceThreshold(test_price_off_odd_average_values_by_symbol, price_threshold)
        expected_price_off_odd_average_values_by_symbol_above_threshold = OrderedDict()
        expected_price_off_odd_average_values_by_symbol_above_threshold['A'] = -0.7415730337078652
        expected_price_off_odd_average_values_by_symbol_above_threshold['B'] = 0.25925925925925913
        self.assertEqual(expected_price_off_odd_average_values_by_symbol_above_threshold, test_sorted_dictionary_of_odd_values_above_price_threshold)