Mini Project 2: Fast Fourier Transform Algorithm and

0 downloads 0 Views 436KB Size Report
Mar 19, 2018 - We will use the Fast Fourier Transform (FFT) algorithm to identify the cyclical evolutions of WTI crude ... Research Questions & Project Activities.
Mini Project 2: Fast Fourier Transform Algorithm and Technical Analysis Project Guidelines We will use the Fast Fourier Transform (FFT) algorithm to identify the cyclical evolutions of WTI crude oil price. To do we will use recursive code and the signal of price with respect to monthly period intervals.

In this project, the focus will be on the application of quantitative finance theory and implementation of coding logic using Python/PyLab programming packages. The power of Python programming allows for the most effective implementation of the coding logic by using statistical tools and submitted program’s code constitutes a fully workable version of this project. ——————————

Research Questions & Project Activities We devised the FFT algorithm method for identifying cyclical price evolutions for WTI crude oil. ——————————

Activity Progress 1. Observed Market Parameters: We downloaded from Quandl (https://www.quandl.com) the price of WTI crude oil for one year (January’17 – January’18). The relevant date and value sections were defined in the Python program body text as def function.

2. Python Code # -*- coding: utf-8 -*""" Created on Mon Mar 19 21:26:48 2018 @author: zabdullazade """ import numpy as np import matplotlib.pyplot as plt df = pd.read_csv("C:/WQU/Algorithms 1/Project_2/WTI.csv") a = df['Value'] b = df['Date'] plt.scatter(b, a, color="red", linewidth=0.5) plt.title('WTI Crude Oil Price, Monthly') plt.ylabel('Price ($USD)') plt.xlabel('Period (months)') def DFT_slow(x): x = np.asarray(a, dtype=float) N = x.shape[0] n = np.arange(N) k = n.reshape((N, 1)) M = np.exp(-2j * np.pi * k * n / N) return np.dot(M, x) print(DFT_slow(x)) print(np.mean(a)) plt.plot(DFT_slow(x))

3. Python Code Output runfile('C:/WQU/Algorithms 1/Project_2/untitled0.py', wdir='C:/WQU/Algorithms 1/Project_2')

52.618461538461546 ## Mean

[ 684.04000000 +0.j

41.35355656-23.64282019j

6.58364381-10.43178614j 5.77103258-10.29717633j 9.39683918 -2.10892771j

2.02574588 -1.30851272j

-2.65581801 -2.56254643j -2.65581801 +2.56254643j 2.02574588 +1.30851272j 9.39683918 +2.10892771j 5.77103258+10.29717633j 6.58364381+10.43178614j 41.35355656+23.64282019j] 52.618461538461546 return array(a, dtype, copy=False, order=order)

As it can be observed from the last figure FFT of WTI crude oil price has asymptotic price fluctuations, i.e. price in period 1 is between 0 and 100 $USD. The price of commodity never becomes 0. The price is fluctuating about its average of $ USD 52.62. Overall, the technical analysis of WTI crude oil price by using FFT shows not a strong signal frequency.

Suggest Documents