mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-01 12:20:21 +08:00
Fixes after rebasing to develop
This commit is contained in:
+13
-2
@@ -210,6 +210,12 @@ def ipython_only(option):
|
||||
'--algo-name',
|
||||
help='A label assigned to the algorithm for tracking purposes.',
|
||||
)
|
||||
@click.option(
|
||||
'-c',
|
||||
'--reference-currency',
|
||||
help='The reference currency used to calculate statistics '
|
||||
'(e.g. usd, btc, eth).',
|
||||
)
|
||||
@click.pass_context
|
||||
def run(ctx,
|
||||
algofile,
|
||||
@@ -226,7 +232,8 @@ def run(ctx,
|
||||
local_namespace,
|
||||
live,
|
||||
exchange_name,
|
||||
algo_namespace):
|
||||
algo_namespace,
|
||||
base_currency):
|
||||
"""Run a backtest for the given algorithm.
|
||||
"""
|
||||
|
||||
@@ -237,6 +244,9 @@ def run(ctx,
|
||||
if algo_namespace is None:
|
||||
ctx.fail("must specify an algorithm name '-n' in live execution "
|
||||
"mode '--live'")
|
||||
if base_currency is None:
|
||||
ctx.fail("must specify a reference currency '-c' in live "
|
||||
"execution mode '--live'")
|
||||
else:
|
||||
# check that the start and end dates are passed correctly
|
||||
if start is None and end is None:
|
||||
@@ -278,7 +288,8 @@ def run(ctx,
|
||||
environ=os.environ,
|
||||
live=live,
|
||||
exchange=exchange_name,
|
||||
algo_namespace=algo_namespace
|
||||
algo_namespace=algo_namespace,
|
||||
base_currency=base_currency
|
||||
)
|
||||
|
||||
if output == '-':
|
||||
|
||||
@@ -90,8 +90,10 @@ def _run(handle_data,
|
||||
print_algo,
|
||||
local_namespace,
|
||||
environ,
|
||||
live,
|
||||
exchange,
|
||||
algo_namespace):
|
||||
algo_namespace,
|
||||
base_currency):
|
||||
"""Run a backtest for the given algorithm.
|
||||
|
||||
This is shared between the cli and :func:`catalyst.run_algo`.
|
||||
@@ -238,7 +240,7 @@ def _run(handle_data,
|
||||
)
|
||||
|
||||
else:
|
||||
if exchange is not None:
|
||||
if live and exchange is not None:
|
||||
env = TradingEnvironment(
|
||||
environ=environ,
|
||||
exchange_tz="UTC",
|
||||
@@ -290,7 +292,7 @@ def _run(handle_data,
|
||||
TradingAlgorithmClass = (
|
||||
partial(ExchangeTradingAlgorithm, exchange=exchange,
|
||||
algo_namespace=algo_namespace)
|
||||
if exchange else TradingAlgorithm)
|
||||
if live and exchange else TradingAlgorithm)
|
||||
|
||||
perf = TradingAlgorithmClass(
|
||||
namespace=namespace,
|
||||
@@ -529,5 +531,6 @@ def run_algorithm(initialize,
|
||||
environ=environ,
|
||||
live=live,
|
||||
exchange=exchange,
|
||||
algo_namespace=algo_namespace
|
||||
algo_namespace=algo_namespace,
|
||||
base_currency=base_currency
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user