-
Notifications
You must be signed in to change notification settings - Fork 334
Home
The main repository at GitHub is called fecon235 (shortcut https://git.io/fecon235) where you will find README.md for an overview of the computational tools.
The lib
directory contains Python modules
with the high-level commands used in the notebooks.
The Jupyter notebooks in the nb
directory https://git.io/fecon235nb
serve as usage examples and templates for research.
First: fork, clone, or download a copy of our project from GitHub. Here's the URL: https://github.com/rsvp/fecon235
- Info on HOWTO fork: https://guides.github.com/activities/forking
- Info on HOWTO clone: https://help.github.com/articles/cloning-a-repository
Second: our project has external package dependencies which can be easily fulfilled by Anaconda. If you are new to the Python ecosystem, we would highly recommend that free distribution which includes Jupyter, IPython, numpy, pandas, matplotlib, etc.
Third: make sure your local fecon235 top directory is under the scope of your PYTHONPATH, a system variable. PYTHONPATH is used by the Python interpreter to determine which modules to load. We are currently compatible with both python2.7 and python3 series.
Fourth: the top-level module is customarily given the same name as the project. In our case, it conveniently unifies and exposes our essential lib modules. Please see https://git.io/fecon-intro where details are given regarding its import.
The following import style permits easy access to our functions:
# Call the MAIN module:
from fecon235.fecon235 import *
# This loose import style is acceptable only within
# interactive environments outside of any fecon235 packages.
The presence of __init__.py in a directory indicates it as a "package."
The nb
and tests
directories are explicitly not packages.
For python3 conformity, we have adopted absolute_import throughout this project, and this feature is compatible with python2.7.
To use fecon235 in other projects, here are some other styles:
from fecon235 import fecon235 as fe
from fecon235.lib import yi_secform
If we had used the "import as" style in our notebooks, a function would require extra typing, e.g. fe.get() instead of plain get(). Any lib module can be imported directly if specialized procedures are required. The third import example is used to parse SEC forms.
The most current user documentation can be found in the docs
directory,
however, the source code is thoroughly documented with comments.
The best way to learn about the user-friendly code is to
pick a Jupyter notebook for a topic
which interests you, and then to work interactively with it for analysis.
Please see the nb
directory: https://git.io/fecon235nb
Chat with fellow users at Gitter: https://gitter.im/rsvp/fecon235
For issues, please visit https://github.com/rsvp/fecon235/issues -- but better yet please consider fixing module bugs by making a pull request https://git.io/fecon235pr
We have defined functions to access data from the St. Louis Federal Reserve Bank. Now each economic time series and its frequency has its own "fredcode" which is freely available at their site: https://fred.stlouisfed.org so check there first.
df = get( fredcode )
# fredcode is entered as a string, or an
# assigned variable named d4*, m4*, q4*.
# E.g. q4gdpusr = 'GDPC1'
# ^U.S. real GDP in 2009 USD billions, SA quarterly.
plot( dataframe or fredcode )
See the lib/yi_fred.py module
for further details.
Constructing your own pandas DataFrame is easy,
see for example m4eurusd as to how a synthetic series can be created.
The same idea as FRED above. For example, d7xbtusd='BCHAIN/MKPRU' which
is for the Bitcoin price in USD (d7 indicates that the data is 7 days
per week). The quandlcodes can be found at https://www.quandl.com
(however, use Google with keyword "quandl" for better results).
See our lib/yi_quandl.py
module for further details.
We use a special string called "stock slang" in the format "s4symbol" where symbol is spelled out in all lower-case.
Example: to retrieve SPY (the ETF for S&P500), use "s4spy"
df = get( "s4spy" )
plot( df )
The source will be Yahoo Finance, falling back on Google Finance.
The retrieved data will be in pandas DataFrame format.
See our lib/yi_stocks.py
module for further details.
Revision date : 2017-07-26