mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-27 11:20:45 +08:00
BUG: minor fixes from unit testing
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user