Skip to content
    Back to all Bounties

    Earn 450 ($4.50)

    Time Remainingdue 2 years ago
    In Progress

    Save a CSV from Yahoofinance to replit and read it out.

    MirexTion
    MirexTion
    Posted 2 years ago

    Bounty Description

    Problem Description

    Acceptance Criteria

    read and work with that csv file

    Technical Details

    the code i have but its made for windows not for online replit

    from replit import db
    import csv

    Provides ways to work with large multidimensional arrays

    import numpy as np

    Allows for further data manipulation and analysis

    import pandas as pd
    from pandas_datareader import data as web # Reads stock data
    import matplotlib.pyplot as plt # Plotting
    import matplotlib.dates as mdates # Styling dates
    #matplotlib inline

    import datetime as dt # For defining dates
    import mplfinance as mpf # Matplotlib finance

    Function that gets a dataframe by providing a ticker and starting date

    def save_to_csv_from_yahoo(ticker, syear, smonth, sday, eyear, emonth, eday):

    # Defines the time periods to use
    start = dt.datetime(syear, smonth, sday)
    end = dt.datetime(eyear, emonth, eday)
     
    # Reads data into a dataframe
    df = web.DataReader(ticker, 'yahoo', start, end)
     
    # Save data to a CSV file
    # For Windows
    df.to_csv('ticker.csv')
    # For MacOS
    #df.to_csv("/Users/Zen/Documents/Tutorials/Python for Finance/" + ticker + '.csv')
    return df

    #save_to_csv_from_yahoo('AMZN', 2020, 1, 1, 2021, 1, 1)

    Link to Project

    https://github.com/derekbanas/Python4Finance/blob/main/Python%20for%20Finance%201.ipynb