fix reduce() TypeError in hyperopts

This commit is contained in:
hroff-1902 2019-05-24 23:08:56 +03:00
parent 1a5dbd29e0
commit c3e93e7593
3 changed files with 20 additions and 15 deletions

View File

@ -122,9 +122,10 @@ So let's write the buy strategy using these values:
dataframe['macd'], dataframe['macdsignal'] dataframe['macd'], dataframe['macdsignal']
)) ))
dataframe.loc[ if conditions:
reduce(lambda x, y: x & y, conditions), dataframe.loc[
'buy'] = 1 reduce(lambda x, y: x & y, conditions),
'buy'] = 1
return dataframe return dataframe

View File

@ -70,9 +70,10 @@ class DefaultHyperOpts(IHyperOpt):
dataframe['close'], dataframe['sar'] dataframe['close'], dataframe['sar']
)) ))
dataframe.loc[ if conditions:
reduce(lambda x, y: x & y, conditions), dataframe.loc[
'buy'] = 1 reduce(lambda x, y: x & y, conditions),
'buy'] = 1
return dataframe return dataframe
@ -129,9 +130,10 @@ class DefaultHyperOpts(IHyperOpt):
dataframe['sar'], dataframe['close'] dataframe['sar'], dataframe['close']
)) ))
dataframe.loc[ if conditions:
reduce(lambda x, y: x & y, conditions), dataframe.loc[
'sell'] = 1 reduce(lambda x, y: x & y, conditions),
'sell'] = 1
return dataframe return dataframe

View File

@ -79,9 +79,10 @@ class SampleHyperOpts(IHyperOpt):
dataframe['close'], dataframe['sar'] dataframe['close'], dataframe['sar']
)) ))
dataframe.loc[ if conditions:
reduce(lambda x, y: x & y, conditions), dataframe.loc[
'buy'] = 1 reduce(lambda x, y: x & y, conditions),
'buy'] = 1
return dataframe return dataframe
@ -138,9 +139,10 @@ class SampleHyperOpts(IHyperOpt):
dataframe['sar'], dataframe['close'] dataframe['sar'], dataframe['close']
)) ))
dataframe.loc[ if conditions:
reduce(lambda x, y: x & y, conditions), dataframe.loc[
'sell'] = 1 reduce(lambda x, y: x & y, conditions),
'sell'] = 1
return dataframe return dataframe