Spin-off Notice: the modules and functions used by our research notebooks have been refactored into another repository

Overview

fecon235 :: Notebooks for financial economics

Join the chat at https://gitter.im/rsvp/fecon235 / CHANGELOG / BSD License and TOS

Spin-off Notice: the modules and functions used by our research notebooks have been refactored into another repository, fecon236. The home for our Jupyter notebooks will remain here at fecon235 in the nb directory.

What is this repository for?

fecon235 provides an interface for financial economics to the Python ecosystem, especially packages for mathematics, statistics, science, engineering, and data analysis. Complex packages such as numpy, pandas, statsmodels, scipy, and matplotlib are seamlessly integrated at a high-level with APIs of various data hosts for:

  • Essential commands which correctly handle annoying low-level pitfalls.

  • Retrieval of economic and financial data, both historical and the most current.

  • Data munging, for example, resampling and alignment of time-series data from hosts using mutually incompatible formats.

  • Analysis using techniques from econometrics, time-series analysis, and statistical machine learning.

  • Abstraction and software optimization of mathematical operators, for example, linear algebra used in portfolio analysis.

  • Visualization of data using graphical packages.

  • Reproducible research which is collaborative and openly accessible at zero cost.

To practically test theoretical ideas interactively, our code can employed with any Python IDE interactive development environment, IPython console, or with a Jupyter notebook. The code has been tested against both python27 and python3 since 2014, and works across major platforms: Linux, Mac, and Windows.

Database: the primary source is FRED, the U.S. Federal Reserve Economic Data bank which is accessed directly online using our interface. Other specialized data can be directly retrieved using our Quandl API module, for example, futures prices. Data for stocks, mutual funds, and ETFs is retrieved from the best available sources using pandas_datareader. Data is designed to be accessible free of charge, and interoperable in different time frequencies.

How does one get started?

  • Good introductory lectures for economists to Python and its ecosystem: Quantitative Economics by Thomas Sargent.

  • For the fecon235 and fecon236 installation FAQ, please see https://git.io/econ which also covers external dependencies.

  • For the older pre-2016 notebooks, please use import style discussed in https://git.io/fecon-intro

  • Docker container (optional): instantly run fully-configured programs and interactive notebooks; start by: docker pull rsvp/fecon235 # see our Docker image for details.

Some basic commands like get() and plot() will do a lot of the heavy lifting to get you started immediately. The commands are very easy to customize, producing sophisticated results quickly without tweaking the underlying numerical packages.

The docs directory should be gradually adding tutorials. The source code, in the meantime, is thoroughly annotated.

Examples of code

The best way to see the code in action is to run the notebooks in the nb directory which are described further below. Note that GitHub can render Jupyter notebooks directly in the browser, however, they will not be executable.

Here is a rendering of a notebook at GitHub for Housing economy, home prices and affordibility https://git.io/housing If you had executed that notebook locally, it would have also retrieved the latest available data and recomputed the results.

How is worker's wage correlated with GDP output? See https://git.io/gdpwage How much Federal debt must each worker assume? And how fast is the US government debt increasing? https://git.io/debtpop

To score the Federal Reserve's performance under its dual mandate for inflation and unemployment, see https://git.io/fed (where tangentially the Phillips curve is discredited by constructing heat map scatter plots). Notebook https://git.io/infl gives an in-depth analysis of inflation, including a combined forecast using three orthogonal methods.

Elevated default risk across bond markets is indicative of a weak economy. But how can a policy maker calibrate credit spreads to assess changes in interest rates? We consider mortgage and corporate credit spreads to construct a robust Unified Credit Profile (a tutorial on MAD, Median Absolute Deviation, in rescaling non-Gaussian time-series), see https://git.io/creditprof

Please see https://git.io/fedfunds to forecast the Fed Funds rate using futures contracts on LIBOR.

The notebook https://git.io/cotr discerns how various asset classes are positioned in the market. In contrast, an overview of asset prices is given in https://git.io/georet using geometric mean returns.

In https://git.io/gold we make a conjecture that real gold prices is a stationary time-series bound by real interest rates. In https://git.io/xbt Bitcoin is statistically analyzed as a financial asset. We examine the crude oil markets, specifically the Brent over WTI spread, and construct an optimal portfolio, in https://git.io/oil .

