Thursday, September 03, 2020

Palm oil price vs SIPEF stock price in Jupyter notebooks with Quandl

Quandl also offers free commodity price data for almost 100 commodities ( See API for commodity data) so I decided to create a Jupyter notebook comparing SIPEF's stock price with the price of palm oil. Take a look at the full notebook I shared on github if you want to learn why - https://github.com/jorisp/tradingnotebooks/blob/master/Quandl_API_Euronext_SIPEFPalmOil.ipynb 

 


Remarks:

  • Be careful when embedding images in a Jupyter notebook that you want to publish on Github (see Images in Markdown not showing when uploaded to Git for a discussion on this) - filenames are case sensitive - I got it working using the url syntax
  • To store the quandl key I used the approach outlined on how to use secrets in Jupyter Notebooks with python-dotenv
  • I really like Matplotlib and its versatility in rendering capabilities  in this notebook I used the ability to visualize multiple time series (see code preview below) with different axes. (see code below)

sipcolor = 'tab:red'
fig,ax1 = plt.subplots()

ax1.plot(data['SIP'],color=sipcolor)
ax1.set_ylabel('SIPEF',color=sipcolor)
#Instantiate a second axes that shares the same x-axis
ax2 = ax1.twinx()
ax2.plot(data['PPOIL'])
ax2.set_ylabel('PALM OIL USD')
plt.gcf().set_size_inches(15,8)
plt.show()

Related posts:

No comments:

Post a Comment