1
$\begingroup$

I have an Excel file with daily prices and returns of a number of stocks.

I need to plot a cumulative return for each stock.

How can i do this, using Excel data, but not FinancialData command?

$\endgroup$
  • $\begingroup$ What have you tried? Also, you should note that you simultaneously asked this question at Wolfram Community (community.wolfram.com/groups/-/m/t/936881). $\endgroup$ – JimB Oct 9 '16 at 16:30
  • $\begingroup$ 1) What do you mean by cumulative. 2) Give a little sample of your cvs file with just some lines $\endgroup$ – cyrille.piatecki Oct 9 '16 at 18:17
3
$\begingroup$

Importing data from excel:

values = Import["C:\\Users\\LMC\\Desktop\\file.xlsx"]

({ {{15.}, {20.}, {80.}, {95.}, {45.}} })

The function you want is Accumulate:

ac = Accumulate@Flatten[values]

{15., 35., 115., 210., 255.}

To plot data use ListPlot:

ListPlot[ac]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.