Homepage Forums Dev & Debugging Need explanation

  • Need explanation

  • Ishita Banerjee

    Member
    January 3, 2021 at 1:31 am
    16 Coins
    0 Gems
    Level: Rookie

    Can someone please explain to be the logic behind the following code? I understand the data retrieval, what I don’t understand is the calculation. And what it’s suppose to represent.

    tickers = ['APPL', 'GOOG']

    sec_data = pd.DataFrame()

    for t in tickers:

    sec_data[t] = wb.DataReader(t, data_source = 'yahoo', start = '2016-1-8') ['Adj Close']

    sec_returns = np.log(sec_data / sec_data.shift(1))

  • Avery Walter

    Member
    January 3, 2021 at 10:04 pm
    12 Coins
    0 Gems
    Level: Rookie
    Helpful
    Up
    0
    Down
    Not Helpful

    The calculation is I guess what you do in order to get simple returns. The calculation simply finds the log of closing price divided by the closing price of previous day.

Log in to reply.

Original Post
0 of 0 posts June 2018
Now

New Report

Close