Last active
January 27, 2018 19:58
-
-
Save tugloo1/fe10790d2f48f1091114fc0d0c13c182 to your computer and use it in GitHub Desktop.
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
import sys | |
from datetime import date | |
import quandl | |
'''sys.argv is a module that has all the inputs of a command line in a list | |
so for example if you run | |
python main.py "2018-1-25" | |
sys.argv would be [main.py', '2018-1-25'] | |
sys.argv is generally used when you expect another developer to run your tool on the command line. Obviously you don't | |
want it to be used by a regular person. For them you would provide a web UI where they can fill in a form | |
''' | |
# Set the year_string, month_string, day_string by splitting up the sys.arg[1] using the dash limeter | |
year_string, month_string, day_string = sys.argv[1].split('-') | |
input_date_as_date_object = date(int(year_string), month=int(month_string), day=int(day_string)) | |
data_frame = quandl.get('USTREASURY/YIELD') | |
print(data_frame.loc[input_date_as_date_object]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment