Financial Data and Preprocessing

The first chapter of this book is dedicated to a very important (if not the most important) part of any data science/quantitative finance project—gathering and working with data. In line with the "garbage in, garbage out" maxim, we should strive to have data of the highest possible quality, and correctly preprocess it for later use with statistical and machine learning algorithms. The reason for this is simple—the results of our analyses highly depend on the input data, and no sophisticated model will be able to compensate for that.

In this chapter, we cover the entire process of gathering financial data and preprocessing it into the form that is most commonly used in real-life projects. We begin by presenting a few possible sources of high-quality data, show how to convert prices into returns (which have properties desired by statistical algorithms), and investigate how to rescale asset returns (for example, from daily to monthly or yearly). Lastly, we learn how to investigate whether our data follows certain patterns (called stylized facts) commonly observed in financial assets.

One thing to bear in mind while reading this chapter is that data differs among sources, so the prices we see, for example, at Yahoo Finance and Quandl will most likely differ, as the respective sites also get their data from different sources and might use other methods to adjust the prices for corporate actions. The best practice is to find a source we trust the most concerning a particular type of data (based on, for example, opinion on the internet) and then use it for downloading data.

In this chapter, we cover the following recipes:

  • Getting data from Yahoo Finance
  • Getting data from Quandl
  • Getting data from Intrinio
  • Converting prices to returns 
  • Changing frequency
  • Visualizing time series data
  • Identifying outliers
  • Investigating stylized facts of asset returns
The content presented in the book is valid for educational purposes only—we show how to apply different statistical/data science techniques to problems in the financial domain, such as stock price prediction and asset allocation. By no means should the information in the book be considered investment advice. Financial markets are very volatile and you should invest only at your own risk!
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.11.20