One day standard deviation of a portfolio (long/short, different scalars)

I am attempting to calculate the expected one-day standard deviation of a portfolio in dollars. In other words, I am looking for the following: "I expect my portfolio to move _______ dollars on average each day."

I have historical price data for each asset in my portfolio for the previous 90 days, as well as my current position sizes for each asset. The portfolio includes both long & short positions.

One complicating factor is that not all assets have the same weighting. For example, 1 unit of asset XYZ has a scalar of 100, similar to options. In other words, if XYZ has a price of 3 dollars, owning 1 unit of asset XYZ is equivalent to owning $300 of XYZ. My python code is below. What I am currently doing is multiplying my positions by their scalars and using this as weights_df. Then, I am calculating the covariance matrix of the assets from the historical prices (with no scaling). However, I am not positive that this is mathematically correct. prices_df = pd.pivot_table(df, values='VALUE', index=['PUBLISH_DATE'], columns=['Product']).ffill(axis=0) cov_df = returns_df.cov() weights_df = pd.read_excel('posfrombook.xlsx', sheetname='Match') portfolio_weights = np.asarray(weights_df['Position Size']) portfolio_volatility = (np.dot(portfolio_weights.T, np.dot(cov_df, portfolio_weights))) print((portfolio_volatility**.5))  I was expecting a portfolio variance around$2000, yet the number I'm getting with the following method seems to be much too high (10-15x what I expected). Should I be using return data? If so, how do I deal with the short positions, as well as the scaling issues?

• In the first line of code you compute prices_df. But this is not used anywhere and in the second line you use returns_df. How is returns_df computed? – Alex C Sep 23 '19 at 17:54
• I apologize - it should just be prices_df – Alex Sep 23 '19 at 17:58
• In general, how do you scale the covariance matrix if assets have different scaling factors? – Alex Sep 23 '19 at 18:06
• You have the positions in "accounting units" for example "3 contracts of FOO". You multiply by the scalars to get position in underlying units : "300 units of FOO". You multiply this by the price per unit (say FOO has price 12) to get the dollar value "3600 dollars of FOO". Call this vector $d$. Then the dollar change per day is (I think) $\sqrt{d^T C d}$ where $C$ is the covariance matrix of returns. Some d's may be negative, since you are short. – Alex C Sep 23 '19 at 18:36
• Thanks, @AlexC! Does the covariance of returns need to be scaled (e.g. when using historical prices to calculate the covariance matrix, should I multiply the historical price by the scalar? E.g. should I use 3600 dollars in the historical price for FOO or 12 dollars?) – Alex Sep 23 '19 at 18:46