def calculateValues(self): """TODO: Describe the method here """ if not self.influences_acquisition: return 0 if self.sentiment_feed == 'Manual': R_SENTIMENTS_SCALE = getReversedTuple( tuple_data=CHOICES_SENTIMENTS_SCALE) R_SENTIMENTS_WEIGHT_SCALE = getReversedTuple( tuple_data=CHOICES_SENTIMENTS_WEIGHT_SCALE) value = R_SENTIMENTS_SCALE[self.external_sentiment] * R_SENTIMENTS_WEIGHT_SCALE[self.external_sentiment_weight] + \ R_SENTIMENTS_SCALE[self.market_sentiment] * R_SENTIMENTS_WEIGHT_SCALE[self.market_sentiment_weight] + \ R_SENTIMENTS_SCALE[self.sector_sentiment] * R_SENTIMENTS_WEIGHT_SCALE[self.sector_sentiment_weight] + \ R_SENTIMENTS_SCALE[self.equity_sentiment] * R_SENTIMENTS_WEIGHT_SCALE[self.equity_sentiment_weight] return value elif self.sentiment_feed == 'Automatic': if self.composition_calc == 'Random': return self.calculateAnyRandomValue() elif self.composition_calc == 'A1': return 0 if self.pair_robot == None else self.pair_robot.calculateSMA( use_transition=False) elif self.composition_calc == 'A2': return 0 if self.pair_robot == None else self.pair_robot.calculateEMA( use_transition=False) elif self.composition_calc == 'A3': return self.calculateAlternateRandomValue() elif self.composition_calc == 'A4': return self.calculateKnowledgeBasedValue() return 0
def testReverseTuplesTest(self): R_CHOICES_BLACKOUT_WINDOW = getReversedTuple( tuple_data=CHOICES_BLACKOUT_WINDOW) one = R_CHOICES_BLACKOUT_WINDOW['one'] five = R_CHOICES_BLACKOUT_WINDOW['one'] self.assertEqual(one, 1) self.assertEqual(five, 5)
def calculateValues(self): #Reverse the tuple (1,'key') ==> ('key',1) to simplify indexed access. if not self.influences_acquisition: return 0 R_SENTIMENTS_SCALE = getReversedTuple( tuple_data=CHOICES_SENTIMENTS_SCALE) R_SENTIMENTS_WEIGHT_SCALE = getReversedTuple( tuple_data=CHOICES_SENTIMENTS_WEIGHT_SCALE) value = R_SENTIMENTS_SCALE[self.external_sentiment] * R_SENTIMENTS_WEIGHT_SCALE[self.external_sentiment_weight] + \ R_SENTIMENTS_SCALE[self.market_sentiment] * R_SENTIMENTS_WEIGHT_SCALE[self.market_sentiment_weight] + \ R_SENTIMENTS_SCALE[self.sector_sentiment] * R_SENTIMENTS_WEIGHT_SCALE[self.sector_sentiment_weight] + \ R_SENTIMENTS_SCALE[self.equity_sentiment] * R_SENTIMENTS_WEIGHT_SCALE[self.equity_sentiment_weight] return value
def isLocal(self): R_CHOICES_BROKERAGE_PAPER = getReversedTuple(tuple_data=CHOICES_BROKERAGE_PAPER) value = R_CHOICES_BROKERAGE_PAPER[self.brokerage_type] return value == 'Local Account'
def isETradeRetirement(self): R_CHOICES_BROKERAGE_PAPER = getReversedTuple(tuple_data=CHOICES_BROKERAGE_PAPER) value = R_CHOICES_BROKERAGE_PAPER[self.brokerage_type] return value == 'eTrade Retirement'
def isAmeritrade(self): R_CHOICES_BROKERAGE_PAPER = getReversedTuple(tuple_data=CHOICES_BROKERAGE_PAPER) value = R_CHOICES_BROKERAGE_PAPER[self.brokerage_type] return value == 'Ameritrade'
def isBatchamStrategy(self): R_CHOICES_STRATEGY_CATEGORY = getReversedTuple( tuple_data=CHOICES_STRATEGY_CATEGORY) value = R_CHOICES_STRATEGY_CATEGORY[self.strategy_category] return value == 'Batcham'