Posts

Showing posts from October, 2019

How to Get Market Data using Yahoo API with Python

Image
Market data is the main resource for conducting quantitative analysis. Yahoo finance provides API for getting market data and is the best source of free data to start market analysis. In this writing I explain how you can get daily, monthly and even intraday data using Yahoo API in Python. Fortunately  yfinance  package in Python provided us a great function we can use to extract market data for each Symbol. Here I show you how you can create working directory in Python and save the market data in it and make a function that get all SP500 data at the same time. It is pretty straightforward. Warning: make sure you create an empty folder for your working directory and set it as working directory because for getting the SP500 data we first clean the working directory first and then add the new .csv data in the folder and I am sure you don’t want to delete the sensitive data accidently by executing this code. import  yfinance  as  yf import  os import  pandas  as