bitcoin san francisco dev talk 6-23-14, tom johnson
TRANSCRIPT
![Page 1: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/1.jpg)
Bitcoin Algorithmic Trading with CoinTrader and R
Tom Johnson, PhDBitcoin SF Dev Group
6-23-2014
![Page 2: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/2.jpg)
Bitcoin Algo Trading DevelopmentObjective:
Make Money, Help Bitcoin,
Have Fun
![Page 3: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/3.jpg)
Why focus on Price rather than Pipes?
Price Volatility Big deterrent to public acceptance
Smooth rise good for all!
Big Opportunities for:Products - Derivatives, Transaction infoServices - Price guides, Block executionTrading/Arb - Hedging, Funds, Day-tradeCoins - Medium of xchg vs Store of value
![Page 4: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/4.jpg)
What does R have to contribute?
R is Open Source, Global, Data ScienceR script - Interactive, Algo development,
Prototyping, Live control, Easy to migratePackages - 5800, 120k functionsCommunity - Statistics & Machine LearningPros - Stable, fast math, answers/resourcesCons - Single threaded, in-memory, silosR tools well matched to Bitcoin challenges So are others like Python and ?
![Page 5: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/5.jpg)
So how volatile is Bitcoin?Compared with EURUSD?
![Page 6: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/6.jpg)
Compared with Gold?
![Page 7: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/7.jpg)
![Page 8: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/8.jpg)
![Page 9: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/9.jpg)
Comparing Bitcoin, EUR & Gold
![Page 10: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/10.jpg)
But getting out of, or into BTC will cost you
![Page 11: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/11.jpg)
And what you see isn’t what you get
![Page 12: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/12.jpg)
And nothing’s isolated; it impacts other Crypto, Home, Cross Pairs
![Page 13: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/13.jpg)
So what does Bitstamp’s BTCUSD Orderbook look like?
Demo with CoinTrader CSV file in AWS
![Page 14: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/14.jpg)
With all the turbulence - What about arbitrage opportunities?
![Page 15: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/15.jpg)
And there’s Triangular Arbitrage -- Demo Example
Priceonomics.com -- Find best 2-currency plus Bitcoin arbitrage among 3 currencies in live price feed:
Find most profitable sequence of transactions from any Chosen Home Currency, through an Intermediate Currency, then through Bitcoin and finally back to the Home Currency.
![Page 16: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/16.jpg)
Exchange Rates at a Point in Time
{USD_JPY: "95.7422091",USD_USD: "1.0000000",JPY_EUR: "0.0080872",BTC_USD: "105.5641218",...}
![Page 17: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/17.jpg)
R Script
xchgTable <- xchgTable()foreignCurrs <- allCurrs[!allCurrs %in% c(input$homeCurr, "BTC")]foreignAmts <- btcAmts <- endHomeAmts <- rep(0, length(foreignCurrs))names(foreignAmts) <- names(btcAmts) <- names(endHomeAmts) <- foreignCurrsfor (foreignCurr in foreignCurrs) { foreignAmts[foreignCurr] <- xchgTable[input$homeCurr, foreignCurr] * as.numeric(input$initHomeAmt) btcAmts[foreignCurr] <- xchgTable[foreignCurr, "BTC"] * foreignAmts[foreignCurr] endHomeAmts[foreignCurr] <- xchgTable["BTC", input$homeCurr] * btcAmts[foreignCurr] } maxArbCurr <- foreignCurrs[which.max(endHomeAmts)] cat(c("Trade", input$initHomeAmt, input$homeCurr, "to", round(foreignAmts[maxArbCurr],2), maxArbCurr, "to", round(btcAmts[maxArbCurr],6), "BTC", "to", round(endHomeAmts[maxArbCurr], 2), input$homeCurr, "which =", round(((endHomeAmts[maxArbCurr]/as.numeric(input$initHomeAmt) - 1) * 100), 2), "% Gross Gain"), "\n\n\n")
![Page 18: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/18.jpg)
Running in Amazon Cloud
AWS - Account, EC2, private key, static IPStack - AMI (Medium), Windows Server, Firefox, Google Drive, R, Shiny, RStudio, AppsSet up URL with AWS namespaces
Demo -- www.next1up.com
![Page 19: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/19.jpg)
Demo
Run Shiny App in cloudAccess through browserBasic - Calculate & DisplayNext - Monitor, Control & Execution
![Page 20: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/20.jpg)
![Page 21: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/21.jpg)
Machine Learning can help
Prediction & Classification Lots of raw, currrent data (CoinTrader
CSV)Code up savvy features Forget the scholarly modelsUse many non-linear methodsDon’t overfit or let the future leak in!Cross-validate, analyze resdualsPerformance going forward is what
matters!
![Page 22: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/22.jpg)
Steps to build robust Algos & Rules to Trade, Hedge, Place Limit Orders
Feature primitives -
Full feature variables - Differences, EMAs, etc.Data - Training, Testing, Reserved data testVariables - Bagging, Boosting, Selection Models - Trees, RF, GLM, GA, GP, EnsembleUse final code or live signal in CoinTrader
![Page 23: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/23.jpg)
The Take-AwayBuy when under valued;
Sell when over valued.Price changes faster and,
for reasons other, than value.Good information & analysis can help.The bigger the mispricing,
the bigger the opportunityWhether trading, products, services or
coins.Making money helps us all and Bitcoin!
![Page 24: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson](https://reader036.vdocument.in/reader036/viewer/2022062523/58f9a943760da3da068b6cd7/html5/thumbnails/24.jpg)
SourcesTom Johnson [email protected] Demo http://next1up.nethttps://www.linkedin.com/in/tom-johnson-62a16
Prices www.cryptocoincharts.infoAPIs www.quandl.com/markets/bitcoinCool www.bitlisten.comAnalyses www.priceonomics.comShiny www.rstudio.com/shiny