Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add light-reports option (Sourcery refactored) #2

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions jessetk2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def cli() -> None:
help='Generates charts of daily portfolio balance and assets price change. Useful for a visual comparision of your portfolio against the market.')
@click.option('--tradingview/--no-tradingview', default=False,
help="Generates an output that can be copy-and-pasted into tradingview.com's pine-editor too see the trades in their charts.")
@click.option('--light-reports/--no-light-reports', default=False,
help="Generate an html document containing all of the scripts and data to load tradingview and review the results. This can be generated within a strategy at regular intervals to review the results live.")
@click.option('--full-reports/--no-full-reports', default=False,
help="Generates QuantStats' HTML output with metrics reports like Sharpe ratio, Win rate, Volatility, etc., and batch plotting for visualizing performance, drawdowns, rolling statistics, monthly returns, etc.")
@click.option(
Expand All @@ -86,7 +88,7 @@ def cli() -> None:
@click.option(
'--seq', default='None', show_default=True, help='Fixed width hyperparameters payload')
def backtest(start_date: str, finish_date: str, debug: bool, csv: bool, json: bool, fee: bool, chart: bool,
tradingview: bool, full_reports: bool, dna: str, hp: str, seq: str) -> None:
tradingview: bool, light_reports: bool, full_reports: bool, dna: str, hp: str, seq: str) -> None:
"""
backtest mode. Enter in "YYYY-MM-DD" "YYYY-MM-DD"
"""
Expand Down Expand Up @@ -457,7 +459,7 @@ def pick(dna_log_file, sort_criteria, len1, len2) -> None:
print('dna_log_file is required!')
exit()

sort_criteria = 'pnl1' if not sort_criteria else sort_criteria
sort_criteria = sort_criteria or 'pnl1'
len1 = 30 if not len1 or len1 < 0 or len1 > 10_000 else len1
len2 = 150 if not len2 or len2 < 0 or len2 > 10_000 else len2

Expand Down Expand Up @@ -951,11 +953,11 @@ def bulk(exchange: str, symbol: str, start_date: str, workers: int) -> None:

end = arrow.utcnow().floor('month').shift(months=-1)

if exchange in ['binance', 'spot']:
if exchange in {'binance', 'spot'}:
exchange = 'Binance'
market_type = 'spot'
margin_type = None
elif exchange in ['binance futures', 'futures']:
elif exchange in {'binance futures', 'futures'}:
exchange = 'Binance Futures'
market_type = 'futures'
margin_type = 'um'
Expand Down Expand Up @@ -1013,7 +1015,7 @@ def bulkpairs(exchange: str, start_date: str, workers: int, all) -> None:
workers = max(workers, 64)

end = arrow.utcnow().floor('month').shift(months=-1)

print(exchange_data[exchange], exchange_data[exchange]['market_type'])

if exchange in exchange_data:
Expand Down Expand Up @@ -1172,7 +1174,7 @@ def old_backtest(start_date: str, finish_date: str, debug: bool, csv: bool, json
# register_custom_exception_handler()
# debug flag
config['app']['debug_mode'] = debug

# fee flag
if not fee:
for e in config['app']['trading_exchanges']:
Expand Down