﻿ Where can I get historic data series of Bitcoin prices?

# Where can I get historic data series of Bitcoin prices?

• Where can I get historic data series of Bitcoin prices?
• Request URL:http://bitcoincharts.com/charts/chart.json?m ...
• Bitcoin Charts Usd – Currency Exchange Rates
• Bitcoin
• Bitcoincharts Charts ##### Another way to look at the bubbles

This is a follow up to a post I made a couple of days ago looking at the log-linear regression of bitcoin prices:
This post is going to look at this regression again, but this time using it to make comparisons between Bitcoin's bubbles.
One way to compare Bitcoin's bubble periods is by categorizing periods on the basis of how far away they are from the regression line. The set of these distance measures is known as the 'residuals'. What I've done in this chart is colour code each price depending on where on a set of ranges its residual value falls.
http://i.imgur.com/y1Klgum.png
How did I select the ranges I did? Semi-arbitrarily (if anyone knows of a less-arbitrary way to do this let me know). The residuals seem to cluster to some degree around certain ranges when you look at them in a histogram. So that's why I chose the ranges that I did.
http://i.imgur.com/FbqtIfV.png
What I think a chart like this is representing is how far away bitcoin is from its exponential growth trend. So a bubble is interpreted relative to that growth trend and not its absolute growth in value. This gives different results from when you just look at absolute price growth.
For example - if you compare the 2012/13 bubble with the 2013/14 bubble on the basis of the absolute amount of price growth then the former of these is the larger bubble with about 13x price growth compared to about 8x. But from the perspective of the price relative to the exponential growth trend, the latter is clearly larger. How is this possible, you can see it easily from the chart. The 2012/13 bubble came off a much larger slump relative to the trend (a blue zone) - whereas the 2013/14 bubble had less ground to make up. It started in a green zone. Furthermore, while the 2012/13 bubble makes it into the orange zone - it only stays there briefly. It's really mostly a yellow level event. The 2013/14 bubble is is definitively an orange level event and even gets into the red zone for a day.
The 2011 bubble is less interesting from this perspective since it is big in all respects - both price growth and its residuals. Notice also how some quite large price increases (3x in jun-aug 2012) don't even count as bubbles on this analysis even though they have the same triangle shape as the others.
In terms of the current downtrend it provides an extra rationalisation as to why things aren't that grim. We are currently in a green period - which is the most common colour by far. Green is not a bad place to be if you care about whether or not Bitcoin is maintaining its long term trend. Blue is where things start to get concerning. If that chart ever registers a significant period of purple - that's when I'm going to start to freak out for bitcoin's long term future.
As always - take this stuff with large pinches of salt. If you look at this stuff yourself, I recommend trying to come up with alternative (principled) ways of choosing your colour regions. You can also experiment with using different time frames. If you start your regression at the beginning of the 2012/13 bubble then it becomes much larger than the 2013/14 bubble. I personally don't think this is appropriate if you are looking at the long term exponential growth - but you gotta bear it in mind.
One other thing - this data swaps from the mtgox to bitstamp data. I feel mtgox data is generally to be avoided, because of the way it skewed the market - but it's all we have from the early periods.
Here is the code for those who want to play. About to hit the town for some booze n ladies... so won't respond to comments questions (if any) until tomorrow. :)
`import json, requests import pandas as pd import numpy as np import datetime as dt import operator import matplotlib.pyplot as plt import matplotlib.dates as mdates def get_data(api_name): ''' pulls data from the quandl api api_name either 'BITSTAMPUSD' or 'MTGOXUSD' ''' url = 'http://www.quandl.com/api/v1/datasets/BITCOIN/{0}.json'.format(api_name) r = requests.get(url) raw_data = r.json() # put the data in a Pandas DataFrame object data = pd.DataFrame(raw_data['data'], columns=raw_data['column_names']) # change the order so the earliest records are first data = data.reindex(index=data.index[::-1]) # reset the index order increasing from 0 data['i'] = range(0,len(data)) data = data.set_index('i') return data bitstamp_data = get_data('BITSTAMPUSD') mtgox_data = get_data('MTGOXUSD') #change the dates to python datetime objects bitstamp_data['Date'] = pd.to_datetime(bitstamp_data['Date']) mtgox_data['Date'] = pd.to_datetime(mtgox_data['Date']) # select the mt gox data prior to bitstamp pre_bitstamp = mtgox_data[(mtgox_data['Date'] < bitstamp_data['Date'])] # whack the mtgox and bitstamp data together data = pre_bitstamp.append(bitstamp_data) data['i'] = range(0,len(data)) data = data.set_index('i') # Data has some bad values. Replace them with previous days data # First replace the bad values with a NaN value data.loc[(data['Open']==1.7e+308), 'Open':] = np.nan # now replace the NaN values with the previous days values data = data.fillna(method='pad') # create X and Y for the regression X = pd.DataFrame(index=data.index) X['0'] = 1 X['1'] = data.index # convert the price data to a log10 scale Y = pd.DataFrame(index=data.index) Y['0'] = np.log10(data.loc[:, 'Weighted Price']) # convert to numpy matrices for use in the normal equation X = X.as_matrix() Y = Y.as_matrix() # Normal equation (works much better than gradient descent in this case) X_T = X.transpose() theta = np.linalg.inv(X_T.dot(X)).dot(X_T).dot(Y) # use theta to plot the regression regress = X.dot(theta) # create a histogram of the residuals (difference between actual and predicted values) diff = Y - regress bins = np.linspace(diff.min()-0.2, diff.max()+0.2 , 80) plt.hist(diff, bins) plt.show() # select groups of residuals for colouring # ranges are selected on the (semi-arbitrary) basis of how they appear to be grouped in the # histogram above. purple = ((diff > -1.0) & (diff < -0.65)).flatten() blue = ((diff > -0.65) & (diff < -0.31)).flatten() green = ((diff > -0.31) & (diff < 0.0)).flatten() yellow = ((diff > 0.0) & (diff < 0.27)).flatten() orange = ((diff > 0.27) & (diff < 0.6)).flatten() red = ((diff > 0.6) & (diff < 1)).flatten() pink = (diff > 1.0).flatten() # Create the chart # Let matplotlib do the work of selecting date ticks plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d')) plt.gca().xaxis.set_major_locator(mdates.AutoDateLocator()) # plotting the raw price data and then log scaling the chart plt.plot(data['Date'], data['Weighted Price']) # regression data is already in log scale, so scale it back up. plt.plot(data['Date'], 10 ** regress) # apply the log scale to the chart plt.axes().set_yscale('log') plt.xlabel('Date') plt.ylabel('Price (USD)') plt.grid() # Plot the residuals plt.scatter(data['Date'][purple], data['Weighted Price'][purple], marker='x', c='#2E0854', label="-1.0 < res < -0.65") plt.scatter(data['Date'][blue], data['Weighted Price'][blue], marker='x', c='b', label="-0.65 < res < -0.31") plt.scatter(data['Date'][green], data['Weighted Price'][green], marker='x', c='g', label="-0.31 < res < 0.0") plt.scatter(data['Date'][yellow], data['Weighted Price'][yellow], marker='x', c='y', label="0.0 < res < 0.27") plt.scatter(data['Date'][orange], data['Weighted Price'][orange], marker='x', c='#FF6600', label="0.27 < res < 0.6") plt.scatter(data['Date'][red], data['Weighted Price'][red], marker='x', c='r', label="0.6 < res < 1.0") plt.scatter(data['Date'][pink], data['Weighted Price'][pink], marker='x', c='#ff69b4', label="1.0 < res") # add the legend handles, labels = plt.axes().get_legend_handles_labels() plt.legend(handles, labels, loc=2) plt.show() `

##### What is the price of a Mtgox Dollar?

The price of a mtgoxBTC is artificially high because the price of a mtgoxUSD is artificially low (no one wants mtgoxUSD because they have to wait months to withdraw)
The price of bitstampBTC is artificially low because people get their USD out of mtgox by buying BTC and then selling those BTC at other USD/BTC exchanges.
I thought I'd do some back of the napkin calculations to try and quantify the market price of a mtgox dollar.
I'll use the non-USD exchange pair that has the highest volume to try and figure out the true price of a bitcoin.
At btcchina: 1 BTC = 984.53 CNY
Globally: 1 CNY = 0.164 USD
Assuming btcchina isn't having any liquidity problems of their own, the true price of a bitcoin is about:
1 BTC = 984.53/0.164
1 BTC = \$161.47 USD.
Let's use the Mtgox and Bitstamp BTC prices to try and find out how much mtgoxUSD and bitstampUSD are really worth.
At Mtgox: 1 BTC = 173.00 USD
mtgoxUSD = 161.47/173 = \$0.93 USD
Assuming bitstamp isn't having any liquidity problems either,
At bitstamp: 1 BTC = 155.30 USD
bitstampUSD = 161.47/155.30 = \$1.04 USD.
In conclusion,
1 mtgoxUSD = \$0.93 USD
1 "Mtgox Buck" is only 93 cents. If you deposit a dollar in Mtgox, it'll only be worth 93 cents by the time it gets there.
1 bitstampUSD = \$1.04 USD.
1 "Bitstamp Buck" is worth \$1.04. If you help people escape from Mtgox by buying their BTC with USD, you'll get a little more BTC because they are so desperate.
Bitcoinaverage.com seems to be calculating the correct rate of a bitcoin in USD by including MtGox. Hitting the "Ignore Mtgox" button actually over compensates and shows the bitcoin price lower than it really is because the BTC selling pressure is still at the other exchanges.
*I just took the current rates at one point in time. It'd probably be more accurate if some kind of average was taken. It might be interesting to chart the value of 1 mtgoxUSD over time.
*And this is assuming you will ever get USD that you withdraw from Mtgox.       