In [99]:
using DataFrames
using Datetime
using Gadfly
Warning: using Datetime.datetime in module Main conflicts with an existing identifier.
Warning: using Datetime.date in module Main conflicts with an existing identifier.
Warning: using Datetime.month in module Main conflicts with an existing identifier.
Warning: using Datetime.day in module Main conflicts with an existing identifier.
Warning: using Datetime.DateTime in module Main conflicts with an existing identifier.
In [115]:
#Let's get some data
#This URL contains daily closing transaction prices for a Bitcoin - US dollar exchange market
download("https://blockchain.info/charts/market-price?showDataPoints=false×pan=&show_header=true&daysAverageString=1&scale=0&format=csv&address=",
"market-price.csv")
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10594 0 10594 0 0 10280 0 --:--:-- 0:00:01 --:--:-- 10285
Out[115]:
"market-price.csv"
In [123]:
#Now load this into a DataFrame, specifying the column labels manually.
bitcoin_prices = readtable("market-price.csv", colnames=["date", "USD"])
Out[123]:
date USD 1 24/01/2013 18:15:05 19.18999 2 25/01/2013 18:15:05 18.8348 3 26/01/2013 18:15:05 17.61926 4 27/01/2013 18:15:05 17.99999 5 28/01/2013 18:15:05 18.45 6 29/01/2013 18:15:05 19.8 7 30/01/2013 18:15:05 19.7 8 31/01/2013 18:15:05 21.43 9 01/02/2013 18:15:05 21.3 10 02/02/2013 18:15:05 21.1 11 03/02/2013 18:15:05 20.68 12 04/02/2013 18:15:05 21.05 13 05/02/2013 18:15:05 20.79 14 06/02/2013 18:15:05 21.3339 15 07/02/2013 18:15:05 22.15 16 08/02/2013 18:15:05 22.15 17 09/02/2013 18:15:05 22.91881 18 10/02/2013 18:15:05 23.47287 19 11/02/2013 18:15:05 23.92002 20 12/02/2013 18:15:05 24.8084 21 13/02/2013 18:15:05 25.44947 22 14/02/2013 18:15:05 25.10187 23 15/02/2013 18:15:05 26.96794 24 16/02/2013 18:15:05 27.14766 25 17/02/2013 18:15:05 26.69557 26 18/02/2013 18:15:05 26.62055 27 19/02/2013 18:15:05 27.80907 28 20/02/2013 18:15:05 29.35363 29 21/02/2013 18:15:05 29.66494 30 22/02/2013 18:15:05 30.36198 31 23/02/2013 18:15:05 29.48604 32 24/02/2013 18:15:05 29.67859 33 25/02/2013 18:15:05 29.94685 34 26/02/2013 18:15:05 30.76361 35 27/02/2013 18:15:05 31.12813 36 28/02/2013 18:15:05 32.60091 37 01/03/2013 18:15:05 33.51413 38 02/03/2013 18:15:05 34.15486 39 03/03/2013 18:15:05 34.07332 40 04/03/2013 18:15:05 34.92435 41 05/03/2013 18:15:05 38.56574 42 06/03/2013 18:15:05 44.2658 43 07/03/2013 18:15:05 42.5578 44 08/03/2013 18:15:05 42.48205 45 09/03/2013 18:15:05 44.87112 46 10/03/2013 18:15:05 47.05404 47 11/03/2013 18:15:05 46.99204 48 12/03/2013 18:15:05 44.0596 49 13/03/2013 18:15:05 45.69083 50 14/03/2013 18:15:05 47.28937 51 15/03/2013 18:15:05 47.13189 52 16/03/2013 18:15:05 46.82327 53 17/03/2013 18:15:05 47.33354 54 18/03/2013 18:15:05 47.5382 55 19/03/2013 18:15:05 52.76516 56 20/03/2013 18:15:05 60.00443 57 21/03/2013 18:15:05 66.98106 58 22/03/2013 18:15:05 72.00271 59 23/03/2013 18:15:05 65.34818 60 24/03/2013 18:15:05 65.07712 61 25/03/2013 18:15:05 73.29676 62 26/03/2013 18:15:05 76.59216 63 27/03/2013 18:15:05 83.31407 64 28/03/2013 18:15:05 91.48657 65 29/03/2013 18:15:05 87.70095 66 30/03/2013 18:15:05 90.4329 67 31/03/2013 18:15:05 92.47568 68 01/04/2013 18:15:05 97.5172 69 02/04/2013 18:15:05 104.79261 70 03/04/2013 18:15:05 126.30169 71 04/04/2013 18:15:05 128.37969 72 05/04/2013 18:15:05 136.41291 73 06/04/2013 18:15:05 142.34668 74 07/04/2013 18:15:05 151.24731 75 08/04/2013 18:15:05 176.92779 76 09/04/2013 18:15:05 201.34118 77 10/04/2013 18:15:05 237.56729 78 11/04/2013 18:15:05 159.82983 79 12/04/2013 18:15:05 83.66403 80 13/04/2013 18:15:05 106.76121 81 14/04/2013 18:15:05 110.34214 82 15/04/2013 18:15:05 110.34214 83 16/04/2013 18:15:05 110.34214 84 17/04/2013 18:15:05 79.94208 85 18/04/2013 18:15:05 92.1943 86 19/04/2013 18:15:05 115.26996 87 20/04/2013 18:15:05 119.87748 88 21/04/2013 18:15:05 125.37954 89 22/04/2013 18:15:05 120.94339 90 23/04/2013 18:15:05 130.14464 91 24/04/2013 18:15:05 149.92694 92 25/04/2013 18:15:05 153.06395 93 26/04/2013 18:15:05 135.2309 94 27/04/2013 18:15:05 134.98345 95 28/04/2013 18:15:05 130.58545 96 29/04/2013 18:15:05 140.37754 97 30/04/2013 18:15:05 142.23439 98 01/05/2013 18:15:05 131.876 99 02/05/2013 18:15:05 110.05182 100 03/05/2013 18:15:05 95.00099 101 04/05/2013 18:15:05 102.08299 102 05/05/2013 18:15:05 113.08898 103 06/05/2013 18:15:05 119.70893 104 07/05/2013 18:15:05 108.51747 105 08/05/2013 18:15:05 111.78448 106 09/05/2013 18:15:05 112.92582 107 10/05/2013 18:15:05 117.1565 108 11/05/2013 18:15:05 116.78895 109 12/05/2013 18:15:05 114.93561 110 13/05/2013 18:15:05 116.44916 111 15/05/2013 18:15:05 111.55342 112 16/05/2013 18:15:05 114.42047 113 17/05/2013 18:15:05 119.49063 114 18/05/2013 18:15:05 123.41201 115 19/05/2013 18:15:05 122.70054 116 20/05/2013 18:15:05 122.10098 117 21/05/2013 18:15:05 122.1923 118 22/05/2013 18:15:05 122.72872 119 23/05/2013 18:15:05 124.53269 120 24/05/2013 18:15:05 128.3434 121 25/05/2013 18:15:05 131.70002 122 26/05/2013 18:15:05 133.14468 123 27/05/2013 18:15:05 134.00382 124 28/05/2013 18:15:05 128.13203 125 29/05/2013 18:15:05 129.04421 126 30/05/2013 18:15:05 131.12181 127 31/05/2013 18:15:05 128.5057 128 01/06/2013 18:15:05 128.37584 129 02/06/2013 18:15:05 122.46257 130 03/06/2013 18:15:05 119.09414 131 04/06/2013 18:15:05 121.48543 132 05/06/2013 18:15:05 121.20351 133 06/06/2013 18:15:05 121.4591 134 07/06/2013 18:15:05 114.36365 135 08/06/2013 18:15:05 109.82333 136 09/06/2013 18:15:05 96.83872 137 10/06/2013 18:15:05 103.29267 138 11/06/2013 18:15:05 106.2615 139 12/06/2013 18:15:05 109.12762 140 13/06/2013 18:15:05 108.94413 141 14/06/2013 18:15:05 102.35923 142 15/06/2013 18:15:05 100.63417 143 16/06/2013 18:15:05 100.16352 144 17/06/2013 18:15:05 100.7685 145 18/06/2013 18:15:05 106.25666 146 19/06/2013 18:15:05 107.54956 147 20/06/2013 18:15:05 110.32526 148 21/06/2013 18:15:05 111.10195 149 22/06/2013 18:15:05 108.92411 150 23/06/2013 18:15:05 107.79626 151 24/06/2013 18:15:05 104.25029 152 25/06/2013 18:15:05 104.16325 153 26/06/2013 18:15:05 103.76724 154 27/06/2013 18:15:05 103.27516 155 28/06/2013 18:15:05 98.90943 156 29/06/2013 18:15:05 96.0465 157 30/06/2013 18:15:05 96.07098 158 01/07/2013 18:15:05 94.35016 159 02/07/2013 18:15:05 89.56544 160 03/07/2013 18:15:05 87.02898 161 04/07/2013 18:15:05 78.97113 162 05/07/2013 18:15:05 74.25453 163 06/07/2013 18:15:05 69.70287 164 07/07/2013 18:15:05 69.02786 165 08/07/2013 18:15:05 75.87392 166 09/07/2013 18:15:05 75.56044 167 10/07/2013 18:15:05 77.2335 168 11/07/2013 18:15:05 85.52658 169 12/07/2013 18:15:05 96.10023 170 13/07/2013 18:15:05 92.57212 171 14/07/2013 18:15:05 96.17577 172 15/07/2013 18:15:05 97.19351 173 16/07/2013 18:15:05 98.47207 174 17/07/2013 18:15:05 98.10521 175 18/07/2013 18:15:05 91.31361 176 19/07/2013 18:15:05 90.70776 177 20/07/2013 18:15:05 92.54151 178 21/07/2013 18:15:05 89.95843 179 22/07/2013 18:15:05 90.80899 180 23/07/2013 18:15:05 93.68958 181 24/07/2013 18:15:05 94.30117 182 25/07/2013 18:15:05 95.42348 183 26/07/2013 18:15:05 96.44437 184 27/07/2013 18:15:05 94.71152 185 28/07/2013 18:15:05 96.64393 186 29/07/2013 18:15:05 100.22914 187 30/07/2013 18:15:05 101.71264 188 01/08/2013 18:15:05 106.13525 189 02/08/2013 18:15:05 104.62145 190 03/08/2013 18:15:05 103.79108 191 04/08/2013 18:15:05 104.50441 192 05/08/2013 18:15:05 106.13903 193 06/08/2013 18:15:05 106.54382 194 07/08/2013 18:15:05 106.06197 195 08/08/2013 18:15:05 103.52903 196 09/08/2013 18:15:05 103.4481 197 11/08/2013 18:15:05 103.66512 198 12/08/2013 18:15:05 104.49856 199 14/08/2013 18:15:05 111.46537 200 15/08/2013 18:15:05 111.75481 201 16/08/2013 18:15:05 109.87746 202 17/08/2013 18:15:05 110.67226 203 18/08/2013 18:15:05 113.38927 204 19/08/2013 18:15:05 118.10597 205 20/08/2013 18:15:05 119.97866 206 21/08/2013 18:15:05 122.16599 207 22/08/2013 18:15:05 122.50085 208 23/08/2013 18:15:05 120.45979 209 24/08/2013 18:15:05 119.04343 210 25/08/2013 18:15:05 120.76731 211 26/08/2013 18:15:05 121.87772 212 27/08/2013 18:15:05 127.18842 213 28/08/2013 18:15:05 129.98599 214 30/08/2013 18:15:05 134.92093 215 31/08/2013 18:15:05 140.39747 216 02/09/2013 18:15:05 145.33931 217 03/09/2013 18:15:05 145.01891 218 04/09/2013 18:15:05 143.99611 219 05/09/2013 18:15:05 133.57982 220 06/09/2013 18:15:05 131.94775 221 07/09/2013 18:15:05 126.10718 222 08/09/2013 18:15:05 127.218 223 09/09/2013 18:15:05 128.96113 224 10/09/2013 18:15:05 133.19442 225 11/09/2013 18:15:05 133.93903 226 12/09/2013 18:15:05 140.76378 227 13/09/2013 18:15:05 141.62301 228 14/09/2013 18:15:05 140.27874 229 15/09/2013 18:15:05 137.41171 230 16/09/2013 18:15:05 139.54818 231 17/09/2013 18:15:05 139.11795 232 18/09/2013 18:15:05 140.10618 233 19/09/2013 18:15:05 138.83326 234 20/09/2013 18:15:05 134.91019 235 21/09/2013 18:15:05 134.22792 236 22/09/2013 18:15:05 132.90102 237 23/09/2013 18:15:05 133.61771 238 24/09/2013 18:15:05 133.69101 239 25/09/2013 18:15:05 136.06683 240 26/09/2013 18:15:05 136.10723 241 27/09/2013 18:15:05 137.75911 242 28/09/2013 18:15:05 139.72007 243 29/09/2013 18:15:05 143.53453 244 30/09/2013 18:15:05 142.73791 245 01/10/2013 18:15:05 141.62903 246 02/10/2013 18:15:05 128.25736 247 03/10/2013 18:15:05 125.00449 248 04/10/2013 18:15:05 133.59297 249 05/10/2013 18:15:05 137.38172 250 06/10/2013 18:15:05 136.21887 251 07/10/2013 18:15:05 137.10394 252 08/10/2013 18:15:05 136.73281 253 09/10/2013 18:15:05 138.85832 254 10/10/2013 18:15:05 140.21331 255 11/10/2013 18:15:05 140.64634 256 12/10/2013 18:15:05 141.42238 257 13/10/2013 18:15:05 143.33601 258 14/10/2013 18:15:05 149.41995 259 15/10/2013 18:15:05 152.25552 260 16/10/2013 18:15:05 157.2206 261 17/10/2013 18:15:05 153.40576 262 18/10/2013 18:15:05 160.62448 263 19/10/2013 18:15:05 178.48081 264 20/10/2013 18:15:05 181.53101 265 21/10/2013 18:15:05 190.64537 266 22/10/2013 18:15:05 197.99909 267 23/10/2013 18:15:05 209.09625 268 24/10/2013 18:15:05 208.6843 269 25/10/2013 18:15:05 192.95 270 26/10/2013 18:15:05 191.72586 271 27/10/2013 18:15:05 193.52916 272 28/10/2013 18:15:05 204.73768 273 29/10/2013 18:15:05 209.06107 274 30/10/2013 18:15:05 213.5504 275 31/10/2013 18:15:05 208.79511 276 01/11/2013 18:15:05 212.81266 277 02/11/2013 18:15:05 212.8422 278 03/11/2013 18:15:05 215.43336 279 04/11/2013 18:15:05 226.16464 280 05/11/2013 18:15:05 242.89802 281 06/11/2013 18:15:05 256.58395 282 07/11/2013 18:15:05 297.46876 283 08/11/2013 18:15:05 323.71571 284 09/11/2013 18:15:05 367.83843 285 10/11/2013 18:15:05 333.73778 286 11/11/2013 18:15:05 338.92009 287 12/11/2013 18:15:05 375.9822 288 13/11/2013 18:15:05 393.87295 289 14/11/2013 18:15:05 429.94114 290 15/11/2013 18:15:05 437.49844 291 16/11/2013 18:15:05 446.00754 292 17/11/2013 18:15:05 486.64872 293 18/11/2013 18:15:05 579.41604 294 19/11/2013 18:15:05 710.06617 295 20/11/2013 18:15:05 576.45034 296 21/11/2013 18:15:05 650.38315 297 22/11/2013 18:15:05 742.15764 298 23/11/2013 18:15:05 824.11905 299 24/11/2013 18:15:05 809.16756 300 25/11/2013 18:15:05 809.69932 301 26/11/2013 18:15:05 847.37691 302 27/11/2013 18:15:05 972.21835 303 28/11/2013 18:15:05 1086.50818 304 29/11/2013 18:15:05 1159.00182 305 30/11/2013 18:15:05 1203.4184 306 01/12/2013 18:15:05 1150.08882 307 02/12/2013 18:15:05 1024.7252 308 03/12/2013 18:15:05 1107.06561 309 04/12/2013 18:15:05 1170.46278 310 05/12/2013 18:15:05 1091.62121 311 06/12/2013 18:15:05 1042.7746 312 07/12/2013 18:15:05 767.77696 313 08/12/2013 18:15:05 726.58623 314 09/12/2013 18:15:05 863.79314 315 10/12/2013 18:15:05 935.89805 316 11/12/2013 18:15:05 979.61901 317 12/12/2013 18:15:05 889.63983 318 13/12/2013 18:15:05 930.79973 319 14/12/2013 18:15:05 911.20089 320 15/12/2013 18:15:05 874.93158 321 16/12/2013 18:15:05 868.14062 322 17/12/2013 18:15:05 744.5032 323 18/12/2013 18:15:05 584.0669 324 19/12/2013 18:15:05 620.42169 325 20/12/2013 18:15:05 724.59597 326 21/12/2013 18:15:05 660.98483 327 22/12/2013 18:15:05 659.59835 328 23/12/2013 18:15:05 662.33077 329 24/12/2013 18:15:05 698.43107 330 25/12/2013 18:15:05 696.82096 331 26/12/2013 18:15:05 749.74441 332 27/12/2013 18:15:05 804.04208 333 28/12/2013 18:15:05 772.1559 334 29/12/2013 18:15:05 752.76039 335 30/12/2013 18:15:05 795.20293 336 31/12/2013 18:15:05 799.47647 337 01/01/2014 18:15:05 807.8695 338 02/01/2014 18:15:05 817.77549 339 03/01/2014 18:15:05 862.98983 340 04/01/2014 18:15:05 890.91951 341 05/01/2014 18:15:05 954.12001 342 06/01/2014 18:15:05 1026.49375 343 07/01/2014 18:15:05 1005.67499 344 08/01/2014 18:15:05 924.35554 345 09/01/2014 18:15:05 927.11829 346 10/01/2014 18:15:05 918.41811 347 11/01/2014 18:15:05 970.5116 348 12/01/2014 18:15:05 975.3575 349 13/01/2014 18:15:05 921.11375 350 14/01/2014 18:15:05 921.79259 351 15/01/2014 18:15:05 947.41573 352 16/01/2014 18:15:05 936.95456 353 17/01/2014 18:15:05 905.4817 354 18/01/2014 18:15:05 900.41257 355 19/01/2014 18:15:05 922.87441 356 20/01/2014 18:15:05 952.30412 357 21/01/2014 18:15:05 962.80889 358 22/01/2014 23:14:53 952.16873
In [123]:
#Due to a technical limitation in plotting, we need to convert the date to
#fractional years. This will be fixed soon!
parsedate(x)=((Datetime.dt2string(Datetime.DateTimeFormat("dd/MM/yyyy hh:mm:ss"), x)
- Datetime.dt2string(Datetime.DateTimeFormat("dd/MM/yyyy hh:mm:ss"), "01/01/2009 00:00:00"))
/(365.242*86400000))+2009
bitcoin_prices["date"] = map(parsedate, bitcoin_prices["date"]);
In [131]:
plot(x=bitcoin_prices["date"], y=bitcoin_prices["USD"],
Guide.XLabel("Year"), Guide.YLabel("B⃦/US\$"),
Geom.line)
Out[131]:
Content source: JuliaX/iap2014
Similar notebooks: