コード例 #1
0
 def getSortedSpanDeltaValuesByCode(self, span_code, unit_code = None, get_percentages = False):
     """
     :param string delta_code:
     :param string|None unit_code:
     :param bool get_percentages:
     :return: OrderedDict
     """
     delta_values_by_symbol = {}
     for symbol, symbolDataInstance in self.symbols_dict.items():  # type: SymbolData
         symbol_span_unit_delta_value = symbolDataInstance.getSpanDeltaByCode(span_code, unit_code, get_percentages)
         if not(symbol_span_unit_delta_value is None):
             delta_values_by_symbol[symbol] = symbol_span_unit_delta_value
     sorted_delta_value_symbols_dictionary = sort_float_dictionary_ascending(delta_values_by_symbol)
     return sorted_delta_value_symbols_dictionary
コード例 #2
0
 def getSortedSpanDeltaValueToSpanMinDeltaRatios(self, span_delta_code, span_min_delta_code, get_percentage = False):
     """
     :param string span_delta_code:
     :param string span_min_delta_code:
     :param bool get_percentage:
     :return: OrderedDict
     """
     span_delta_ratios_by_symbol = {}
     for symbol, symbolDataInstance in self.symbols_dict.items():  # type: SymbolData
         span_min_delta_ratio = symbolDataInstance.getSpanDeltaValueToSpanMinDeltaRatio(span_delta_code, span_min_delta_code, get_percentage)
         if not(span_min_delta_ratio is None):
             span_delta_ratios_by_symbol[symbol] = span_min_delta_ratio
     sorted_span_delta_ratios_by_symbol = sort_float_dictionary_ascending(span_delta_ratios_by_symbol)
     return sorted_span_delta_ratios_by_symbol
コード例 #3
0
 def getSortedTodayPricePercentageOffSpanAveragesByCode(self, span_code, units_label = None):
     """
     :param string span_code:
     :param string|None units_label:
     :return: OrderedDict
     """
     span_today_price_off_average_values_by_symbol = {}
     for symbol, symbolDataInstance in self.symbols_dict.items(): # type: SymbolData
         symbol_average_for_span = symbolDataInstance.getSpanAverageByCode(span_code, units_label)
         today_price_for_symbol = symbolDataInstance.getTodayPrice()
         if ((symbol_average_for_span is None) or (today_price_for_symbol is None)):
             continue
         today_price_delta_off_average = today_price_for_symbol - symbol_average_for_span
         if symbol_average_for_span != 0.0:
             today_price_percentage_off_delta = today_price_delta_off_average / symbol_average_for_span
         else:
             today_price_percentage_off_delta = float("inf")
         span_today_price_off_average_values_by_symbol[symbol] = today_price_percentage_off_delta
     sorted_span_today_price_off_average_values_by_symbol = sort_float_dictionary_ascending(span_today_price_off_average_values_by_symbol)
     return sorted_span_today_price_off_average_values_by_symbol