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$
2
  • $\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, 2016 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$ Oct 9, 2016 at 18:17

1 Answer 1

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 and acknowledge you have read our privacy policy.

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