蒙特卡罗方法计算VAR的并行实现

  • 格式:pdf
  • 大小:1.74 MB
  • 文档页数:4

1 串行算法
1.1 蒙的随机模型和分布,并估计相
关参数。由于资产价值的变动在时间上不相关,其离散形式
可表示为:
∆St=+1 St (µ∆t + σε ∆t ) ∆St+1 = St+1 − St
(1)
其中 St 表示 t 时刻的资产价格,即 t 时刻的收盘价,μ 表示资产收益率的均值,σ 表示资产收益率的标准差,ε 表示
St ST* St [α*N-1]
随机变量。
(2)随机模拟价格走势。先生成正态随机数 εi(i=1,2,… ,n)。假设 t 为当前时刻,T 为目标时刻,在 t 时刻对 T 时刻
的价格进行模拟,记 τ=T - t 是时间间隔, ∆t =τ / n,当前
的价格为 Si,根据上述随机模型,按 (i=1,2,…,n) 依次产生相
应的模拟价格:
2017 年第 5 期
信息与电脑 China Computer&Communication
蒙特卡罗方法计算 VAR 的并行实现
算法语言
周 阳
(中国石油大学(华东) 理学院,山东 青岛 266580)
摘 要:当今经济全球化、金融全球化进程加快,市场竞争愈演愈烈。建立一个良好的风险管理系统已成为各金融 单位面临的重要问题。在众多的风险管理方法中最具代表性的是 Value at Risk(VAR)方法。而计算 VAR 常见的三种方 法中,Monte Carlo 模拟最为有效。由于蒙特卡罗模拟需要大量数据,所以并行计算在计算 VAR 中非常重要。笔者基于 Monte Carlo 方法计算 VAR 的原理构造 C++ 算法,并用基于 API、OpenMP、MPI 三种多核并行算法,比较分析出了适合科 学计算研究的并行算法。
St+1 = St + St (µ∆t + σε1 ∆t )
(2)
St+=2 St+1 + St+1(µ∆t + σε 2 ∆t )
S= t+n St+n−1 + St+n−1(µ∆t + σε n ∆=t ) ST
这样就模拟出了资产价格 S 的未来走势及目标时刻 T 的 资产价格 ST。
(3)计算 VAR。多次重复第二步,这样就得到目标时
2017 年第 5 期
到下方 100α%的分位数ST* ,则可以计算置信水平为(1 - α)
的 VAR:
VAR= St − ST*
(3)
1.2 模型简化
(1)本文预测下一个交易日的 VAR,即 ∆t =1 。
(2)本文假定 ε~N(0,1)。 (3)在置信度为(1 - α)下,分位数ST*为STi 按从小到 大排列第 α*N 个数。
刻 T 时的一系列资产价格 ST1 , ST2 ,, STk (重复 k 次)。将 T 时 刻的价格按升序排列,在给定置信水平为(1 - α)下,找
作者简介:周阳(1996-),女,黑龙江青冈人,本科在读。研究方向:高性能并行计算。 — 109 —
算法语言
信息与电脑 China Computer&Communication
WINAPI threadCalcPI(LPVOID arg)) 将 模 拟 n 次 计 算 St 的任务分到不同线程中,将计算量分开,确保各线程上计算 不会相互影响,只需要最后将数据收集起来排序之后就可以 得到正确结果。
具体图解如图 2 所示:
1.3 程序流程图
VAR 算法流程如图 1 所示:
St
关键词:在险价值;并行算法;API;OpenMP;MPI 中图分类号:TL329.2 文献标识码:A 文章编号:1003-9767(2017)05-109-04
Monte Carlo Method for Parallel Implementation of VAR
Zhou Yang
(College of Science, China University of Petroleum, Qingdao Shandong 266580, China) Abstract: Nowadays, the economic globalization and financial globalization are speeding up, and the market competition is becoming much fiercer. Establishing a good risk management system has become an important issue for financial institutions. Among the many risk management methods, the most representative is the Value at Risk (VAR) method. Among the three common methods for computing VAR, the Monte Carlo simulation is most effective. Since Monte Carlo simulation requires a large amount of data, parallel computing is very important in computing VAR. The author calculates the principle of VAR and constructs C++ algorithm based on the Monte Carlo method, and compares parallel algorithms based on API, OpenMP, MPI and three multi-core parallel algorithms to compare the parallel algorithms which are suitable for scientific computing research. Key words: insurance value; parallel algorithm; API; OpenMP; MPI