7 Handling time series data and missing values
This chapter covers
- Fetching data using HTTP queries
- Parsing JSON data
- Working with dates
- Handling missing values
- Plotting data with missing values
- Interpolating missing values
This is the last chapter in the introduction to the Julia language part of this book. A motivating use case for the topics that we will cover is working with financial asset prices. Imagine you wanted to analyze how the price of some stock or the exchange rate between two currencies evolves over time. To be able to handle such questions in Julia, you need to know how you can work with time series data. One of the frequent features of real-life temporal data is that for some time stamps there is missing data in it. Therefore, the second major topic of this chapter is handling missing values in Julia.
The problem we tackle in this chapter is analyzing the PLN/USD exchange rate that is published by the National Bank of Poland (NBP). The data is made available via a Web API, which is described here https://api.nbp.pl/en.html.
We will perform our task in the following steps:
- understanding the format of the data that the Web API exposes;
- fetching the data using HTTP GET requests for a specified range of dates;
- handling errors when the requested data is not available;
- extracting the PLN/USD exchange rate from the obtained result of the query;
- doing simple statistical analysis of the fetched data;
- plotting the fetched data with a proper handling of missing values.