Skip to content

Instantly share code, notes, and snippets.

@rchowe
Created November 27, 2013 21:19
Show Gist options
  • Select an option

  • Save rchowe/7683385 to your computer and use it in GitHub Desktop.

Select an option

Save rchowe/7683385 to your computer and use it in GitHub Desktop.
Loads prices from blockchain.info's CSV of market prices.
function [ dates, prices, changes ] = load_prices( filename )
% LOAD_PRICES Loads prices from a blockchain.info market-price.txt
% Loads prices from the CSV file provided by blockchain.info at
% http://blockchain.info/charts/market-price
fid = fopen( filename );
raw = textscan( fid, '%s %f', 'delimiter', ',' );
fclose( fid );
dates = raw{1};
prices = raw{2};
changes = zeros( length( dates ), 1 );
changes(1) = 1;
for i = 2:length(prices)
changes(i) = prices(i)/prices(i-1);
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment