Metadata-Version: 1.1
Name: margot
Version: 0.4
Summary: An algorithmic trading framework for PyData.
Home-page: https://github.com/atkinson/margot
Author: Rich Atkinson
Author-email: rich@airteam.com.au
License: apache-2.0
Description: 
        
        .. image:: https://img.shields.io/pypi/v/margot
           :target: https://pypi.org/project/margot/
           :alt: version
        
        
        .. image:: https://img.shields.io/pypi/pyversions/margot
           :target: https://img.shields.io/pypi/pyversions/margot
           :alt: python
        
        
        .. image:: https://img.shields.io/pypi/wheel/margot
           :target: https://img.shields.io/pypi/wheel/margot
           :alt: wheel
        
        
        .. image:: https://img.shields.io/github/license/atkinson/margot
           :target: https://github.com/atkinson/margot/blob/master/LICENSE
           :alt: license
        
        
        .. image:: https://img.shields.io/travis/com/atkinson/margot
           :target: https://travis-ci.com/github/atkinson/margot
           :alt: build
        
        
        .. image:: https://readthedocs.org/projects/margot/badge/?version=latest
           :target: https://margot.readthedocs.io/en/latest/?badge=latest
           :alt: Documentation Status
        
        
        .. image:: https://codecov.io/gh/atkinson/margot/branch/master/graph/badge.svg
           :target: https://codecov.io/gh/atkinson/margot
           :alt: codecov
        
        
        An algorithmic trading framework for pydata.
        ============================================
        
        Margot is a library of components that may be used together or separately. The first
        major component is now availble for public preview. It should be considered early-beta.
        
        
        * margot.data
        
        Margot Data
        ===========
        
        Margot data makes it easy to create neat and tidy dataframes.
        
        Margot manages data collection, caching, cleaning, time-series feature generation and
        Pandas Dataframe organisaiton and management using a clean, declarative API. If you've
        ever used Django you'll find this approach similar to the Django ORM.
        
        Columns
        -------
        
        The heart of a time-series dataframe is the original data. Margot can retreive time series
        data from external sources (currently AlphaVantage). To add a time series such as
        "closing_price" or "volume", we declare a Column.
        
        e.g. to get closing_price and volume from AlphaVantage:
        
        .. code-block::
        
           adjusted_close = av.Column(function='historical_daily_adjusted', 
                                      column='adjusted_close')
        
           daily_volume = av.Column(function='historical_daily_adjusted',
                                    column='volume')
        
        
        Features
        --------
        
        Columns are useful, but we usually want to derive new time series from them, such 
        as "log_returns" or "SMA20". Margot does this for you; we've called these derived
        time-series, Features.
        
        .. code-block::
        
           simple_returns = feature.SimpleReturns(column='adjusted_close')
           log_returns = feature.LogReturns(column='adjusted_close')
           sma20 = feature.SimpleMovingAverage(column='adjusted_close', window=20)
        
        
        Features can be piled on top of one another. For example, to create a time series of
        realised volatility based on log_returns with a lookback of 30 trading days, simply
        add the following feature:
        
        .. code-block::
        
           realised_vol = feature.RealisedVolatility(column='log_returns', window=30)
        
        
        Margot includes many common financial Features, and we'll be adding more soon. It's 
        also very easy to add your own.
        
        Symbols
        -------
        
        Often, you want to make a dataframe combining a number of columns and features.
        Margot makes this very easy by providing the Symbol class e.g.
        
        .. code-block::
        
           class MyEquity(Symbol):
        
               adjusted_close = av.Column(function='historical_daily_adjusted', 
                                          column='adjusted_close')
               log_returns = feature.LogReturns(column='adjusted_close')
               realised_vol = feature.RealisedVolatility(column='log_returns', 
                                                         window=30)
               upper_band = feature.UpperBollingerBand(column='adjusted_close', 
                                                       window=20, 
                                                       width=2.0)
               sma20 = feature.SimpleMovingAverage(column='adjusted_close', 
                                                   window=20)
               lower_band = feature.LowerBollingerBand(column='adjusted_close', 
                                                       window=20, 
                                                       width=2.0)
        
           spy = MyEquity(symbol='SPY')
        
        
        MargotDataFrames
        ----------------
        
        You usually you want to look at more than one symbol. That's where
        ensembles come in. MargotDataFrame really brings power to margot.data.
        
        .. code-block::
        
           class MyEnsemble(MargotDataFrame):
               spy = Equity(symbol='SPY')
               iwm = Equity(symbol='IWM')
               spy_iwm_ratio = Ratio(numerator=spy.adjusted_close, 
                                     denominator=iwm.adjusted_close,
                                     label='spy_iwm_ratio')
        
           my_df = MyEnsemble().to_pandas() 
        
        
        The above code creates a Pandas DataFrame of both equities, and an additional
        feature that calculates a time-series of the ratio of their respective
        adjusted close prices.
        
        Margot's other parts
        ====================
        
        **not yet released.**
        
        Margot also provides a simple framework for writing and backtesting trading
        signal generation algorithms using margot.data.
        
        Results from margot's trading algorithms can be analysed with pyfolio.
        
        Getting Started
        ---------------
        
        .. code-block::
        
           pip install margot
        
        
        Next you need to make sure you have a couple of environment variables set:
        
        .. code-block::
        
           export ALPHAVANTAGE_API_KEY=YOUR_API_KEY
           export DATA_CACHE=PATH_TO_FOLDER_TO_STORE_HDF5_FILES
        
        
        Once you've done that, try running the code in the `notebook <https://github.com/atkinson/margot/blob/master/notebooks/margot.ipynb>`_.
        
        Status
        ------
        
        This is still an early stage software project, and should not be used for live trading.
        
        Documentation
        -------------
        
        in progress - for examples see the `notebook <https://github.com/atkinson/margot/blob/master/notebooks/margot.ipynb>`_.
        
        Contributing
        ------------
        
        Feel free to make a pull request or chat about your idea first using `issues <https://github.com/atkinson/margot/issues>`_.
        
        Dependencies are kept to a minimum. Generally if there's a way to do something in the standard library (or numpy / Pandas), let's do it that way rather than add another library. 
        
        License
        -------
        
        Margot is licensed for use under Apache 2.0. For details see `the License <https://github.com/atkinson/margot/blob/master/LICENSE>`_.
        
Keywords: quant,trading,systematic
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
