plotguy 2.1.9__tar.gz → 2.2.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotguy
3
- Version: 2.1.9
3
+ Version: 2.2.0
4
4
  Summary: Plotguy
5
5
  Home-page: https://pypi.org/project/plotguy/
6
6
  Author: Plotguy Team
@@ -15,9 +15,9 @@ Requires-Dist: hkfdb
15
15
  Requires-Dist: pyarrow==23.0.0
16
16
  Requires-Dist: fastparquet
17
17
  Requires-Dist: polars==0.18.15
18
+ Requires-Dist: dash==2.9.3
18
19
  Requires-Dist: plotly==5.18.0
19
20
  Requires-Dist: lxml
20
- Requires-Dist: dash==2.9.3
21
21
  Requires-Dist: dash_bootstrap_components
22
22
  Requires-Dist: dash_daq
23
23
  Requires-Dist: dash_dangerously_set_inner_html
@@ -798,73 +798,74 @@ class Components:
798
798
  saved_strategies_path = os.path.join(str_dir, 'saved_strategies.parquet')
799
799
  saved_strategies_df = pd.read_parquet(saved_strategies_path)
800
800
 
801
- for i, row in saved_strategies_df.iterrows():
802
- equity_path = os.path.join(str_dir, row["equity_curve_folder"], str(row['ref_code']) + '.parquet')
803
- #df_equity = pd.read_parquet(equity_path)
804
-
805
- yearly_stats_string = row['yearly_stats_string']
806
- para_keys_str = row['para_keys_str']
807
- para_keys_list = para_keys_str.split('|')
808
-
809
- parameters = {}
810
- for para_keys in para_keys_list:
811
- parameters[para_keys] = str(row[para_keys])
812
-
813
- equity_curve_dict = {}
814
-
815
- equity_curve_dict['folder'] = str_dir
816
- equity_curve_dict['backtest_name'] = row['backtest_name']
817
- equity_curve_dict['equity_path'] = equity_path
818
- equity_curve_dict['parameters'] = parameters
819
-
820
- equity_curve_dict['performance'] = {
821
- 'initial_capital': row['initial_capital'],
822
- 'sharpe_ratio': row['equity_annualized_sr'],
823
- 'annualized_return': row['equity_annualized_return'],
824
- 'net_profit_to_mdd': row['equity_net_profit_to_mdd'],
825
- 'net_profit': row['equity_net_profit'],
826
- 'mdd_dollar': row['equity_mdd_dollar'],
827
- 'mdd_pct': row['equity_mdd_pct'],
828
- 'num_of_trade': row['num_of_trade'],
829
- 'num_of_win': row['num_of_win'],
830
- 'return_on_capital': row['equity_return_on_capital'],
831
- 'total_commission': row['total_commission'],
832
- }
833
-
834
- ref_code = str(row['ref_code'])
835
- equity_curve_dict['ref_code'] = ref_code
836
-
837
- yearly_stats_dict = {}
838
- years_data = yearly_stats_string.split("|")
839
-
840
- for year_data in years_data:
841
- parts = year_data.split(",")
842
- year = parts[0]
843
- yearly_stats_dict[year] = {}
844
-
845
- for item in parts[1:]:
846
- key, value = item.split(":")
847
- yearly_stats_dict[year][key] = float(value)
848
-
849
- for idx, (year, value) in enumerate(yearly_stats_dict.items()):
850
- year_trade_count = value['year_trade_count']
851
- year_win_rate = value['year_win_rate']
852
- year_return = value['year_return']
853
-
854
- year_win_count = year_trade_count * year_win_rate * 0.01
855
-
856
- ### dont remove ###
857
- # year_trade_count = "{:d}".format(int(year_trade_count))
858
- # year_win_count = "{:d}".format(int(year_win_count))
859
- # year_win_rate = "{:d}%".format(int(year_win_rate))
860
- # year_return = "{:.2f} %".format(int(year_return))
861
-
862
- equity_curve_dict['performance'][f'{year} Count'] = year_trade_count
863
- equity_curve_dict['performance'][f'{year} Win Rate'] = year_win_rate
864
- equity_curve_dict['performance'][f'{year} Win Count'] = year_win_count
865
- equity_curve_dict['performance'][f'{year} Return'] = year_return
866
-
867
- equity_curves_dict_list.append(equity_curve_dict)
801
+ if len(saved_strategies_df.columns) > 1:
802
+ for i, row in saved_strategies_df.iterrows():
803
+ 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
+
806
+ yearly_stats_string = row['yearly_stats_string']
807
+ para_keys_str = row['para_keys_str']
808
+ para_keys_list = para_keys_str.split('|')
809
+
810
+ parameters = {}
811
+ for para_keys in para_keys_list:
812
+ parameters[para_keys] = str(row[para_keys])
813
+
814
+ equity_curve_dict = {}
815
+
816
+ equity_curve_dict['folder'] = str_dir
817
+ equity_curve_dict['backtest_name'] = row['backtest_name']
818
+ equity_curve_dict['equity_path'] = equity_path
819
+ equity_curve_dict['parameters'] = parameters
820
+
821
+ equity_curve_dict['performance'] = {
822
+ 'initial_capital': row['initial_capital'],
823
+ 'sharpe_ratio': row['equity_annualized_sr'],
824
+ 'annualized_return': row['equity_annualized_return'],
825
+ 'net_profit_to_mdd': row['equity_net_profit_to_mdd'],
826
+ 'net_profit': row['equity_net_profit'],
827
+ 'mdd_dollar': row['equity_mdd_dollar'],
828
+ 'mdd_pct': row['equity_mdd_pct'],
829
+ 'num_of_trade': row['num_of_trade'],
830
+ 'num_of_win': row['num_of_win'],
831
+ 'return_on_capital': row['equity_return_on_capital'],
832
+ 'total_commission': row['total_commission'],
833
+ }
834
+
835
+ ref_code = str(row['ref_code'])
836
+ equity_curve_dict['ref_code'] = ref_code
837
+
838
+ yearly_stats_dict = {}
839
+ years_data = yearly_stats_string.split("|")
840
+
841
+ for year_data in years_data:
842
+ parts = year_data.split(",")
843
+ year = parts[0]
844
+ yearly_stats_dict[year] = {}
845
+
846
+ for item in parts[1:]:
847
+ key, value = item.split(":")
848
+ yearly_stats_dict[year][key] = float(value)
849
+
850
+ for idx, (year, value) in enumerate(yearly_stats_dict.items()):
851
+ year_trade_count = value['year_trade_count']
852
+ year_win_rate = value['year_win_rate']
853
+ year_return = value['year_return']
854
+
855
+ year_win_count = year_trade_count * year_win_rate * 0.01
856
+
857
+ ### dont remove ###
858
+ # year_trade_count = "{:d}".format(int(year_trade_count))
859
+ # year_win_count = "{:d}".format(int(year_win_count))
860
+ # year_win_rate = "{:d}%".format(int(year_win_rate))
861
+ # year_return = "{:.2f} %".format(int(year_return))
862
+
863
+ equity_curve_dict['performance'][f'{year} Count'] = year_trade_count
864
+ equity_curve_dict['performance'][f'{year} Win Rate'] = year_win_rate
865
+ equity_curve_dict['performance'][f'{year} Win Count'] = year_win_count
866
+ equity_curve_dict['performance'][f'{year} Return'] = year_return
867
+
868
+ equity_curves_dict_list.append(equity_curve_dict)
868
869
 
