cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
test.py
Go to the documentation of this file.
1 # *****************************************************************************
2 # * cloudFPGA
3 # * Copyright 2016 -- 2022 IBM Corporation
4 # * Licensed under the Apache License, Version 2.0 (the "License");
5 # * you may not use this file except in compliance with the License.
6 # * You may obtain a copy of the License at
7 # *
8 # * http://www.apache.org/licenses/LICENSE-2.0
9 # *
10 # * Unless required by applicable law or agreed to in writing, software
11 # * distributed under the License is distributed on an "AS IS" BASIS,
12 # * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # * See the License for the specific language governing permissions and
14 # * limitations under the License.
15 # *----------------------------------------------------------------------------
16 
17 import sys
18 import os
19 import numpy as np
20 trieres_lib=os.environ['cFpRootDir'] + "HOST/quantitative_finance/mceuropeanengine/languages/python/build"
21 sys.path.append(trieres_lib)
22 
23 import _trieres
24 
25 
26 loop_nm = 1;
27 seed = 4332;
28 underlying = 202.56481854952224;
29 volatility = 0.005002151044533387;
30 dividendYield = 0.011160536907441138;
31 riskFreeRate = 0.008250879551073578;
32 timeLength = 1;
33 strike = 185.09682372241906;
34 optionType = 0;
35 requiredTolerance = 0.02;
36 requiredSamples = 100000;
37 timeSteps = 1;
38 maxSamples = 1;
39 
40 out = np.array([1.0,2.0]);
41 
42 out = _trieres.mceuropeanengine(loop_nm, "localhost", "2718",
43  seed,
44  underlying,
45  volatility,
46  dividendYield,
47  riskFreeRate,
48  timeLength,
49  strike,
50  optionType,
51  requiredTolerance,
52  requiredSamples,
53  timeSteps,
54  maxSamples);
55 
56 print(out)