Learn how to implement and backtest a Mean Reverting strategy from the book “Algorithmic Trading: Winning Strategies and Their Rationale” using the Quantconnect framework.

Introduction

Hi! Today we will continue to develop the Mean Reverting algorithm introduced in the last post Implementing a Simple Mean Reverting Pairs Trading Algorithm in the Quantconnect platform (Part 1) [1], and hopefully improve its results .

The idea behind the linear mean regression presented in Part 1 is that we can find a ratio (called hedge ratio) between two assets that cointegrate in time and then use this ratio to create a "virtual" portfolio that returns to its mean. …


Learn how to implement and backtest a Mean Reverting strategy from the book “Algorithmic Trading: Winning Strategies and Their Rationale” using the Quantconnect framework.

Introduction

Hi! In my last story “Understanding and Implementing Kalman Filter for Pairs Trading” [1] I’ve used an example from the book Algorithmic Trading: Winning Strategies and Their Rationale [2] to illustrate the use of a Pairs Trading strategy using the Kalman Filter with the EWA (Australia’s ETF) and EWC (Canada’s ETF) pair. However, in the mentioned post, I’ve focused on the hedge ratio (relation between the two assets) and didn’t show the strategy’s performance, and that was intentional. In the Algorithmic Trading book, Ernest Chan presents an outstanding 26,2% of annualized return (APR) and a Sharpe ratio of 2.4 …


Learn how to implement Kalman Filter in Python to predict the hedge ration between two assets for Pairs Trading

Introduction

Kalman filter, despite its name, is a two step (prediction and correction) estimator algorithm. Kalman filter is most used in tracking and control systems to provide accurate estimates in the presence of uncertainties, but it can be adapted for use in a number of different applications, from finance to computer vision.

When trying to apply Kalman Filter to a finance topic (in this case, Pairs Trading), I ran into a number of different material on the internet. After a lot of research/study (reference list at the end), I couldn’t find a comprehensive resource with the intuition and the basics math…


Introduction

Optical Remote Sensing analysis depends on understanding the processes of absorption and scattering of solar radiance on ground objects. If we measure the solar incidence radiance and the surface’s irradiance, we will be able to estimate surface’s reflectance. Reflectance in various wavelengths is the key to understand the target we are observing, as each material will reflect and absorb energy differently depending on the considered wavelength. Figure 1 shows the mean reflectance spectra of different materials such as water, soil, vegetation and rocks.


Learn how to create scatter plots from satellite imagery and automate a PDF reporting engine with the results

Introduction

Hi, and welcome back to part 6 of Python for Geosciences. One advantage of using a programming language like Python to perform satellite image analysis instead of a geospatial software is that we can automate any part of the process. This automation can be used in a production chain to return a periodically output(for example, monthly water surface, annual deforestation, among others) or it can be used to perform a historical analysis (create a deforestation time series, for example). …


Learn how to perform raster reprojection, clipping and merging using the rasterio package for Python

Introduction

Welcome back for the 5th part of this series. On the previous Python for Geosciences post (here), we learned how to work with bit masks provided by satellite imagery, specifically for the case of the Landsat 8. It is very handful to mask undesired pixels or to select specific targets of interest. However, the pixel classification list of Level 2A processors is not always the same, or they are not reliable enough, and sometimes we need to use a mask provided by a different source/provider.

Last week, for example, I had prepare some water masks from the Global Water Surface…


Learn how to (correctly) use raster bit masks layers provided by satellite images as quality assessment bands

Introduction

Welcome back to the 4th part of the Python for Geosciences series. In the previous post we have covered how to extract the bands values to proceed a simple spectral analysis. Imagine, however, that our final objective is to automatically monitor the reflectance spectra of a specific area of interest. This could be a crop, a forest, a lake or any other target and the goal is to check the evolution of the spectral reflectance of this area over the time (this can be used, for example, to identify a specific type of crop, monitor the evolution of a water…


Third post in a series that will teach non-programmers how to use Python to handle and analyze geospatial data

Introduction

Hello and welcome back. This is the third story of the series Python for Geosciences, which has the objective to help non-programmers to start using Python for spatial data analysis and to automate it’s geospatial related processes. In the first post of the series (here), we learned how to prepare the Python environment on Windows using the Anaconda package manager and how to open a GeoTiff image from a Jupyter notebook. Next, on the second post (here), we saw the basics of matrix manipulation and we also learned how to created a flexible function to calculate Normalized Difference Indexes (such…


Hi Sebastian. I am glad to know the code is being useful. To save the checkpoint is really straightforward. Note that UNET inherits from nn.Module, so it behaves like a Pytorch module and it is the actual model. To save the weights you will use torch.save(model.state_dict(), filename). In the example, the model is called unet (lowercase). All the information can be found here: https://pytorch.org/tutorials/beginner/saving_loading_models.html

Regards,

Mauricio


Second post in a series that will teach non-programmers how to use Python to handle and analyze geospatial data.

This is the second story of the series Python for Geosciences — working with satellite image data. In the first post of this series (here) we set up the environment to run Python code from a Jupyter Notebook and learned how to open a GeoTiff image by using the rasterio package. Today we will learn the basics of matrix manipulation. This will allow us to combine matrices to create data cubes, perform raster calculations and create spectral indices.

As our series is based in step by step examples, our goal is to calculate the Modifies Normalized Difference Water Index (MNDWI)…

Maurício Cordeiro

Doctorate student @ Université Paul Sabatier (Toulouse). Water Resources Specialist at the Brazilian National Water Agency.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store