WIP Adding Benchmarking Capability
This commit is contained in:
33
main.py
33
main.py
@@ -15,6 +15,13 @@ while True:
|
||||
print("Creating a list of unique tickers...", end=" ", flush=True)
|
||||
tickers = functions.filter_list_of_tickers(trades)
|
||||
|
||||
# Configuration dependent execution:
|
||||
if config.calculate_benchmark == True:
|
||||
|
||||
# Add the benchmark-ticker to the list of tickers to download data from yfinance from
|
||||
print("Adding benchmark-ticker...", end="", flush=True)
|
||||
tickers = functions.add_benchmark_ticker(tickers, config.ticker_benchmark)
|
||||
|
||||
# Fetches & formats the complete history per ticker from yfinance
|
||||
print("Fetching & formating yfinance data", end="", flush=True)
|
||||
yf_data = functions.fetch_format_yf_data(tickers)
|
||||
@@ -35,6 +42,28 @@ while True:
|
||||
functions.push_notion_trades_update(trades)
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------- #
|
||||
# PART 2: Calculating Benchmark performance #
|
||||
# ----------------------------------------- #
|
||||
# Configuration dependent execution:
|
||||
if config.calculate_benchmark == True:
|
||||
|
||||
# Creating benchmark trades
|
||||
print("Creating 'benchmark trades'...", end="", flush=True)
|
||||
benchmark_trades = functions.create_benchmark_trades(trades)
|
||||
|
||||
# Calculating benchmark trades
|
||||
print("Calculating the history per benchmark-trade...", end=" ", flush=True)
|
||||
history_per_benchmark_trade = functions.calc_history_per_trade(benchmark_trades, yf_data)
|
||||
|
||||
###
|
||||
# ICH BIN MIR UNSICHER, WIE ICH HIERMIT WEITER MACHEN SOLL
|
||||
# ICH GLAUBE, ICH MUSS DIE HISTORY PER BENCHMARK-TICKER UND PER TICKER MERGEN
|
||||
# DANN HABE ICH ABER DAS PROBLEM, DASS ICH DIE ECHTEN TRADES NICHT VON DEN BENCHMARKS UNTERSCHEIDEN KANN
|
||||
###
|
||||
|
||||
|
||||
# ------------------------------------------------ #
|
||||
# PART 2: Updating the notion investments database #
|
||||
# ------------------------------------------------ #
|
||||
@@ -44,7 +73,7 @@ while True:
|
||||
|
||||
# Calculates & stores a history per ticker AND a total across all tickers indexed by the ticker name
|
||||
print("Calculating history per ticker...", end=" ", flush=True)
|
||||
history_per_ticker = functions.calc_history_per_ticker(history_per_trade, tickers, trades)
|
||||
history_per_ticker = functions.calc_history_per_ticker(history_per_trade, tickers)
|
||||
|
||||
# Configuration dependent execution:
|
||||
if config.update_notion == True:
|
||||
@@ -61,7 +90,6 @@ while True:
|
||||
# --------------------------------- #
|
||||
# PART 3: Updating the TRMNL Screen #
|
||||
# --------------------------------- #
|
||||
|
||||
# Configuration dependent execution:
|
||||
if config.update_TRMNL == True:
|
||||
|
||||
@@ -101,6 +129,7 @@ while True:
|
||||
print("Updating a TERMNL screen...", end=" ", flush=True)
|
||||
functions.push_trmnl_update_chart(trmnl_update_object, config.trmnl_url_chart_2, config.trmnl_headers)
|
||||
|
||||
|
||||
# --------------------------- #
|
||||
# PART 4: Cool off and repeat #
|
||||
# --------------------------- #
|
||||
|
||||
Reference in New Issue
Block a user