SEC 13F filings can be easily parsed, see https://git.io/13F where we track asset managers Stanley Druckenmiller and John Paulson.

In https://git.io/equities we examine the separable components of total return for equities, especially due to enterprise earnings and market speculation, using S&P data assembled by Robert Shiller which goes back to the year 1871. In https://git.io/gdpspx we examine the close relationship between the real economy and the equities market, while demonstrating the Holt-Winters time-series model for predictions.

In https://git.io/gmix we analytically and visually show how a Gaussian Mixture model handles "fat tail" risk of leptokurtotic financial assets under small-sample conditions. Markowitz portfolios, designed in the arithmetic mean-variance framework for a static period, are notoriously fragile when markets change. In contrast, our Boltzmann portfolios are adaptive over multi-periods to geometrically maximize wealth using techniques from reinforcement learning. Part 1: https://git.io/boltz1 Part 2: https://git.io/boltz2

Bootstrapping has two benefits: small-sample statistics and simulation from controlled population. In https://git.io/bootspx we simulate alternate histories for leptokurtotic SPX equity returns: to visualize sample price paths, and for estimating probabilities of events such as investment loss.

Development and contacts

This project is a derivative from the seminar series held at the University of California at Berkeley, jointly sponsored by the Department of Economics and the Haas School of Business. We are also grateful to BIDS, Berkeley Institute for Data Science, and the Mathematical Sciences Group for their technical support.

fecon235-wordclouds.jpg

Partial contents of nb directory

gauss-mix-kurtosis.ipynb : Gaussian Mixture and Leptokurtotic Assets

Gaussian Mixture GM(n) can create distributions with leptokurtosis ("fat tails"). Our problem is the inverse: from observable statistics, deduce the model parameters analytically. We demonstrate how a GM(2) model can synthesize Gaussian risk-equivalence for leptokurtotic financial assets. A numerical solution provides accurate probabilities which can be used to experimentally understand how kurtosis itself is distributed under small-sample conditions. The non-Gaussian distributions are visualized through quantile-quantile probability plots. Shortcut: https://git.io/gmix

boots-eq-spx.ipynb : Bootstrap leptokurtotic SPX equity returns

Bootstrapping has two benefits: small-sample statistics and simulation from controlled population. We simulate alternate histories: to visualize sample price paths, and for estimating probabilities of events such as investment loss. Bootstrapping facilitates study of small-sample behaviour for which asymptotic statistical theory is unsuitable, or where closed-form mathematical analysis is intractable, for example, geovolatility which is the volatility of the geometric mean rate. Shortcut: https://git.io/bootspx

prtf-boltzmann-1.ipynb : Boltzmann portfolios

We develop an alternative to the Markowitz framework called Boltzmann portfolios which handle uncertainty from the standpoint of cross-entropy and optimal sequential decisions. The improved result is a faster online algorithm which is more robust. Markowitz portfolios are designed in the arithmetic mean-variance framework for a static period, and are fragile to changing market conditions. In contrast, Boltzmann portfolios are adaptive over multi-periods to geometrically maximize wealth using techniques from reinforcement learning. Part 1: https://git.io/boltz1 Part 2: https://git.io/boltz2

qdl-spx-earn-div.ipynb : Separable components of total return for equities

We specify a model for equity returns by decomposition into enterprise and speculative returns, plus dividend yield. That model is then tested using stock market data going back to the year 1871 (well-known database assembled by Robert Shiller). An understanding of their respective contributions helps us to form better informed expectations of total return for equities. We demonstrate that the (arithmetic) percentage reasoning is prone is large errors, whereas a logarithmic (geometric) version is exact. Shortcut: https://git.io/equities or https://git.io/spx

qdl-libor-fed-funds.ipynb : Use pandas to analyze short-term rates

We examine the spread between two interest rates: LIBOR and Fed Funds. The former has a much greater depth in the futures market in terms of volume and maturity horizon, implying richer information content. Modeling their relationship, we construct a synthetic forward Fed Funds rate, useful in gauging market sentiment regarding Fed policy. Estimate is given for the change in Fed Funds rate over the next 12 months. Shortcut: https://git.io/fedfunds

qdl-xau-contango.ipynb : Use pandas to analyze gold contango

The London Bullion Market Association ceased publishing daily data on their Gold Forward Offered Rate (GOFO), as of 30 January 2015 -- so we develop an observable proxy called tango using gold futures and LIBOR. This supply/demand indicator is then compared against change in spot prices. Observed strong correlations appear to be artificial. Shortcut: https://git.io/xau-contango

qdl-xbt-bitcoin.ipynb : Statistical analysis of Bitcoin as financial asset

We first examine time-series data for price, mining, and capitalization of Bitcoin, then optimize a robust model for the extremely volatile USD price series. Taking the viewpoint of a Chinese user we perform a comparative valuation in Chinese yuan, and also cross-check with the perennial store of value: gold. The astonishing volatility and geometric return makes Bitcoin a speculative financial asset which may hinder it as a payment system. Shortcut: https://git.io/xbt

qdl-COTR-positions.ipynb : Use pandas to read CFTC COTR

Commitment of Traders Report (COTR) is useful to extract market positions in precious metals, US dollar, interest rates, and equities markets. We develop our own scale-free measures to gauge market sentiment across time which can diverge from price directionality at interesting points. Shortcut: https://git.io/cotr

SEC-13F-parse.ipynb : Use pandas to read 13F filings from SEC

Sort percentage allocation to long equities. Caveats are noted for portfolio management. Module yi_secform easily sums up 13F filings by one function. For illustration, we follow asset managers with significant positions in GLD, a gold ETF; see Stanley Druckenmiller's sudden accumulation, and John Paulson's dramatic liquidation. Shortcut: https://git.io/13F

fred-credit-spreads.ipynb : Robust profiles of credit spreads

Serves as a tutorial on MAD, Median Absolute Deviation, for robustly rescaling non-Gaussian time-series. We consider mortgage and corporate credit spreads to construct a robust Unified Credit Profile to calibrate credit default risk in the context of monetary policy. Shortcut: https://git.io/creditprof

fred-debt-pop.ipynb : Growth of Federal debt, its burden on the US population

We examine US government debt in real terms, and the current Federal debt per capita. Shortcut: https://git.io/debtpop

fred-employ-nfp.ipynb : US employment data, Nonfarm Payroll

We focus on forecasting the monthly change in NFP using a variety of optics: baseline expectation since 1939, Holt-Winters method, visual selection of local range, regression against economic activity (SPX) -- but the standard errors are inherently very large due to survey measurement error.

fred-eur-fx.ipynb : Euro currency qua Foreign Exchange

We examine euro FX data from the Fed Reserve FRED database. Our synthetic time-series, which takes us far back as 1971, give additional perspective to observe the cross-rates against U.S. dollar and Japanese yen.

fred-eurozone.ipynb : Eurozone economics

We examine the usual suspects: unemployment, inflation, real interest rate, foreign exchange rate, comparative GDP. Appendix 1 concisely explains the euro crisis in a video.

fred-gdp-spx.ipynb : US real GDP vs. SPX: Holt-Winters time series forecasting

We examine the US gross domestic product's relationship to the US equity market (S&P 500), in real terms. Forecasts for both are demonstrated using the Holt-Winters time-series model. We derive the most likely range for real GDP growth, and identify extreme equity valuations aside from inflationary pressures. Shortcut: https://git.io/gdpspx

fred-gdp-wage.ipynb : U.S. GDP vs. Wage Income

How is wage correlated with GDP output? In answering this question, we derive a model for GDP growth based on observations from wage growth. Shortcut: https://git.io/gdpwage

fred-georeturns.ipynb : Comparative geometric mean returns

We examine economic and financial time series where Holt-Winters is used to forecast one-year ahead. Daily data for bonds, equity, and gold is then analyzed. The focus is on geometric mean returns because they optimally express mean-variance under logarithmic utility. Shortcut: https://git.io/georet

fred-housing.ipynb : Housing economy, home prices and affordibility

Alan Greenspan in 2014 pointed out that there was never a recovery from recession without improvements in housing construction. Here we examine some relevant data, including the Case-Shiller series, and derive an insightful measure of the housing economy, hscore, which takes affordibility into account. Shortcut: https://git.io/housing

fred-inflation.ipynb : Inflation data from FRED using pandas

We examine inflation data: CPI and PCE, including the core versions, along with the 10-year BEI rate (break-even inflation) from the bond market. A unified inflation statistic m4infl is introduced, which leads to the estimation of the geometric mean rate. A robust optimized Holt-Winters model is used for forecasting. Shortcut: https://git.io/infl

fred-infl-unem-fed.ipynb : Score for the Fed's dual mandate

We examine unemployment and inflation data to construct a time-series which gives a numerical score to the Fed's performance on its dual mandate. The key is to find comparable units to measure performance and a suitable scalar measure to show deviation from the dual mandate. The visualization includes sequential scatter plots using color heat map, which can be extended to studies of the Phillips curve. Shortcut: https://git.io/phillips

fred-infl-velocity.ipynb : Inflation, money velocity, and interest rates

We examine and attempt to replicate the results of two interesting articles by Yi Wen and Maria Arias -- along the way, we take a detour and explore the connection between money velocity and bond rates. This will tie together their relationship with GDP and the money supply in a fitted equation.

fred-oil-brent-wti.ipynb : Oil: Brent vs. West Texas Intermediate (WTI)

We examine the history of crude oil prices, and their spreads. A Boltzmann portfolio is computed for optimal financial positions. Deflated prices give additional insight, along with some of the statistical tools useful in financial economics. Although WTI is more desirable than Brent from a petrochemical perspective, that preference is reversed when the metrics are financial. Shortcut: https://git.io/oil

fred-usd-RTB-xau.ipynb : Real trade-weighted indexes for USD, gold, and SPX

We examine the value of USD against a basket of 26 foreign currencies using real trade numbers. Trade statistics are released annually, however, the Fed uses international inflation data to adjust the weights monthly.

fred-wage-capital.ipynb : Real capital equivalence to wage-income

We determine how much real capital has been necessary for risk-free interest to match annual wage.

fred-xau-spx.ipynb : Gold vs. SP500 returns, XAU vs. SPX

Long-term comparison of two asset classes: we boxplot their return distribution and also compute geometric mean returns. Correlation between the two is shown to be nil. We then look at the history of projected returns using Holt-Winters method, which also gives the latest forecasts. To conclude, we closely examine the relative value of the two assets in terms of gold troy ounces per equity share. Analytically short equities vs. long gold is favorable for an investor with log utility, but hardly profitable over the long haul.

fred-xau-tips.ipynb : Gold and Treasury TIPS, their daily relationship

Using monthly data we previously found that there is strong correlation between gold and real rates, so we investigate this relationship on a daily frequency. We then use this correlation to help make forecasts using the Holt-Winters time-series method. Lastly, we show the history of gold prices in real terms which leads to our conjecture that real gold is a stationary time-series bound by real interest rates. Shortcut: https://git.io/gold


BSD License and TOS / This page, last update : 2018-12-03

