aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--R/beta_trade.R9
-rw-r--r--python/experiments/test_async.py20
2 files changed, 27 insertions, 2 deletions
diff --git a/R/beta_trade.R b/R/beta_trade.R
index 49e8a6b2..8a5ea123 100644
--- a/R/beta_trade.R
+++ b/R/beta_trade.R
@@ -1,9 +1,14 @@
library(timeSeries)
library(MTS)
+library(Rblpapi)
-data <- feather::read_feather("/home/share/CorpCDOs/data/index_returns.fth")
+blpConnect(host='192.168.9.61')
+
+data <- feather::read_feather("/home/serenitas/CorpCDOs/data/index_returns.fth")
data$date <- as.Date(data$date)
-returns <- timeSeries(data[,c("ig", "hy")], data$date)
+df <- bdh(paste("VIX", "Index"), "PX_LAST", start.date=as.Date("2009-03-20"))
+df <- as.tibble(df)
+
R <- na.omit(returns)
R <- scale(R, scale=F)
chol <- MCholV(na.omit(returns))
diff --git a/python/experiments/test_async.py b/python/experiments/test_async.py
new file mode 100644
index 00000000..8a9fca38
--- /dev/null
+++ b/python/experiments/test_async.py
@@ -0,0 +1,20 @@
+import asyncio
+
+async def pomme():
+ while True:
+ await asyncio.sleep(1)
+ print("pomme")
+
+async def poire():
+ while True:
+ await asyncio.sleep(5)
+ print("poire")
+
+async def main():
+ while True:
+ await pomme()
+ await poire()
+
+if __name__ == "__main__":
+ loop = asyncio.get_event_loop()
+ loop.run_until_complete(asyncio.gather(pomme(), poire()))