Validating correlations on my own with help of cryptory and a friend, part 1

Hey,

I decided to learn python a little bit more. For me best learning was always on a real task / project, so I decided to create a few CSV files with data like:

  • price of oil / metals
  • Dow Jones index
  • Bitcoin price
  • google trends for “buy bitcoin”
  • and a few more

Send that data to a friend (Data Analyst) and ask him for a favour of checking if there’s a strong correlation between a pair or a mix of above. Interesting!

With the help of available methods in cryptory package get above data should be piece of cake. Storing in a CSV file seems like a tiny, tiny challange to me at the moment. Where to start ?

Let’s code! Well.. using vim as a code editor for language I completly do not know doesn’t seem fair. Let’s install Eclipse on the Raspberry Pi first followed by a PyDev plugin.

Done.

Let’s code!

Done:


import pandas as pd
from cryptory import Cryptory

my_cryptory = Cryptory(from_date = "2017-01-01")

btc_cmc = my_cryptory.extract_coinmarketcap("bitcoin")
my_df = pd.DataFrame(btc_cmc)
my_df.to_csv('btc_coinmarket.csv', index=False, header=True)

reddit = my_cryptory.extract_reddit_metrics(subreddit="bitcoin", metric="total-subscribers")
my_df = pd.DataFrame(reddit)
my_df.to_csv('btc_reddit.csv', index=False, header=True)

gtrends = my_cryptory.get_google_trends(kw_list=["buy bitcoin"])
my_df = pd.DataFrame(gtrends)
my_df.to_csv('btc_gtrends.csv', index=False, header=True)

stock = my_cryptory.get_stock_prices(market="%5EDJI")
my_df = pd.DataFrame(stock)
my_df.to_csv('btc_stock.csv', index=False, header=True)

rates = my_cryptory.get_exchange_rates(from_currency="USD", to_currency="EUR")
my_df = pd.DataFrame(rates)
my_df.to_csv('btc_rates.csv', index=False, header=True)

metal = my_cryptory.get_metal_prices()
my_df = pd.DataFrame(metal)
my_df.to_csv('btc_metal.csv', index=False, header=True)

exit()

Below links to generated files:

Thanks for reading,
Łukasz.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s