Comments
  • GitHub's

    GitHub's "Math Processing Error" when rendering Jupyter notebooks

    Description of specific issue

    Mathematical equations, in both inline and display modes, render correctly when viewed in local browser -- however, when a Jupyter notebook with such equations is viewed at GitHub the following message is generated: "Math Processing Error"

    The issue can be traced solely to GitHub since a notebook's source commited to a GH repo viewed through http://nbviewer.jupyter.org renders the math correctly.

    • [x] Bug at Github itself, not here at fecon235

    Expected behavior

    Here's the correct renderings via http://nbviewer.jupyter.org/github/rsvp/fecon235/blob/master/nb/qdl-spx-earn-div.ipynb while noticing the actual source code resides at GitHub.

    Observed behavior

    Here's the problematic rendering at GitHub: https://github.com/rsvp/fecon235/blob/master/nb/qdl-spx-earn-div.ipynb where all the math is replaced by this message, "Math Processing Error".

    Steps towards resolution

    1. Contact GitHub admin directly. Their notebook rendering library is apparently proprietary -- supposedly for security reasons.

    Additional helpful details for bugs

    • [x] Problem started recently, but not in older versions: YES.
    • [x] Problem happens with all files, not only some files: notebooks with math.
    • [x] Problem can be reliably reproduced: YES, locally and above proof.
    • [ ] Problem happens randomly: NO.
    • fecon235 version: v4.16.0329

    ATTN mention: @rsvp

    wontfix upstream 
    opened by rsvp 6
  • pandas deprecation of Exponential Moving Average function ewma

    pandas deprecation of Exponential Moving Average function ewma

    Description of specific issue

    As of pandas 0.18 the use of its ewma() function will produce a warning which looks like:

        FutureWarning: pd.ewm_mean is deprecated for DataFrame and will be 
        removed in a future version, replace with
        DataFrame.ewm(ignore_na=False,span=30.007751938,min_periods=0,adjust=True).mean()
    

    therefore, this deprecation will adversely impact fecon235 exponential moving average function ema in the yi_1tools module -- when pandas goes to 0.19.

    Expected behavior

    No warning to be raised.

    Observed behavior

    Computed result has no errors. The warning is given only the first time when the exponential moving average function is used.

    Strangely, pd.ewm_mean?? produces no results, so the warning is cryptic.

    Why would the improvement/fix be useful to most users?

    • [x] Bug prevention for pandas 0.19 and above

    Additional helpful details for bugs

    • [x] Problem started recently, but not in older versions
    • [ ] Problem happens with all files, not only some files
    • [x] Problem can be reliably reproduced
    • [ ] Problem happens randomly
    • fecon235 version: v4.16.0525
    • pandas version: 0.18.0
    • Python version: 2.7.11
    warning 
    opened by rsvp 5
  • pandas  .resample()

    pandas .resample() "how" deprecation as of its 0.19 version. Fix our daily(), monthly(), quarterly()

    Description of specific issue

    When resampling a time-series the following warning(s) will appear:

    FutureWarning: how in .resample() is deprecated
    the new syntax is .resample(...).median() fill_method=None)
    
    FutureWarning: .resample() is now a deferred operation
    use .resample(...).mean() instead of .resample(...)
    

    It is somewhat cryptic until one realizes how='median' was being used as an argument to the .resample function. So how becomes the problem for yi_fred module, specifically for our functions daily(), monthly(), and quarterly() in fecon235.

    (Sidenote: how='median' since it is more robust than 'mean'.)

    The second cryptic warning can be traced to our use of fill_method=None when upsampling. The new API urges us to instead use methods:

    • .backfill() : use NEXT valid observation to fill
    • .ffill() : propagate last valid observation forward to next valid
    • .fillna() : fill using nulls
    • .asfreq() : convert TimeSeries to specified frequency

    • [x] Bug as of pandas 0.19
    • [ ] Enhancement

    Expected behavior

    No such warning, possibly fatal termination.

    Observed behavior

    Warnings started as of pandas 0.18

    Why would the improvement be useful to most users?

    Because daily(), weekly(), and monthly() in fecon235 should just work without the casual user needing to learn
    obscure flags and methods (subject to future API changes).

    Additional helpful details for bugs

    • [x] Problem started recently, but not in older versions

    • [ ] Problem happens with all files, not only some files

    • [x] Problem can be reliably reproduced

    • [ ] Problem happens randomly

    • fecon235 version: v4.16.1030

    • pandas version: 0.18

    • Python version: both 2.7 and 3

    • Operating system: cross-platform

    bug warning 
    opened by rsvp 3
  • Possible disruption of FRED data

    Possible disruption of FRED data

    Description of specific issue

    As of 2018, FRED is making changes to their API which may alter the URL scheme to retrieve datasets.

    This would critically impact the function makeURL() in module lib/yi_fred.py

    • [ ] Bug -- NOT yet, old URL still operational

    Expected behavior

    Data in CSV format gets properly downloaded and processed by fecon235.

    Observed behavior

    Temporary disruption reported January 2018.

    Additional helpful details for bugs

    • URL problem is discussed in detail at https://github.com/pydata/pandas-datareader/issues/435

    • Alternative: https://research.stlouisfed.org/docs/api/fred/ but this requires an API key

    • [ ] Problem started recently, but not in older versions

    • [ ] Problem happens with all files, not only some files

    • [ ] Problem can be reliably reproduced

    • [x] Problem happens randomly

    • fecon235 version: v5.17.0722

    opened by rsvp 1
  • Is there a setup.py somewhere?  can't seem to get this installed/

    Is there a setup.py somewhere? can't seem to get this installed/

    Description of specific issue

    Whenever I try to import any of the modules (python 3.5 anaconda, linux mint), I get "SystemError", parent module 'not loaded, cannot perform relative import

    • [ ] Bug
    • [ ] Enhancement

    Expected behavior

    Observed behavior

    Steps which reproduce or enhance behavior

    Optional: Markdown to include images...
    ![Screenshot for demonstration](url)
    

    Why would the improvement be useful to most users?

    Additional helpful details for bugs

    • [ ] Problem started recently, but not in older versions
    • [ ] Problem happens with all files, not only some files
    • [ ] Problem can be reliably reproduced
    • [ ] Problem happens randomly
    • fecon235 version:
    • pandas version:
    • Python version:
    • Operating system:

    ATTN mention: @rsvp

    question 
    opened by bromrector 1
  • Add a Gitter chat badge to README.md

    Add a Gitter chat badge to README.md

    rsvp/fecon235 now has a Chat Room on Gitter

    @rsvp has just created a chat room. You can visit it here: https://gitter.im/rsvp/fecon235.

    This pull-request adds this badge to your README.md:

    Gitter

    If my aim is a little off, please let me know.

    Happy chatting.

    PS: Click here if you would prefer not to receive automatic pull-requests from Gitter in future.

    enhancement 
    opened by gitter-badger 1
  • Moving to Python 3 > 2019-01-01

    Moving to Python 3 > 2019-01-01

    Description of specific issue

    Our code, currently compatible with both python27 and python3 series, is characterized as "straddling."

    We are keen to use Python 3 to its full potential, and we currently accept the cost of writing cross-compatible code to allow a smooth transition, but we don’t intend to maintain this compatibility indefinitely. Although the transition has not been as quick as we hoped, we do see it taking place, with more and more people using, teaching and recommending Python 3.

    The developers of the Python language extended support of Python 2.7 from 2015 to January 1, 2020, recognising that many people were still using Python 2. We believe that the extra 5 years is sufficient to transition off of Python 2, and our projects plan to stop supporting Python 2 when upstream support ends in 2020, if not before. We will then be able to simplify our code and take advantage of the many new features in the current version of the Python language and standard library.

    We have pledged to drop support for Python 2.7 no later than 2020. Please see https://python3statement.org for details on the transition in the Python ecosystem.

    • [x] Deprecation notice: changes will be very gradual
    • [x] Enhancement: top-down refactoring of source code
    • [x] Support installation by pip, e.g. pip install --pre fecon236
    • [ ] Rebuild Docker container using Miniconda3-latest-Linux-x86_64.sh as base

    Expected behavior

    The transition should be smooth, and we will take the opportunity to refactor and re-organize the code from top-down. Users using the Anaconda distribution based on python27 will have to install a new distribution based on python3. For the fecon235 Docker image, the transition will be announced and automatically be set up for you.

    Installation by pip

    We have intentionally avoided the pip because optimal installation of fecon235 dependencies has been difficult, esp. for binaries and newbies. Unfortunately, pip is incapable of true dependency resolution (whereas Anaconda conda installs are reliable). This may change towards the year 2020, where only python3 is involved, and pipenv matures. The major annoyances are summarized here: https://python3statement.org/practicalities -- and minor details, not mentioned, are even more tedious.

    • fecon235 version: v6 notebooks will begin import of fecon236
    • Python version: al least 3.4 through 2019, expect at least 3.6 thereafter.
    • Operating systems: Linux, Mac, Windows
    enhancement warning 
    opened by rsvp 4
  • Disruption of equities data :: pandas_datareader dependency on Yahoo and Google Finance API

    Disruption of equities data :: pandas_datareader dependency on Yahoo and Google Finance API

    Description of specific issue

    We are expecting major disruption in getting data on equities, mutual funds, and ETFs via pandas_datareader due its dependency on API of both Yahoo and Google Finance.

    • [/] Fail quote retrieval via our module lib/yi_stock.py, if no fix upstream.
    • [/] Enhancement, if fecon235 takes independent action in its yi_stock module.

    Observed behavior

    Yahoo employee has confirmed that the free End-Of-Day data has been terminated, 2017 presumably due to acquisition by Verizon.

    • Possible work-around: https://stackoverflow.com/questions/44030983/yahoo-finance-url-not-working

    /r/algotrading on Google JSON termination presumably due to cost-cutting by new product manager. Our yi_stock module may appear to be working, but please tail() your dataframe to verify whether quote retrieval goes beyond 2017-09-05 [silent fail to get() current stock quotes].

    Alternatives to enhance behavior

    1. Switch over to Quandl, using our lib/yi_quandl.py module

      • See: https://blog.quandl.com/api-for-stock-data lists premium databases. But for free stock price data: https://www.quandl.com/product/WIKIP/WIKI/PRICES-Quandl-End-Of-Day-Stocks-Info.
    2. Alpha Vantage: https://www.alphavantage.co/documentation - Requires user to get free API key

      • Python wrapper, MIT license: https://github.com/RomelTorres/alpha_vantage
    3. tiingo: https://api.tiingo.com/docs/general/overview - Requires user to get free API key

    4. $$$ EODhistoricaldata: https://eodhistoricaldata.com

    5. Scrape Google Finance pages: https://github.com/CNuge/general_use_functions/blob/master/international_stock_scraper.py (currently also works for international stocks) -- which is not a robust solution (relative to API code) since the page layout is subject to UI changes: https://github.com/pydata/pandas-datareader/issues/408

    Why would the improvement be useful to most users?

    Information from the equities markets is vital for financial economics.

    Before releasing our own independent solution, we expect to make a pull request to the pandas_datareader repository.

    Please kindly propose alternative solutions below, or at https://gitter.im/rsvp/fecon235 ... and look into pandas_datareader issues

    Check for revisions upstream

    It is possible that a solution has been merged into pandas_datareader and all that is necessary is an update of the package, see its CHANGELOG: https://pandas-datareader.readthedocs.io/en/latest/whatsnew.html and make sure the update is compatible with the latest fecon235.

    Note: Anaconda distribution uses hyphen, not underscore:

    $ conda update pandas-datareader
    

    Additional helpful details for bugs

    • [/] Problem started recently

    • [/] Problem can be reliably reproduced

    • fecon235 version: v5.17.0603

    • pandas version: 0.19.2

    • pandas_datareader version: 0.2.1

    bug enhancement help upstream 
    opened by rsvp 36
  • To update pre-2016 notebooks, fix broken import and preamble

    To update pre-2016 notebooks, fix broken import and preamble

    Major release v4.15.1230 benefits from the python3 compatibility changes made during v3. All modules are now operational under both Python 2 and 3. Also, code has been rewritten for cross-platform performance (Linux, Mac, and Windows).

    We MOVED the yi-modules from nb to a new directory: lib. Python 3 uses absolute import and our python2 code now conforms to that practice.

    To update pre-2016 notebooks, please use import style discussed in docs README: https://git.io/fecon-intro The top-level module fecon235.py (formerly known as nb/fecon.py) is also explained in that introduction. With adoption of python3 print_function, the python2 print statement must be rewritten as a function.

    We also highly recommend inclusion of PREAMBLE-p6.15.1223 which gives versioning requirements for successful notebook replication. With those fixes, our notebooks should run under both Python kernels in Jupyter, without any dependency on Linux.

    bug enhancement 
    opened by rsvp 5
Owner
Adriano
Status: caffeinated
Adriano
Docov - Light-weight, recursive docstring coverage analysis for python modules

docov Light-weight, recursive docstring coverage analysis for python modules. Ov

Richard D. Paul 3 Feb 4, 2022
Yet Another MkDocs Parser

yamp Motivation You want to document your project. You make an effort and write docstrings. You try Sphinx. You think it sucks and it's slow -- I did.

Max Halford 10 May 20, 2022
Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts

Have you always wished Jupyter notebooks were plain text documents? Wished you could edit them in your favorite IDE? And get clear and meaningful diff

Marc Wouts 5.7k Jan 4, 2023
Automatically open a pull request for repositories that have no CONTRIBUTING.md file

automatic-contrib-prs Automatically open a pull request for repositories that have no CONTRIBUTING.md file for a targeted set of repositories. What th

GitHub 8 Oct 20, 2022
In this Github repository I will share my freqtrade files with you. I want to help people with this repository who don't know Freqtrade so much yet.

My Freqtrade stuff In this Github repository I will share my freqtrade files with you. I want to help people with this repository who don't know Freqt

Simon Kebekus 104 Dec 31, 2022
PythonCoding Tutorials - Small functions that would summarize what is needed for python coding

PythonCoding_Tutorials Small functions that would summarize what is needed for p

