WIP Adding Benchmarking Capability
This commit is contained in:
22
functions.py
22
functions.py
@@ -146,6 +146,24 @@ def fetch_last_key_from_dict(dict):
|
||||
last_key = key_list[-1] # select the last entry from the list as it is the most current entry
|
||||
return last_key
|
||||
|
||||
# ADD BENCHMARK-TICKER TO TICKER-DICT
|
||||
def add_benchmark_ticker(tickers, ticker_benchmarkt):
|
||||
tickers.append(ticker_benchmarkt)
|
||||
logging(logging_level="success")
|
||||
|
||||
# CREATE BENCHMARK TRADES
|
||||
def create_benchmark_trades(trades):
|
||||
try:
|
||||
benchmark_trades = trades
|
||||
for trade_id in benchmark_trades:
|
||||
benchmark_trades[trade_id]['ticker'] = config.ticker_benchmark
|
||||
logging(logging_level="success")
|
||||
return benchmark_trades
|
||||
except Exception as error_message:
|
||||
logging(logging_level="error")
|
||||
logging(logging_level="error", message=f"Failed with error: {error_message}")
|
||||
return False
|
||||
|
||||
|
||||
|
||||
# -------------------------- #
|
||||
@@ -695,7 +713,7 @@ def calc_history_per_trade(trades, yf_data):
|
||||
return False
|
||||
|
||||
# CALC THE HISTORY PER TRADE & OVERALL
|
||||
def calc_history_per_ticker(history_per_trade, tickers, trades):
|
||||
def calc_history_per_ticker(history_per_trade, tickers):
|
||||
|
||||
# ------------------ CREATE JSON OBJECT
|
||||
# Create the json-dict
|
||||
@@ -812,8 +830,6 @@ def calc_history_per_ticker(history_per_trade, tickers, trades):
|
||||
logging(logging_level="error", message=f"Failed with error message: {error_message}")
|
||||
return False
|
||||
|
||||
|
||||
|
||||
# --------------------------- #
|
||||
# HISTORY SELECTION FUNCTIONS #
|
||||
# --------------------------- #
|
||||
|
||||
Reference in New Issue
Block a user