Replies: 1 comment
-
Quantstats expects a pandas series of percentage returns with datetime index import quantstats as qs
import pandas as pd
dates = ['2023-08-08','2023-08-10', '2023-08-11', '2023-08-14', '2023-08-16']
values =[-23.15,-6.85,25.45,35,19.95]
dates = [pd.to_datetime(date) for date in dates]
df = pd.DataFrame(values, columns=['returns'], index=dates)
capital = 1000.0
df['returns'] = df['returns'] / capital # Converting to returns
qs.reports.metrics(df.returns, cumulative=False) # turn off compounding This gives me the following output
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
my df has the data of this simple format.
this is what i do with quantstats
can you guide me on how to resolve this
Beta Was this translation helpful? Give feedback.
All reactions