The computation was conducted on the Intel(R)
Core(R) CPU i7-7820HQ @ 2.9GHz with 16GB
RAM. The task consisted of the following steps: (1)
200 AAPL share prices were encrypted, (2) MACD
analysis was performed, (3) encrypted trading deci-
sions were generated and (4) the decisions were de-
crypted. The time required to produce the MACD
signal as well as the trading decision for a single day
were measured and summarised in table 3. The trad-
ing indicator implemented with SEAL can also run on
1-second candles and HEAAN implementation can be
applied to 15-seconds candles. The total time con-
sumed per data unit is 0.99 and 12.34 seconds for
SEAL and HEAAN implementations respectively.
Table 2: Performance of MACD and decision analysis.
Method Computation Time
MACD-SEAL 0.73 sec
MACD-HEAAN 7.085 sec
Decision-SEAL 0.26 sec
Decision-HEAAN 5.255 sec
Total-SEAL 0.99 sec
Total-HEAAN 12.34 sec
At this point, there are two significant limitations
in our implementation. Firstly, the lack of recursion
reduces the decision accuracy as the multiplicative
depth is constrained by the HE parameters. Although,
HEAAN supports bootstrapping, it introduces sub-
stantial noise and is also computationally intensive
(Acar et al., 2018). Therefore, we did not implement
bootstrapping in our approach. Secondly, operation
of bootstrapping is slow, due to the absence of logi-
cal and relational operators in the state-of-the-art HE
libraries. Only approximate decisions can be imple-
mented. However, the presented algorithm accurately
implements the MACD indicator and could be applied
in the real world applications.
6 CONCLUSIONS
We have implemented the MACD indicator on a stock
price time-series. To the best of our knowledge, this
is the first time HE methods are applied to finan-
cial time-series analysis. The algorithm implemented
with SEAL is able to produce the trading indicator in
less than a second and could be applied to 1-second
candle data as well as to lower resolution data. For
the future work we plan to implement linear systems
and corresponding recessive AR and MA based fil-
ters, including exponential moving average.
REFERENCES
Acar, A., Aksu, H., Uluagac, A. S., and Conti, M. (2018).
A survey on homomorphic encryption schemes: The-
ory and implementation. ACM Computing Surveys
(CSUR), 51(4):1–35.
Appel, G. (1979). The moving average convergence-
divergence method. Great Neck, NY: Signalert, pages
1647–1691.
Appel, G. (2003). Become your own technical analyst: How
to identify significant market turning points using the
moving average convergence-divergence indicator or
macd. The Journal of Wealth Management, 6(1):27–
36.
Aslett, L. J., Esperanc¸a, P. M., and Holmes, C. C. (2015).
A review of homomorphic encryption and software
tools for encrypted statistical machine learning. arXiv
preprint arXiv:1508.06574.
Brakerski, Z. and Vaikuntanathan, V. (2014). Efficient fully
homomorphic encryption from (standard) lwe. SIAM
Journal on Computing, 43(2):831–871.
Burkhalter, L., Hithnawi, A., Viand, A., Shafagh, H., and
Ratnasamy, S. (2020). Timecrypt: Encrypted data
stream processing at scale with cryptographic access
control. In 17th {USENIX} Symposium on Networked
Systems Design and Implementation ({NSDI} 20),
pages 835–850.
Chen, H., Dai, W., Kim, M., and Song, Y. (2019). Efficient
multi-key homomorphic encryption with packed ci-
phertexts with application to oblivious neural network
inference. In Proceedings of the 2019 ACM SIGSAC
Conference on Computer and Communications Secu-
rity, pages 395–412.
Chen, H., Laine, K., and Player, R. (2017). Simple en-
crypted arithmetic library-seal v2. 1. In International
Conference on Financial Cryptography and Data Se-
curity, pages 3–18. Springer.
Cheon, J. H., Han, K., Kim, A., Kim, M., and Song, Y.
(2018). Bootstrapping for approximate homomorphic
encryption. In Annual International Conference on
the Theory and Applications of Cryptographic Tech-
niques, pages 360–384. Springer.
Cheon, J. H., Kim, A., Kim, M., and Song, Y. (2017). Ho-
momorphic encryption for arithmetic of approximate
numbers. In International Conference on the Theory
and Application of Cryptology and Information Secu-
rity, pages 409–437. Springer.
Gentry, C. and Boneh, D. (2009). A fully homomorphic
encryption scheme, volume 20. Stanford: Stanford
university.
Numer.ai (2019). The hardest data science tournament on
the planet. $1000000 paid out. https://numer.ai/. Ac-
cessed on: 2020-02-14.
SEAL (2019). Microsoft SEAL (release 3.4). https:
//github.com/Microsoft/SEAL. Microsoft Research,
Redmond, WA.
Shi, E., Chan, T. H., Rieffel, E., Chow, R., and Song, D.
(2011). Privacy-preserving aggregation of time-series
data. In Proc. NDSS, volume 2, pages 1–17. Citeseer.
Zhu, H., Meng, X., and Kollios, G. (2014). Privacy preserv-
ing similarity evaluation of time series data. In EDBT,
pages 499–510.
A Trend-following Trading Indicator on Homomorphically Encrypted Data
607