aplotly 1.1.10__tar.gz → 1.1.12__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.
Files changed (29) hide show
  1. {aplotly-1.1.10/aplotly.egg-info → aplotly-1.1.12}/PKG-INFO +2 -2
  2. {aplotly-1.1.10 → aplotly-1.1.12}/aplotly/plots.py +85 -0
  3. {aplotly-1.1.10 → aplotly-1.1.12/aplotly.egg-info}/PKG-INFO +2 -2
  4. {aplotly-1.1.10 → aplotly-1.1.12}/pyproject.toml +3 -3
  5. {aplotly-1.1.10 → aplotly-1.1.12}/LICENSE +0 -0
  6. {aplotly-1.1.10 → aplotly-1.1.12}/MANIFEST.in +0 -0
  7. {aplotly-1.1.10 → aplotly-1.1.12}/README.md +0 -0
  8. {aplotly-1.1.10 → aplotly-1.1.12}/aplotly/__init__.py +0 -0
  9. {aplotly-1.1.10 → aplotly-1.1.12}/aplotly/colors.py +0 -0
  10. {aplotly-1.1.10 → aplotly-1.1.12}/aplotly/io.py +0 -0
  11. {aplotly-1.1.10 → aplotly-1.1.12}/aplotly/style.py +0 -0
  12. {aplotly-1.1.10 → aplotly-1.1.12}/aplotly/utils/return_breakdown.py +0 -0
  13. {aplotly-1.1.10 → aplotly-1.1.12}/aplotly.egg-info/SOURCES.txt +0 -0
  14. {aplotly-1.1.10 → aplotly-1.1.12}/aplotly.egg-info/dependency_links.txt +0 -0
  15. {aplotly-1.1.10 → aplotly-1.1.12}/aplotly.egg-info/requires.txt +0 -0
  16. {aplotly-1.1.10 → aplotly-1.1.12}/aplotly.egg-info/top_level.txt +0 -0
  17. {aplotly-1.1.10 → aplotly-1.1.12}/examples/plot_bars.py +0 -0
  18. {aplotly-1.1.10 → aplotly-1.1.12}/examples/plot_exposure_tree.py +0 -0
  19. {aplotly-1.1.10 → aplotly-1.1.12}/examples/plot_gauge.py +0 -0
  20. {aplotly-1.1.10 → aplotly-1.1.12}/examples/plot_line.py +0 -0
  21. {aplotly-1.1.10 → aplotly-1.1.12}/examples/plot_line_and_save.py +0 -0
  22. {aplotly-1.1.10 → aplotly-1.1.12}/examples/plot_lines.py +0 -0
  23. {aplotly-1.1.10 → aplotly-1.1.12}/examples/plot_multiple_performance.py +0 -0
  24. {aplotly-1.1.10 → aplotly-1.1.12}/examples/plot_performance.py +0 -0
  25. {aplotly-1.1.10 → aplotly-1.1.12}/examples/plot_returns_tree.py +0 -0
  26. {aplotly-1.1.10 → aplotly-1.1.12}/setup.cfg +0 -0
  27. {aplotly-1.1.10 → aplotly-1.1.12}/tests/test_colors.py +0 -0
  28. {aplotly-1.1.10 → aplotly-1.1.12}/tests/test_io.py +0 -0
  29. {aplotly-1.1.10 → aplotly-1.1.12}/tests/test_style.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aplotly
3
- Version: 1.1.10
3
+ Version: 1.1.12
4
4
  License: MIT License
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@@ -12,7 +12,7 @@ License: MIT License
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Programming Language :: Python
14
14
  Classifier: Programming Language :: Python :: 3
15
- Requires-Python: >=3.10.6
15
+ Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Requires-Dist: plotly>=5.18.0
@@ -612,3 +612,88 @@ def plot_gauge(
612
612
  )
613
613
 
614
614
  return fig
615
+
616
+
617
+ def plot_performance_by_trade(
618
+ pbt: pd.DataFrame,
619
+ marker_size: int = 10,
620
+ color_palette: str = "",
621
+ plot_title: str = "",
622
+ ):
623
+ configure_plotly(subplots=4, color_palette=color_palette)
624
+ fig = make_subplots(rows=4, cols=1, shared_xaxes=True, vertical_spacing=0.02)
625
+ fig.add_trace(
626
+ go.Scatter(
627
+ x=pbt.index,
628
+ y=pbt["hit_rate"] * 100,
629
+ mode="lines+markers",
630
+ name="Portfolio",
631
+ legendgroup=1,
632
+ legendgrouptitle_text="Hit Rate",
633
+ line=dict(width=2),
634
+ marker={"size": marker_size},
635
+ ),
636
+ row=1,
637
+ col=1,
638
+ )
639
+ fig.add_trace(
640
+ go.Scatter(
641
+ x=pbt.index,
642
+ y=pbt["slugging_ratio"],
643
+ mode="lines+markers",
644
+ name="Portfolio",
645
+ legendgroup=2,
646
+ legendgrouptitle_text="Slugging Ratio",
647
+ line=dict(width=2),
648
+ marker={"size": marker_size},
649
+ ),
650
+ row=2,
651
+ col=1,
652
+ )
653
+ fig.add_trace(
654
+ go.Scatter(
655
+ x=pbt.index,
656
+ y=pbt["average_win"] * 100,
657
+ mode="lines+markers",
658
+ name="Portfolio",
659
+ legendgroup=3,
660
+ legendgrouptitle_text="Average Win",
661
+ line=dict(width=2),
662
+ marker={"size": marker_size},
663
+ ),
664
+ row=3,
665
+ col=1,
666
+ )
667
+ fig.add_trace(
668
+ go.Bar(
669
+ x=pbt.index,
670
+ y=pbt["trades"],
671
+ name="Portfolio",
672
+ legendgroup=4,
673
+ legendgrouptitle_text="Trades",
674
+ marker_line_width=0,
675
+ ),
676
+ row=4,
677
+ col=1,
678
+ )
679
+
680
+ # add a straight horizontal line at 50% hit rate
681
+ fig.add_shape(
682
+ type="line",
683
+ x0=pbt.index[0],
684
+ y0=50,
685
+ x1=pbt.index[-1],
686
+ y1=50,
687
+ line=dict(color="grey", width=1, dash="dash"),
688
+ row=1,
689
+ col=1,
690
+ )
691
+
692
+ fig.update_yaxes(title_text="Hit Rate (%)", row=1, col=1)
693
+ fig.update_yaxes(title_text="Slugging Ratio", row=2, col=1)
694
+ fig.update_yaxes(title_text="Average Win (%)", row=3, col=1)
695
+ fig.update_yaxes(title_text="Trades", row=4, col=1)
696
+ fig.update_xaxes(title_text="Date", row=4, col=1)
697
+ fig.update_layout(title_text=plot_title)
698
+
699
+ return fig
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aplotly
3
- Version: 1.1.10
3
+ Version: 1.1.12
4
4
  License: MIT License
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@@ -12,7 +12,7 @@ License: MIT License
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Programming Language :: Python
14
14
  Classifier: Programming Language :: Python :: 3
15
- Requires-Python: >=3.10.6
15
+ Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Requires-Dist: plotly>=5.18.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "aplotly"
7
- version = "1.1.10"
7
+ version = "1.1.12"
8
8
  readme = "README.md"
9
9
  license = { file = "LICENSE" }
10
10
  classifiers = [
@@ -16,10 +16,10 @@ dependencies = [
16
16
  "plotly >= 5.18.0",
17
17
  "pandas >= 2.1.3"
18
18
  ]
19
- requires-python = ">=3.10.6"
19
+ requires-python = ">=3.10"
20
20
 
21
21
  [tool.bumpver]
22
- current_version = "1.1.10"
22
+ current_version = "1.1.12"
23
23
  version_pattern = "MAJOR.MINOR.PATCH"
24
24
  commit_message = "Bump version {old_version} -> {new_version}"
25
25
  commit = true
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
File without changes
File without changes
File without changes
File without changes