Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data...

28
Wavelet Multi - scale Analysis of High Frequency FX Rates Saif Ahmad Department of Computing University of Surrey, Guildford, UK August 27, 2004 Intelligent Data Engineering and Automated Learning - IDEAL 2004 5th International Conference, Exeter, UK Series: Lecture Notes in Computer Science , Vol. 3177

Transcript of Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data...

Page 1: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Wavelet Multi-scale Analysis of High

Frequency FX RatesSaif Ahmad

Department of ComputingUniversity of Surrey, Guildford, UK

August 27, 2004

Intelligent Data Engineering and Automated Learning - IDEAL 2004

5th International Conference, Exeter, UKSeries: Lecture Notes in Computer Science , Vol. 3177

Page 2: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Talk Outline● Describing Time Series Data● Financial Time Series Data Characteristics ● Wavelet Multiscale Analysis● Our Time Series Analysis Approach

- Algorithms- Prototype System- Case Study- Conclusions

● Questions

Page 3: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

What Is a Time Series?

● A chronologically arranged sequence of data on a particular variable

● Obtained at regular time interval● Assumes that factors influencing past and

present will continue

Page 4: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

U.S. Retail SalesQuarterly Data

200

250

300

350

400

450

83 84 85 86 87Year

Sal

es (

Bill

ion

s)

Page 5: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Time Series Components

Trend

Seasonal Cyclical

Irregular

TS Data

Page 6: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Trend Component

● Indicates the very long-term behavior of the time series

● Typically as a straight line or an exponential curve

● This is useful in seeing the overall picture

Page 7: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Cyclical Component● A non-seasonal component which varies in a

recognizable period● Peak● Contraction● Trough● Expansion

● Due to interactions of economic factors● The cyclic variation is especially difficult to

forecast beyond the immediate future à more of a local phenomenon

Time

Page 8: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Seasonal Component● Regular pattern of up and down fluctuations

within a fixed time

● Due to weather, customs etc.● Periods of fluctuations more regular, hence more

profitable for forecasting

Time

Page 9: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Irregular Component

● Random, unsystematic, “residual” fluctuations

● Due to random variation or unforeseen events

● Short duration and non-repeating● A forecast, even in the best situation, can be

no closer (on average) than the typical size of the irregular variation

Page 10: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Time Series Data Broken-Down*

Trend

Seasonal Index

Cyclic Behavior

Irregular

TS Data

*For illustration purposes only.

Page 11: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Financial Time Series Data Characteristics

● Evolve in a nonlinear fashion over time

● Exhibit quite complicated patterns, like trends, abrupt changes, and volatility clustering, which appear, disappear, and re-appear over time ànonstationary

● There may be purely local changes in time domain, global changes in frequency domain, and there may be changes in the variance parameters

Page 12: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Financial Time Series Data Characteristics

305

345

385

425

465

505

545

585

1 26 51 76 101 126 151 176 201 226 251 276 301 326 351

0

0.02

0.04

0.06

0.08

0.1

1 26 51 76 101 126 151 176 201 226 251 276 301 326 351

Nonstationary

Time Varying Volatility

Page 13: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

● The nonlinearities and nostationarities do contain certain regularities or patterns

● Therefore, an analysis of nonlinear time series data would involve quantitatively capturing such regularities or patterns effectively

Financial Time Series Data Characteristics

Having said that…

How and Why?

Page 14: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Wavelet Multiscale AnalysisOverview● Wavelets are mathematical functions that cut up

data into different frequency components and then study each component with a resolution matched to its scale

● Wavelets are treated as a ‘lens’ that enables the researcher to explore relationships that were previously unobservable

● Provides a unique decomposition (deconstruction) of a time series in ways that are potentially revealing

Page 15: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Signal

Wavelet

C = C1

Step I: Take a wavelet and compare it to a section at the start of the original signal. Calculate C to measure closeness (correlation) of wavelet with signal

Wavelet Multiscale Analysis

Page 16: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Signal

Wavelet

C = C2

Step II: Keep shifting the wavelet to the right and repeating Step I until whole signal is covered

Wavelet Multiscale Analysis

Page 17: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Signal

Wavelet Multiscale Analysis

Wavelet

C = C3

Step III: Scale (stretch) the wavelet and repeat Steps I & II

Step IV: Repeat Steps I to III for all scales

Page 18: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Wavelet Multiscale Analysis

Discrete Convolution: The original signal is convolved with a set of high or low pass filters corresponding to the prototype wavelet

Xt à Original SignalW à High or low pass filters

Filter Bank Approach

Page 19: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Wavelet Multiscale AnalysisFilter Bank Approach

H (f)

G (f) G* (f)

2 2 H* (f)

2 2

Xt

D1

A1

H: Bank of High Pass filters

G: Bank of Low Pass filters

H (f) – high-pass decomposition filter

H* (f) – high-pass reconstruction filter

G (f) – low-pass decomposition filter

G* (f) – low-pass reconstruction filter

Up arrow with 2 – upsampling by 2

Down arrow with 2 – downsampling by 2

Xt

A1 D1A1

A2 D2A2

A3 D3

L

Level 1

Xt = A1 + D1

Level 2

Level 3

L

L

H

H

L Xt = A2 + D1+ D2

Xt = A3 + D1+ D2 + D3

Level N

Xt = AN + D1+ D2 + … DN

Iteration gives scaling effect

at each level

Mallat’s Pyramidal Filtering Approach

