搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  Density Estimation of HighFrequency Financial Data.pdf
资料下载链接地址: https://bbs.pinggu.org/a-1750860.html
附件大小:
717.84 KB   举报本内容
Frequently we will want to estimate the empirical probability density function of real-world data and compare it to the theoretical density from one or more probability distributions. The following example shows the empirical and theoretical normal density for EUR/USD high-frequency tick data
  1. # Function that reads Reuters CSV tick data and converts Reuters dates
  2. # Assumes format is Date,Tick
  3. readRTD <- function(filename) {
  4. tickData <- read.csv(file=filename, header=TRUE, col.names=c("Date","Tick"))
  5. tickData$Date <- as.POSIXct(strptime(tickData$Date, format="%d/%m/%Y %H:%M:%S"))
  6. tickData
  7. }

  8. # Boilerplate function for Reuters FX tick data transformation and density plot
  9. plot.reutersFXDensity <- function() {
  10. filenames <- c("data/eur_usd_tick_26_10_2007.csv",
  11. "data/eur_usd_1min_26_10_2007.csv",
  12. "data/eur_usd_5min_26_10_2007.csv",
  13. "data/eur_usd_hourly_26_10_2007.csv",
  14. "data/eur_usd_daily_26_10_2007.csv")
  15. labels <- c("Tick", "1 Minute", "5 Minutes", "Hourly", "Daily")

  16. par(mfrow=c(length(filenames), 2),mar=c(0,0,2,0), cex.main=2)
  17. tickData <- c()
  18. i <- 1
  19. for (filename in filenames) {
  20. tickData[[i]] <- readRTD(filename)
  21. # Transform: `$Y = \nabla\log(X_i)[color=#373737][b]Frequently we will want to estimate the empirical probability density function of real-world data and compare it to the theoretical density from one or more probability distributions. The following example shows the empirical and theoretical normal density for EUR/USD high-frequency tick data [/b][/color]
  22. logtick <- diff(log(tickData[[i]]$Tick))
  23. # Normalize: `$\frac{(Y-\mu_Y)}{\sigma_Y}[color=#373737][b]Frequently we will want to estimate the empirical probability density function of real-world data and compare it to the theoretical density from one or more probability distributions. The following example shows the empirical and theoretical normal density for EUR/USD high-frequency tick data [/b][/color]
  24. logtick <- (logtick-mean(logtick))/sd(logtick)
  25. # Theoretical density range: `$\left[\lfloor\mathrm{min}(Y)\rfloor,\lceil\mathrm{max}(Y)\rceil\right][color=#373737][b]Frequently we will want to estimate the empirical probability density function of real-world data and compare it to the theoretical density from one or more probability distributions. The following example shows the empirical and theoretical normal density for EUR/USD high-frequency tick data [/b][/color]
  26. x <- seq(floor(min(logtick)), ceiling(max(logtick)), .01)
  27. plot(density(logtick), xlab="", ylab="", axes=FALSE, main=labels[i])
  28. lines(x,dnorm(x), lty=2)
  29. #legend("topleft", legend=c("Empirical","Theoretical"), lty=c(1,2))
  30. plot(density(logtick), log="y", xlab="", ylab="", axes=FALSE, main="Log Scale")
  31. lines(x,dnorm(x), lty=2)
  32. i <- i + 1
  33. }
  34. par(op)
  35. }
复制代码

上面的代码解疑:

https://bbs.pinggu.org/thread-3622629-1-1.html


大数据研究:

https://bbs.pinggu.org/thread-3621697-1-1.html


文献:

[hide][/hide]





    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

GMT+8, 2026-1-14 03:07