Message Boards Message Boards

How to implement this Bayesian Regression Algorithm?

Posted 9 years ago

I want to implement a Bayesian Regression Algorithm (see the link here: http://arxiv.org/pdf/1410.1231.pdf ) in Mathematica to predict Bitcoin prices (BTC/USD pair). I want to implement it on historical BTC/USD (Bitcoin/US Dollar) price data sourced from Quandl.com in Excel format. I have attached here both the algorithm document (PDF) and curated BTC/USD 1012- 2014 price data(Excel). Plz help!

POSTED BY: Aryan Howl
4 Replies

This is a full project and a bit too much to cover in a single thread on a forum. Let's begin by breaking your task up.

  1. Can you import the data from Quandl? Quandl has documentation on how to use their API. You can use the Quandl API with either the Import function or the URLFetch function. What is the URL for the query you want to make from the Quandl API?

  2. Let's first try some simple predictive modeling on the time series before trying to implement an algorithm from a paper. Can you use TimeSeriesForecast on your data?

POSTED BY: Sean Clarke

This URL: https://www.quandl.com/data/BITSTAMP/USD-USD-BITCOIN-Exchange-Rate Is just a webpage. What you want is the URL that uses the quandl API. In this case, you want:

data = Import["https://www.quandl.com/api/v1/datasets/BITSTAMP/USD.csv"]

Please see quandl's documentation on how to use their API: https://www.quandl.com/help/api

POSTED BY: Sean Clarke
Posted 9 years ago

Hi Sean,

Thanks for your response. I want to fetch the following URL: https://www.quandl.com/data/BITSTAMP/USD-USD-BITCOIN-Exchange-Rate Alternatively I want to import near real-time BTC/USD market price with 15minutes delay from: https://blockchain.info/api/exchange_rates_api

{
  "USD" : {"15m" : 478.68, "last" : 478.68, "buy" : 478.55, "sell" : 478.68,  "symbol" : "$"},
  "JPY" : {"15m" : 51033.99, "last" : 51033.99, "buy" : 51020.13, "sell" : 51033.99,  "symbol" : "¥"},
  "CNY" : {"15m" : 2937.05, "last" : 2937.05, "buy" : 2936.25, "sell" : 2937.05,  "symbol" : "¥"},
  "SGD" : {"15m" : 605.39, "last" : 605.39, "buy" : 605.22, "sell" : 605.39,  "symbol" : "$"},
  "HKD" : {"15m" : 3709.91, "last" : 3709.91, "buy" : 3708.9, "sell" : 3709.91,  "symbol" : "$"},
  "CAD" : {"15m" : 526.72, "last" : 526.72, "buy" : 526.58, "sell" : 526.72,  "symbol" : "$"},
  "NZD" : {"15m" : 582.26, "last" : 582.26, "buy" : 582.1, "sell" : 582.26,  "symbol" : "$"},
  "AUD" : {"15m" : 524.61, "last" : 524.61, "buy" : 524.46, "sell" : 524.61,  "symbol" : "$"},
  "CLP" : {"15m" : 283014.81, "last" : 283014.81, "buy" : 282937.95, "sell" : 283014.81,  "symbol" : "$"},
  "GBP" : {"15m" : 297.4, "last" : 297.4, "buy" : 297.32, "sell" : 297.4,  "symbol" : "£"},
  "DKK" : {"15m" : 2756.84, "last" : 2756.84, "buy" : 2756.09, "sell" : 2756.84,  "symbol" : "kr"},
  "SEK" : {"15m" : 3403.41, "last" : 3403.41, "buy" : 3402.49, "sell" : 3403.41,  "symbol" : "kr"},
  "ISK" : {"15m" : 56797.78, "last" : 56797.78, "buy" : 56782.35, "sell" : 56797.78,  "symbol" : "kr"},
  "CHF" : {"15m" : 447.19, "last" : 447.19, "buy" : 447.07, "sell" : 447.19,  "symbol" : "CHF"},
  "BRL" : {"15m" : 1093.06, "last" : 1093.06, "buy" : 1092.77, "sell" : 1093.06,  "symbol" : "R$"},
  "EUR" : {"15m" : 370.13, "last" : 370.13, "buy" : 370.03, "sell" : 370.13,  "symbol" : "€"},
  "RUB" : {"15m" : 17806.28, "last" : 17806.28, "buy" : 17801.44, "sell" : 17806.28,  "symbol" : "RUB"},
  "PLN" : {"15m" : 1557.38, "last" : 1557.38, "buy" : 1556.96, "sell" : 1557.38,  "symbol" : "z?"},
  "THB" : {"15m" : 15398.04, "last" : 15398.04, "buy" : 15393.86, "sell" : 15398.04,  "symbol" : "?"},
  "KRW" : {"15m" : 494436.55, "last" : 494436.55, "buy" : 494302.27, "sell" : 494436.55,  "symbol" : "?"},
  "TWD" : {"15m" : 14340.68, "last" : 14340.68, "buy" : 14336.79, "sell" : 14340.68,  "symbol" : "NT$"}
  }

Here’s the instructions on the webpage: URL: https://blockchain.info/tobtc Convert x value in the provided currency to btc. ex: https://blockchain.info/tobtc?currency=USD&value=500 Parameters

  • currency - A currency code. See list above.
  • value - Value to convert.

Returns the value in BTC.

I can use TimeSeriesForecast function but please give me some examples how to use BTC/USD Data to be imported from the above APIs/URLs.

POSTED BY: Aryan Howl

Have you checked out the "BTCpredictor" code on github yet? https://github.com/panditanvita/BTCpredictor

POSTED BY: Dylan Jorgensen
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract