when an analyst has price information from a selected stock or fund covariance can be calculated using the following formula 
covariance ret a b c avg a b c ret x y z avg x y z sample size 1 where ret a b c day s return for abc stock avg a b c abc s average return over the period ret x y z day s return for xyz stock avg x y z xyz s average return over the period sample size number of days sampled begin aligned text covariance sum frac text ret abc text avg abc times text ret xyz text avg xyz text sample size 1 textbf where text ret abc text day s return for abc stock text avg abc text abc s average return over the period text ret xyz text day s return for xyz stock text avg xyz text xyz s average return over the period text sample size text number of days sampled end aligned covariance sample size 1 retabc avgabc retxyz avgxyz where retabc day s return for abc stockavgabc abc s average return over the periodretxyz day s return for xyz stockavgxyz xyz s average return over the periodsample size number of days sampled types of covariancethe covariance equation is used to determine the direction of the relationship between two variables in other words whether they tend to move in the same or opposite directions a positive or negative covariance value determines this relationship a positive covariance between two variables indicates that these variables tend to be higher or lower at the same time in other words a positive covariance between stock one and two is where stock one is higher than average at the same points that stock two is higher than average and vice versa when charted on a two dimensional graph the data points will tend to slope upward 