Hosna Hamdieh 2 Jan 3, 2022
Code for our SIGIR 2022 accepted paper : P3 Ranker: Mitigating the Gaps between Pre-training and Ranking Fine-tuning with Prompt-based Learning and Pre-finetuning

P3 Ranker Implementation for our SIGIR2022 accepted paper: P3 Ranker: Mitigating the Gaps between Pre-training and Ranking Fine-tuning with Prompt-bas

null 14 Jan 4, 2023
Some code that takes a pipe-separated input and converts that into a table!

tablemaker A program that takes an input: a | b | c # With comments as well. e | f | g h | i |jk And converts it to a table: ┌───┬───┬────┐ │ a │ b │

CodingSoda 2 Aug 30, 2022
A comprehensive and FREE Online Python Development tutorial going step-by-step into the world of Python.

FREE Reverse Engineering Self-Study Course HERE Fundamental Python The book and code repo for the FREE Fundamental Python book by Kevin Thomas. FREE B

Kevin Thomas 7 Mar 19, 2022
Build documentation in multiple repos into one site.

mkdocs-multirepo-plugin Build documentation in multiple repos into one site. Setup Install plugin using pip: pip install git+https://github.com/jdoiro

Joseph Doiron 47 Dec 28, 2022
This repository outlines deploying a local Kubeflow v1.3 instance on microk8s and deploying a simple MNIST classifier using KFServing.

Zero to Inference with Kubeflow Getting Started This repository houses all of the tools, utilities, and example pipeline implementations for exploring

Ed Henry 3 May 18, 2022
Repository for tutorials, examples and starter scripts for using the MTU HPC cluster

MTU-HPC-Starter Repository for tutorials, examples and starter scripts for using the MTU HPC cluster Connecting to the MTU HPC cluster Within the coll

null 1 Jan 31, 2022
Main repository for the Sphinx documentation builder

Sphinx Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects (or other documents consisting of mul

null 5.1k Jan 2, 2023
Main repository for the Sphinx documentation builder

Sphinx Sphinx is a tool that makes it easy to create intelligent and beautiful documentation for Python projects (or other documents consisting of mul

null 5.1k Jan 4, 2023
Generate a single PDF file from MkDocs repository.

PDF Generate Plugin for MkDocs This plugin will generate a single PDF file from your MkDocs repository. This plugin is inspired by MkDocs PDF Export P

null 198 Jan 3, 2023
Canonical source repository for PyYAML

PyYAML - The next generation YAML parser and emitter for Python. To install, type 'python setup.py install'. By default, the setup.py script checks

The YAML Project 2k Jan 1, 2023
This is a repository for "100 days of code challenge" projects. You can reach all projects from beginner to professional which are written in Python.

100 Days of Code It's a challenge that aims to gain code practice and enhance programming knowledge. Day #1 Create a Band Name Generator It's actually

SelenNB 2 May 12, 2022
Repository for learning Python (Python Tutorial)

Repository for learning Python (Python Tutorial) Languages and Tools ?? Overview ?? Repository for learning Python (Python Tutorial) Languages and Too

Swiftman 2 Aug 22, 2022
SCTYMN is a GitHub repository that includes some simple scripts(currently only python scripts) that can be useful.

Simple Codes That You Might Need SCTYMN is a GitHub repository that includes some simple scripts(currently only python scripts) that can be useful. In

CodeWriter21 2 Jan 21, 2022