fja05680 / pinkfish

A backtester and spreadsheet library for security analysis.
https://fja05680.github.io/pinkfish
MIT License
264 stars 60 forks source link

Update statistics.py #62

Closed wtld closed 1 year ago

wtld commented 1 year ago

Use the module constant currency_metrics instead of the hard coded list. This way you can modify this list from within your own program e.g.:

pf.statistics.currency_metrics = []
stats = pf.optimizer_summary(strategies, metrics=('total_net_profit', 'profit_factor', 'total_num_trades', 'sharpe_ratio'))

Otherwise, these metrics are strings in the DataFrame returned by optimizer_summary and cannot be sorted or analyzed.

I think that was the intention to create the variable currency_metrics in statistics module :)

fja05680 commented 1 year ago

Welcome wtld!!

I think your suggestion is a good one. I'll try to commit your PR is a couple days.

Farrell

fja05680 commented 1 year ago

Thank you for this PR!!