Skip to content

Instantly share code, notes, and snippets.

@creative-quant
creative-quant / cot.cad.R
Created February 4, 2015 18:40
COT - CAD
############################################################
## Content of the Traders in Financial Futures (TFF) Report
## http://www.cftc.gov/ucm/groups/public/@commitmentsoftraders/documents/file/tfmexplanatorynotes.pdf
############################################################
# Dealer/Intermediary
# These participants are what are typically described as the "sell side” of the market. Though they
# may not predominately sell futures, they do design and sell various financial assets to clients.
# They tend to have matched books or offset their risk across markets and clients. Futures
# contracts are part of the pricing and balancing of risk associated with the products they sell and
# their activities. These include large banks (U.S. and non-U.S.) and dealers in securities, swaps
@creative-quant
creative-quant / cadvswti.R
Last active August 29, 2015 14:14
CAD vs WTI
#sources
#https://www.quandl.com/CURRFX/USDCAD-Currency-Exchange-Rates-USD-vs-CAD
#curl https://www.quandl.com/api/v1/datasets/CURRFX/USDCAD.csv -o /tmp/USDCAD.csv
#https://www.quandl.com/DOE/RWTC-WTI-Crude-Oil-Spot-Price-Cushing-OK-FOB
#curl https://www.quandl.com/api/v1/datasets/DOE/RWTC.csv -o /tmp/RWTC.csv
library(xts)
library(ggplot2)
usd.cad <- read.csv("/tmp/USDCAD.csv")
@creative-quant
creative-quant / ib.eurusd.R
Last active August 29, 2015 14:13
R - IBrokers - Historical Currency Data
library(IBrokers)
library(twsInstrument)
tws <- twsConnect(host='127.0.0.1', port=4001)
contract <- getContract("EUR.USD")
reqHistoricalData( tws, contract, verbose=T, whatToShow="BID" )
reqHistoricalData( tws, contract, verbose=T, whatToShow="ASK" )
twsDisconnect(tws)