Transcript
Page 2: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson

Bitcoin Algo Trading DevelopmentObjective:

Make Money, Help Bitcoin,

Have Fun

Page 3: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson

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

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

So how volatile is Bitcoin?Compared with EURUSD?

Page 6: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson

Compared with Gold?

Page 7: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson
Page 8: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson
Page 9: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson

Comparing Bitcoin, EUR & Gold

Page 10: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson

But getting out of, or into BTC will cost you

Page 11: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson

And what you see isn’t what you get

Page 12: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson

And nothing’s isolated; it impacts other Crypto, Home, Cross Pairs

Page 13: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson

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

With all the turbulence - What about arbitrage opportunities?

Page 15: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson

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

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

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

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

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
Page 21: Bitcoin San Francisco Dev Talk 6-23-14, Tom Johnson

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

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

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

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


Top Related