示例#1
0
def load_data():
    df_original = pd.read_csv('eod-quotemedia.csv',
                              parse_dates=['date'],
                              index_col=False)

    # Add TB sector to the market
    df = df_original
    df = pd.concat(
        [df] +
        project_helper.generate_tb_sector(df[df['ticker'] == 'AAPL']['date']),
        ignore_index=True)

    close = df.reset_index().pivot(index='date',
                                   columns='ticker',
                                   values='adj_close')
    high = df.reset_index().pivot(index='date',
                                  columns='ticker',
                                  values='adj_high')
    low = df.reset_index().pivot(index='date',
                                 columns='ticker',
                                 values='adj_low')

    print('Loaded Data')
    return close, high, low
示例#2
0
import project_helper
import project_tests


# ## Market Data
# ### Load Data
# While using real data will give you hands on experience, it's doesn't cover all the topics we try to condense in one project. We'll solve this by creating new stocks. We've create a scenario where companies mining [Terbium](https://en.wikipedia.org/wiki/Terbium) are making huge profits. All the companies in this sector of the market are made up. They represent a sector with large growth that will be used for demonstration latter in this project.

# In[6]:


df_original = pd.read_csv('../../data/project_2/eod-quotemedia.csv', parse_dates=['date'], index_col=False)

# Add TB sector to the market
df = df_original
df = pd.concat([df] + project_helper.generate_tb_sector(df[df['ticker'] == 'AAPL']['date']), ignore_index=True)

close = df.reset_index().pivot(index='date', columns='ticker', values='adj_close')
high = df.reset_index().pivot(index='date', columns='ticker', values='adj_high')
low = df.reset_index().pivot(index='date', columns='ticker', values='adj_low')

print('Loaded Data')


# ### View Data
# To see what one of these 2-d matrices looks like, let's take a look at the closing prices matrix.

# In[7]:


close
示例#3
0
# ### Load Data
# While using real data will give you hands on experience, it's doesn't cover all the topics we try to condense in one project. We'll solve this by creating new stocks. We've create a scenario where companies mining [Terbium](https://en.wikipedia.org/wiki/Terbium) are making huge profits. All the companies in this sector of the market are made up. They represent a sector with large growth that will be used for demonstration latter in this project.

# In[12]:

#print(os.getcwd())
data_path = os.path.join("./data", "project_2", "eod-quotemedia.csv")
#!ls $data_path

df_original = pd.read_csv(data_path, parse_dates=['date'], index_col=False)

# Add TB sector to the market
df = df_original
df = pd.concat(
    [df] +
    project_helper.generate_tb_sector(df[df['ticker'] == 'AAPL']['date']),
    ignore_index=True)

close = df.reset_index().pivot(index='date',
                               columns='ticker',
                               values='adj_close')
high = df.reset_index().pivot(index='date',
                              columns='ticker',
                              values='adj_high')
low = df.reset_index().pivot(index='date', columns='ticker', values='adj_low')

print('Loaded Data')

# ### View Data
# To see what one of these 2-d matrices looks like, let's take a look at the closing prices matrix.
# ## Market Data
# ### Load Data
# While using real data will give you hands on experience, it's doesn't cover all the topics we try to condense in one project. We'll solve this by creating new stocks. We've create a scenario where companies mining [Terbium](https://en.wikipedia.org/wiki/Terbium) are making huge profits. All the companies in this sector of the market are made up. They represent a sector with large growth that will be used for demonstration latter in this project.

# In[3]:

df_original = pd.read_csv("breakout_strategy/eod-quotemedia.csv",
                          parse_dates=["date"],
                          index_col=False)

# Add TB sector to the market
df = df_original
df = pd.concat(
    [df] +
    project_helper.generate_tb_sector(df[df["ticker"] == "AAPL"]["date"]),
    ignore_index=True,
)

close = df.reset_index().pivot(index="date",
                               columns="ticker",
                               values="adj_close")
high = df.reset_index().pivot(index="date",
                              columns="ticker",
                              values="adj_high")
low = df.reset_index().pivot(index="date", columns="ticker", values="adj_low")

print("Loaded Data")

# ### View Data
# To see what one of these 2-d matrices looks like, let's take a look at the closing prices matrix.