869
870
  line_colour = []
870
871
  for c in range(len(equity_curves_dict_list)):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plotguy
3
- Version: 2.1.9
3
+ Version: 2.2.0
4
4
  Summary: Plotguy
5
5
  Home-page: https://pypi.org/project/plotguy/
6
6
  Author: Plotguy Team
@@ -15,9 +15,9 @@ Requires-Dist: hkfdb
15
15
  Requires-Dist: pyarrow==23.0.0
16
16
  Requires-Dist: fastparquet
17
17
  Requires-Dist: polars==0.18.15
18
+ Requires-Dist: dash==2.9.3
18
19
  Requires-Dist: plotly==5.18.0
19
20
  Requires-Dist: lxml
20
- Requires-Dist: dash==2.9.3
21
21
  Requires-Dist: dash_bootstrap_components
22
22
  Requires-Dist: dash_daq
23
23
  Requires-Dist: dash_dangerously_set_inner_html
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="plotguy",
8
- version="2.1.9",
8
+ version="2.2.0",
9
9
  author="Plotguy Team",
10
10
  author_email="plotguy.info@gmail.com",
11
11
  description="Plotguy",
@@ -19,9 +19,9 @@ setuptools.setup(
19
19
  'pyarrow==23.0.0',
20
20
  'fastparquet',
21
21
  'polars==0.18.15',
22
+ 'dash==2.9.3',
22
23
  'plotly==5.18.0',
23
24
  'lxml',
24
- 'dash==2.9.3',
25
25
  'dash_bootstrap_components',
26
26
  'dash_daq',
27
27
  'dash_dangerously_set_inner_html',
File without changes
File without changes
File without changes
File without changes
@@ -5,9 +5,9 @@ hkfdb
5
5
  pyarrow==23.0.0
6
6
  fastparquet
7
7
  polars==0.18.15
8
+ dash==2.9.3
8
9
  plotly==5.18.0
9
10
  lxml
10
- dash==2.9.3
11
11
  dash_bootstrap_components
12
12
  dash_daq
13
13
  dash_dangerously_set_inner_html
File without changes