0
$\begingroup$
  1. I'm trying to analyze financial market time series data, so are there any particular concerns in using FFT for that kind of data? The data seems to be relatively covariance stationary.

  2. My sampling time interval is $Δt = 1$ $month$, so my sampling frequency is $f_s = 1/Δt = 1$ $month^{-1}$. There are $N = 312$ samples, which I've binned starting at $n = 0$ and ending at $n = N - 1 = 311$. Is this OK, or is it better to bin starting at $n = 1$ and ending at $n = N = 312$ or in some other way? Do FFT packages like scipy.fft care about where you start binning? See Tables A - B.

    Table A: Time Domain Binning from $n = 0$ to $n = N - 1$

    Sample Index, $n$ Time, $t$ (Months) Signal, $x$
    0 0 -1.967794994
    1 1 -2.072173571
    2 2 -2.320100763
    3 3 -1.008703001
    ... ... ...
    309 309 1.375794513
    310 310 1.920672935
    311 311 2.259456796

    Table B: Time Domain Binning from $n = 1$ to $n = N$

    Sample Index, $n$ Time, $t$ (Months) Signal, $x$
    1 0 -1.967794994
    2 1 -2.072173571
    3 2 -2.320100763
    4 3 -1.008703001
    ... ... ...
    310 309 1.375794513
    311 310 1.920672935
    312 311 2.259456796
    1. I'm concerned about the binning because the magnitude of my first FFT (|FFT|) output does not follow the expected symmetry of an FFT as you can see in Table C. |FFT| for $m = 0$ should equal |FFT| for $m = 311$, but it doesn't. That symmetry begins at $m = 1$. Why is the $m = 0$ output essentially zero? It seems like a garbage output. The real output seems to begin at $m = 1$.

    Table C: Frequency Domain, |FFT| at m = 0 not equal to |FFT| at m = 311 (not symmetric)

    Freq Index, $m$ Freq, $f$ (1/Month) Magnitude of FFT
    0 0 0.00000000000000266
    1 0.00320512820512821 45.9818376
    2 0.00641025641025641 11.70562162
    3 0.00961538461538462 30.74407958
    4 0.0128205128205128 23.24723405
    ... ... ...
    308 0.987179487179484 23.24723405
    309 0.990384615384612 30.74407958
    310 0.993589743589741 11.70562162
    311 0.996794871794869 45.9818376
  3. I'm also wondering about how to interpret the |FFT| depending on whether we plot over frequency domains $0 <= f < f_s$ or $-f_s/2 <= f < f_s/2$. Because this is financial data, I don't think negative frequencies make as much sense as if this data were something like an electrical signal. However, if I ignore the negative frequencies, what information am I losing since plotting from $0$ to $f_s$ would capture the whole signal.

So which is the right frequency domain to analyze: $[0, f_s)$, $[-f_s/2, f_s/2)$, $[0, f_s/2)$ or $[-f_s/2, 0)$? I think RF signal engineers figure this out for RF signals by using the sampling rate. I don't really have any notion as to what the "sampling rate" would be in this case since I'm not generating the time domain signal with a squarewave generator like I might with a radio or electrical signal. This is market data.

Thanks in advance.

$\endgroup$

1 Answer 1

1
$\begingroup$

As far as using the FFT to analyze financial data; that really depends on what you are looking for. The FFT can give an indication of cyclical patterns if they exist.

The FFT for bin 0 should not equal the FFT for bin 311, but rather it is the FFT for bin 1 that will equal the FFT for bin 311 (when the time data is real). Bin 0 is the "DC" bin, and bin 1 is the first positive frequency. Bin 311 is the first negative frequency.

For a simple example, consider the N=9 bin FFT shown below. Bin 0 is the "DC Bin", Bin 1 to 4 are the positive frequencies as 1 to 4, and bins 5 to 8 are the negative frequencies, with bin 8 mapping to -1, bin 7 mapping to -2, bin 6 mapping to -3 and bin 5 mapping to -4.

FFT

If the time domain data is real (which I assume it is in this case), then you can avoid the negative frequencies since they will be redundant as a complex conjugate copy of the positive frequencies. With that the frequencies to analyze would be $[0, f_s/2)$.

Why is the m=0 output essentially zero? It seems like a garbage output.

m=0 is the "DC bin" so if it is essentially zero it means there is no "DC", which means the time domain data has a mean value close to 0.

$\endgroup$
3
  • $\begingroup$ This is very helpful, thanks. Analyzing frequencies [0, f_s) makes sense, but it does bring up some other questions, which I'll ask in a separate post. Thanks again! $\endgroup$ Commented Apr 6 at 15:53
  • $\begingroup$ Note that most FFT packages include a variant of the FFT that takes $N$ points of real data and returns $N/2 + 1$ points (for $N \in \mathrm{even}$) or $(N+1)/2$ points (for $N \in \mathrm{odd}$). It gives some speedup, and a lot of reduction in necessary storage. $\endgroup$
    – TimWescott
    Commented Apr 6 at 17:14
  • $\begingroup$ @Dan Boschen Here's the post to my follow-up question: "Binning and Frequency for FFT on Financial Time Series Data" $\endgroup$ Commented Apr 8 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.