Page 20: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Wavelet Multiscale AnalysisW

avel

et D

ecom

posi

tions

Four

ier P

ower

Spe

ctru

m

-1.1E+02

-6.1E+01

-1.1E+01

3.9E+01

8.9E+01

-1.5E+02

-5.0E+01

5.0E+01

1.5E+02

2.5E+02

-1.5E+02

-1.0E+02

-5.0E+01

0.0E+00

5.0E+01

3.8E+034.0E+034.2E+034.4E+034.6E+034.8E+035.0E+035.2E+03

0.0E+005.0E+041.0E+051.5E+052.0E+052.5E+053.0E+053.5E+05

0.0E+00

5.0E+05

1.0E+061.5E+06

2.0E+06

2.5E+06

3.0E+06

0.0E+00

5.0E+05

1.0E+061.5E+06

2.0E+06

2.5E+06

3.0E+06

0.0E+005.0E+041.0E+051.5E+052.0E+052.5E+053.0E+053.5E+05

Page 21: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Analyzing High-frequency Financial Data: Our Approach

Tick Data

Preprocessing TransformationKnowledge Discovery Forecast

Data Compression

Multiscale Analysis PredictionSummarization

Aggregate the movement in the

dataset over a certain

period of time

Use the DWT to deconstruct

the series

Describe market dynamics at

different scales (time horizons)

with chief features

Use the extracted

‘chief features’ to predict

CycleTrendTurning PointsVariance Change

Page 22: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Analyzing High-frequency Financial Data: Our Approach

I. Compress the tick data to get Open (O), High (H), Low (L) and Close (C) value for a given compression period (for example, one minute or five minutes).

II. Calculate the level L of the DWT needed based on number of samples N in C of Step I,L = floor [log (N)/log (2)].

III. Perform a level-L DWT on C based on results of Step I and Step II to get,Di, i = 1, . . ., L, and AL.

III-1. Compute trend by performing linear regression on AL.

III-2. Extract cycle (seasonality) by performing a Fourier power spectrum analysis on each Di and choosing the Di with maximum power as DS.

III-3. Extract turning points by choosing extremas of each Di.

IV. Locate a single variance change in the series by using the NCSS index on C.

V. Generate a graphical and verbal summary for results of Steps III-1 to III-3 and IV.

Generalized Algorithm: Summarization

Page 23: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Analyzing High-frequency Financial Data: Our Approach

I. Summarize the tick data using the time series summarization algorithm.

II. For a N-step ahead forecast, extend the seasonal component DSsymmetrically N points to the right to get DS, forecast.

III. For a N-step ahead forecast, extend the trend component AN linearly N points to the right to get AN, forecast.

IV. Add the results of Steps II and III to get an aggregate N-step ahead forecast, Forecast = DS, forecast + AN, forecast.

Generalized Algorithm: Prediction

Page 24: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Analyzing High-frequency Financial Data: Our Approach

Raw Signal

Volatility

DWT

Statistic

NCSS

DWT

FFT

Detect Turning

Points and Trends

Detect Inherent Cycles

Detect Variance Change

Summ

arization

PredictionA prototype system has been implemented that automatically extracts “chief features” from a time series and give a prediction based on the extracted features, namely trend and seasonality

Page 25: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Analyzing High-frequency Financial Data: Our ApproachA Case StudyConsider the five minutes compressed tick data for the £/$ exchange rate on March 18, 2004

1.82

1.82

1.83

1.83

1.84

0 25 50 75 100 125 150 175 200 225 250 275

0.00.20.40.60.81.0

0 25 50 75 100 125 150 175 200 225 250 275

Feature Phrases Details

Trend1st Phase

2nd Phase

Turning Points

Downturns 108, 132, 164, and 178

Upturns 5, 12, 20 36, 68, and 201

Variance Change Location 164

CyclePeriod 42

Peaks at 21, 54, 117, 181, 215, and 278

260 < t 1.81, + t 5-6.36eTrend1x =

288 < t < 261 1.83, + t 6-3.65eTrend2x =

Input Data

System O

utput

Page 26: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Analyzing High-frequency Financial Data: Our ApproachA Case StudyFor prediction, we use the ‘chief features’ of the previous day (March 18, 2004), information about the dominant cycle and trend (summarization), to reproduce the elements of the series for the following day (March 19, 2004):

1.82

1.82

1.83

1.83

1.83

0 25 50 75 100 125 150 175 200 225 250

ActualMarch 19, 2004

Predicted (seasonal + trend)March 19, 2004

Root Means Square Error = 0.0000381

Correlation = + 62.4 %

Page 27: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Analyzing High-frequency Financial Data: Our ApproachConclusions

I. We have presented a time series summarization, annotation, and prediction framework based on the multiscale wavelet analysis to deal with nonstationary, volatile and high frequency financial data

II. Multiscale analysis can effectively deconstruct the total series into its constituent time scales: specific forecasting techniques can be applied to each timescale series to gain efficiency in forecast

III. Results of experiments performed on Intraday exchange data show promise for summarizing and predicting highly volatile time series

IV. Continuously evolving and randomly shocked economic systems demand for a more rigorous and extended analysis, which is being planned

V. Successful analysis of agents operating on several scales simultaneously and of modeling these components could result in more exact forecasts

Page 28: Series: Lecture Notes in Computer Science , Vol. 3177 ... · Financial Time Series Data Characteristics Evolve in a nonlinear fashion over time Exhibit quite complicated patterns,

Questions / Comments