Last active
October 22, 2018 14:30
-
-
Save RandyMcMillan/cb9a90c2cbe7c8deaae0a5c6ef3147b6 to your computer and use it in GitHub Desktop.
Get the Bitcoin Futures Contract dates from the command line. Then convert to a .csv file and print to terminal.
This file contains 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
#!/usr/bin/env bash | |
getBTCfutures() { | |
#depends on curl AND csvkit | |
#both are installable using Homebrew on macOS | |
#not sure if productID is static | |
curl "https://www.cmegroup.com/trading/equity-index/us-index/CmeWS/mvc/ProductCalendar/Download.xls?productId=8478" >> $PWD/cmeBTCfuturesCAL.xls && in2csv $PWD/cmeBTCfuturesCAL.xls > $PWD/cmeBTCfuturesCAL.csv | |
csvclean -K 4 $PWD/cmeBTCfuturesCAL.csv; | |
clear | |
echo $PWD/cmeBTCfuturesCAL_out.csv | |
csvlook $PWD/cmeBTCfuturesCAL_out.csv | |
} | |
This file contains 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
Install Homebrew: | |
https://brew.sh | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew install curl | |
brew install csvkit | |
cd ~/ | |
In your home directory | |
git clone https://gist.github.com/cb9a90c2cbe7c8deaae0a5c6ef3147b6.git | |
cd cb9a90c2cbe7c8deaae0a5c6ef3147b6 | |
source .functions | |
getBTCfutures |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment