Metadata-Version: 1.1
Name: insights
Version: 0.1.0
Summary: Quantitative algorithms, portfolio managers, data sources and contexts for Intuition
Home-page: https://github.com/hackliff/insights
Author: Xavier Bruhiere
Author-email: xavier.bruhiere@gmail.com
License: Apache 2.0
Description: Insights
        ========
        
        |Build Status| |Coverage Status| |Code Health|
        
            Plug-and-play building blocks for modern quants
        
        Quantitative algorithms, portfolio managers data sources, contexts and
        middlewares for `Intuition <https://github.com/hackliff/intuition>`__
        
        -  `Algorithm
           API <https://github.com/hackliff/insights/blob/develop/algorithms/readme.md>`__
        -  `Portfolio
           API <https://github.com/hackliff/insights/blob/develop/managers/readme.md>`__
        -  `Data
           API <https://github.com/hackliff/insights/blob/develop/sources/readme.md>`__
        -  `Contexts <https://github.com/hackliff/insights/blob/develop/contexts/readme.md>`__
        -  `Middlewares <https://github.com/hackliff/insights/blob/develop/contexts/readme.md>`__
        
        Installation
        ------------
        
        .. code:: console
        
            # apt-get install r-base
            # pip install intuition
            # pip install insights
        
        Or if you plan to hack on it
        
        .. code:: console
        
            $ git clone https://github.com/hackliff/insights.git && cd insights
            # pip install -r requirements.txt
            $ export PYTHONPATH=$PYTHONPATH:$PWD
        
        Now use in your *intuition* configuration something like
        
        .. code:: yaml
        
            modules:
              manager: insights.managers.optimalfrontier.OptimalFrontier
              algorithm: insights.algorithms.gradient.StochasticGradientDescent
              data: insights.sources.live.EquitiesLiveSource
        
        Getting started
        ---------------
        
        -  Here is the Fair manager example, which allocates the same weight to
           all of your assets:
        
        .. code:: python
        
            from intuition.zipline.portfolio import PortfolioFactory
        
            class Fair(PortfolioFactory):
                '''
                Dispatch equals weigths for buy signals and give up everything on sell ones
                '''
                def optimize(self, date, to_buy, to_sell, parameters):
                    allocations = dict()
                    if to_buy:
                        fraction = round(1.0 / float(len(to_buy)), 2)
                        for s in to_buy:
                            allocations[s] = fraction
                    for s in to_sell:
                        allocations[s] = - self.portfolio.positions[s].amount
        
                    expected_return = 0
                    expected_risk = 1
                    return allocations, expected_return, expected_risk
        
        -  A classic buy and hold strategy, with a plugin which stores metrics
           in `rethinkdb <www.rethinkdb.com>`__:
        
        .. code:: python
        
            from intuition.zipline.algorithm import TradingFactory
            import insights.plugins.database as database
        
            class BuyAndHold(TradingFactory):
                '''
                Simpliest algorithm ever, just buy every stocks at the first frame
                '''
                def initialize(self, properties):
        
                    self.save = properties.get('save', False)
                    if self.save:
                        self.use(database.RethinkdbBackend(self.identity, reset=True)
                                 .save_portfolio)
        
                def event(self, data):
                    signals = {}
        
                    if self.day == 2:
                        for ticker in data:
                            signals[ticker] = data[ticker].price
        
                    return signals
        
        .. |Build Status| image:: https://travis-ci.org/hackliff/insights.png?branch=develop
           :target: https://travis-ci.org/hackliff/insights
        .. |Coverage Status| image:: https://coveralls.io/repos/hackliff/insights/badge.png
           :target: https://coveralls.io/r/hackliff/insights
        .. |Code Health| image:: https://landscape.io/github/hackliff/insights/develop/landscape.png
           :target: https://landscape.io/github/hackliff/insights/develop
        
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: System :: Distributed Computing
