Created
November 27, 2013 21:19
-
-
Save rchowe/7683385 to your computer and use it in GitHub Desktop.
Loads prices from blockchain.info's CSV of market prices.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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