BUG: minor fixes from unit testing

This commit is contained in:
Frederic Fortier
2018-01-03 20:18:53 -05:00
parent bd2ee45664
commit a60311b002
4 changed files with 23 additions and 20 deletions
+9 -9
View File
@@ -33,12 +33,12 @@ def initialize(context):
# parameters or values you're going to use.
# In our example, we're looking at Neo in Ether.
context.market = symbol('neo_eth')
context.market = symbol('eth_btc')
context.base_price = None
context.current_day = None
context.RSI_OVERSOLD = 30
context.RSI_OVERBOUGHT = 80
context.RSI_OVERSOLD = 40
context.RSI_OVERBOUGHT = 65
context.CANDLE_SIZE = '5T'
context.start_time = time.time()
@@ -244,7 +244,7 @@ def analyze(context=None, perf=None):
if __name__ == '__main__':
# The execution mode: backtest or live
MODE = 'backtest'
MODE = 'live'
if MODE == 'backtest':
folder = os.path.join(
@@ -274,15 +274,15 @@ if __name__ == '__main__':
elif MODE == 'live':
run_algorithm(
capital_base=0.05,
capital_base=0.03,
initialize=initialize,
handle_data=handle_data,
analyze=analyze,
exchange_name='binance',
exchange_name='poloniex',
live=True,
algo_namespace=NAMESPACE,
base_currency='eth',
base_currency='btc',
live_graph=False,
simulate_orders=True,
stats_output=None
simulate_orders=False,
stats_output=None,
)
+4 -3
View File
@@ -114,9 +114,10 @@ class CCXT(Exchange):
@staticmethod
def find_exchanges(features=None, is_authenticated=False):
ccxt_features = []
for feature in features:
if not feature.endswith('Bundle'):
ccxt_features.append(feature)
if features is not None:
for feature in features:
if not feature.endswith('Bundle'):
ccxt_features.append(feature)
exchange_names = []
for exchange_name in ccxt.exchanges:
+7 -6
View File
@@ -84,13 +84,14 @@ def find_exchanges(features=None, skip_blacklist=True, is_authenticated=False,
base_currency=base_currency,
)
if 'dailyBundle' in features \
and not exchange.has_bundle('daily'):
continue
if features is not None:
if 'dailyBundle' in features \
and not exchange.has_bundle('daily'):
continue
elif 'minuteBundle' in features \
and not exchange.has_bundle('minute'):
continue
elif 'minuteBundle' in features \
and not exchange.has_bundle('minute'):
continue
exchanges.append(exchange)
+3 -2
View File
@@ -96,11 +96,12 @@ class TestSuiteBundle:
)
def test_validate_bundles(self):
exchange_population = 3
# exchange_population = 3
asset_population = 3
data_frequency = random.choice(['minute', 'daily'])
bundle = 'dailyBundle' if data_frequency == 'daily' else 'minuteBundle'
# bundle = 'dailyBundle' if data_frequency
# == 'daily' else 'minuteBundle'
# exchanges = select_random_exchanges(
# population=exchange_population,
# features=[bundle],