plotguy 2.2.0__tar.gz → 2.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {plotguy-2.2.0 → plotguy-2.2.1}/PKG-INFO +1 -1
- {plotguy-2.2.0 → plotguy-2.2.1}/plotguy/__init__.py +41 -0
- {plotguy-2.2.0 → plotguy-2.2.1}/plotguy/components.py +4 -2
- {plotguy-2.2.0 → plotguy-2.2.1}/plotguy.egg-info/PKG-INFO +1 -1
- {plotguy-2.2.0 → plotguy-2.2.1}/setup.py +1 -1
- {plotguy-2.2.0 → plotguy-2.2.1}/README.md +0 -0
- {plotguy-2.2.0 → plotguy-2.2.1}/plotguy/aggregate.py +0 -0
- {plotguy-2.2.0 → plotguy-2.2.1}/plotguy/equity_curves.py +0 -0
- {plotguy-2.2.0 → plotguy-2.2.1}/plotguy/signals.py +0 -0
- {plotguy-2.2.0 → plotguy-2.2.1}/plotguy.egg-info/SOURCES.txt +0 -0
- {plotguy-2.2.0 → plotguy-2.2.1}/plotguy.egg-info/dependency_links.txt +0 -0
- {plotguy-2.2.0 → plotguy-2.2.1}/plotguy.egg-info/requires.txt +0 -0
- {plotguy-2.2.0 → plotguy-2.2.1}/plotguy.egg-info/top_level.txt +0 -0
- {plotguy-2.2.0 → plotguy-2.2.1}/setup.cfg +0 -0
|
@@ -443,3 +443,44 @@ def get_geometric_mean_of_yearly_rate_backup(start_year, end_year):
|
|
|
443
443
|
|
|
444
444
|
return fed_fund_rate_geometric_mean
|
|
445
445
|
|
|
446
|
+
def su_table_converter():
|
|
447
|
+
all_str_dir = []
|
|
448
|
+
for folder_name in os.listdir():
|
|
449
|
+
if os.path.isfile(os.path.join(folder_name, 'saved_strategies.parquet')):
|
|
450
|
+
all_str_dir.append(folder_name)
|
|
451
|
+
|
|
452
|
+
su_dict = {'backtest_name': [], 'code': [], 'freq': [], 'para_items_str': [], 'initial_capital': [],
|
|
453
|
+
'equity_mdd_pct': []}
|
|
454
|
+
|
|
455
|
+
for str_dir in all_str_dir:
|
|
456
|
+
saved_strategies_path = os.path.join(str_dir, 'saved_strategies.parquet')
|
|
457
|
+
saved_strategies_df = pd.read_parquet(saved_strategies_path)
|
|
458
|
+
saved_strategies_df = saved_strategies_df.reset_index(drop=True)
|
|
459
|
+
|
|
460
|
+
if len(saved_strategies_df.columns) > 1:
|
|
461
|
+
for i, row in saved_strategies_df.iterrows():
|
|
462
|
+
backtest_name = row['backtest_name']
|
|
463
|
+
freq = row['freq']
|
|
464
|
+
para_keys_str = row['para_keys_str']
|
|
465
|
+
equity_mdd_pct = row['equity_mdd_pct']
|
|
466
|
+
initial_capital = row['initial_capital']
|
|
467
|
+
|
|
468
|
+
para_items_str = ''
|
|
469
|
+
para_keys_str_list = para_keys_str.split('|')
|
|
470
|
+
for para_key in para_keys_str_list:
|
|
471
|
+
para_value = str(saved_strategies_df.at[i, para_key])
|
|
472
|
+
if para_key == 'code':
|
|
473
|
+
code = para_value
|
|
474
|
+
else:
|
|
475
|
+
para_items_str += para_key + '=' + para_value + '|'
|
|
476
|
+
para_items_str = para_items_str[:-1]
|
|
477
|
+
|
|
478
|
+
su_dict['backtest_name'].append(backtest_name)
|
|
479
|
+
su_dict['code'].append(code)
|
|
480
|
+
su_dict['freq'].append(freq)
|
|
481
|
+
su_dict['para_items_str'].append(para_items_str)
|
|
482
|
+
su_dict['equity_mdd_pct'].append(equity_mdd_pct)
|
|
483
|
+
su_dict['initial_capital'].append(initial_capital)
|
|
484
|
+
|
|
485
|
+
su_table = pd.DataFrame(su_dict)
|
|
486
|
+
return su_table
|
|
@@ -630,7 +630,9 @@ class Components:
|
|
|
630
630
|
fig_line.add_trace(go.Scatter(mode='lines', hovertemplate=hovertemplate,
|
|
631
631
|
x=df_daily.index.date, y=df_daily['equity_value'],
|
|
632
632
|
line=dict(color=line_colour, width=1.5), name=''), )
|
|
633
|
-
|
|
633
|
+
fig_line.update_layout(
|
|
634
|
+
hoverlabel=dict(align="left", font_size=12, bgcolor="white")
|
|
635
|
+
)
|
|
634
636
|
|
|
635
637
|
return fig_line
|
|
636
638
|
|
|
@@ -791,6 +793,7 @@ class Components:
|
|
|
791
793
|
for folder_name in os.listdir():
|
|
792
794
|
if os.path.isfile(os.path.join(folder_name, 'saved_strategies.parquet')):
|
|
793
795
|
all_str_dir.append(folder_name)
|
|
796
|
+
|
|
794
797
|
all_str_dir.sort()
|
|
795
798
|
equity_curves_dict_list = []
|
|
796
799
|
|
|
@@ -801,7 +804,6 @@ class Components:
|
|
|
801
804
|
if len(saved_strategies_df.columns) > 1:
|
|
802
805
|
for i, row in saved_strategies_df.iterrows():
|
|
803
806
|
equity_path = os.path.join(str_dir, row['equity_curve_folder'], str(row['ref_code']) + '.parquet')
|
|
804
|
-
#df_equity = pd.read_parquet(equity_path)
|
|
805
807
|
|
|
806
808
|
yearly_stats_string = row['yearly_stats_string']
|
|
807
809
|
para_keys_str = row['para_keys_str']
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|