Using Concrete-Numpy to measure the feasibility of FHE on algorithmic trading

Hi,

I am currently a final year Physics student working on FHE and its applications of FFT. I have come up with an idea to measure quantisation of FHE in algorithmic trading. Basically just to see if its plausible. But I am having lots of difficulties with the installation. I just keep getting errors after error. Could someone help me with this?

Hello @Thomas_Hudson,

Could you provide information about your issue? The following would be great:

  • Your Operating System
  • Your Python Version
  • What you tried to run
  • What’s the error

Thanks!

1 Like

Hi,

I have managed to install it with the docker thing.

Do you have any tips on how I could go about this project. I’m hoping to essentially show that FHE is feasible for fast algorithmic trades on the stock market as part of my industrial group project into FHE and FFT, and I was advised by the people I’m working with at Optalysys to use the concrete libaries. I am thinking of setting up a simple trade, then encrypted the contents using the FHE, then test it using some quantization.

Thanks,
Thomas

Hello @Thomas_Hudson,

Great to know that you are trying our Concrete libraries ! I’m not exactly sure what you are trying to achieve here. Could you detail a bit more on what kind of computations or algorithms you want to run in FHE ?

Still, I see that you are talking about quantization. You could then try to use our Concrete-ML library as we provide several tools for quantizing floating points and retrieving some associated parameters (scale, zero-point) easily. Besides, we only support uniform quantization for now, and you need to provide the number of bits to use as an input.

from concrete.ml.quantization import QuantizedArray
import numpy

float_values = numpy.array([0.9, 8.1, -4.0, 5.7])

quantized_array = QuantizedArray(n_bits=2, values=float_values)

int_values = quantized_array.qvalues

print(int_values)
# [1 3 0 2]

print(quantized_array.quantizer.scale)
# 4.033333333333333

print(quantized_array.quantizer.zero_point)
# 1

Just to avoid confusion, this is done in the clear before any FHE computations as our FHE scheme (TFHE) currently handles computations over integers only.

Hope this helps !

Hi,
Thank you for your message, I was tasked with this

" it might be a good idea to make a study of the effects of quantisation (an essential practice in FHE) on the data and establish whether algorithmic trading and option trading (e.g to prevent exchanges from front-running trades) is viable under existing FHE models, which I’m fairly certain that it is. The Concrete FHE library will allow you to test and experiment with setting up an FHE computation (including circuit compilation and studying the effects of quantisation) without having to actually execute the process under FHE, which is extremely helpful for this kind of study (see the work in [Optalysys – Medium]"

I hope this helps,
I have downloaded concrete-numpy, but I will also download concrete-ML.

Thanks!

Thanks, it is indeed a bit more clear !

I hope you have been able to find the tools you needed for this project within Concrete-Numpy or Concrete-ML :slightly_smiling_face: