{ "info": { "author": "Chris Pappalardo", "author_email": "cpappala@yahoo.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: Other/Proprietary License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4" ], "description": "===============================\nstockbot\n===============================\n\n.. image:: https://img.shields.io/travis/ChrisPappalardo/stockbot.svg\n :target: https://travis-ci.org/ChrisPappalardo/stockbot\n\n.. image:: https://img.shields.io/pypi/v/stockbot.svg\n :target: https://pypi.python.org/pypi/stockbot\n\n\nStock market analysis library written in Python.\n\n* Copyright (C) 2016 by Chris Pappalardo \n* License: Creative Commons (CC) BY-NC-ND 4.0 https://creativecommons.org/licenses/by-nc-nd/4.0/\n* Documentation: https://stockbot-lib.readthedocs.org/\n\nFeatures\n--------\n\n* Market data sourcing from Yahoo!, CNBC, and zipline bundles\n* S&P500 stock listing scraper\n* ADX, DI, and Stochastic technical indicators implemented using TA-lib\n* Average Directional Movement Index (ADX) ranking for portfolios\n* Trending and oscillating instrument trading algorithms for zipline\n\nInstallation\n------------\n\nInstall the latest package with::\n\n $ pip install stockbot\n\nThe dependencies are not trivial and may not install properly on your system through pip. We\nrecommend developing and deploying your projects that use stockbot in containers with the necessary\npackages pre-installed.\n\nOne way to do this is to first build the `quantopian/zipline` Docker image with the following command::\n\n $ docker build -t quantopian/zipline https://github.com/quantopian/zipline.git#1.0.2\n\nUsing a docker-compose development configuration similar to the one contained in stockbot, you could\nthen create a development container with::\n\n $ docker-compose -f docker-compose-dev.yml up\n\nNote that our docker configuration installs the latest zipline `quantopian-quandl` bundle in the project\nroot. This is necessary for the default stockbot configuration when using functions such as\n`get_zipline_dp` and `get_zipline_hist`.\n\nUsage\n-----\n\nStockbot can provide you with a list of S&P500 stocks from `wikipedia`::\n\n >>> from stockbot.core import get_sp500_list\n >>> get_sp500_list()\n [u'MMM', u'ABT', u'ABBV', u'ACN', u'ATVI', u'AYI', u'ADBE', ... u'ZTS']\n \nTo get a delayed quote from Yahoo! use `get_yahoo_quote`::\n \n >>> from stockbot.sources import get_yahoo_quote\n >>> get_yahoo_quote('YHOO')\n {'volume': 3405057, 'last': 41.0, 'symbol': 'YHOO', 'datetime': datetime.datetime(2016, 11, 22, 18, 0, tzinfo=), 'high': 41.4, 'low': 40.83, 'open': 41.2, 'change': -0.11}\n\nOr a real-time quote from CNBC using `get_cnbc_quote`::\n\n >>> from stockbot.sources import get_cnbc_quote\n >>> next(get_cnbc_quote('YHOO'))\n {'volume': 3528566, 'last': 41.04, 'symbol': u'YHOO', 'datetime': datetime.datetime(2016, 11, 22, 21, 0, tzinfo=), 'high': 41.395, 'low': 40.83, 'open': 41.2, 'change': -0.07}\n\nNote:: `get_cnbc_quote` returns a generator\n\nStockbot returns quote data using a `dict` like object `stockbot.marketdata.MarketData` that performs\ncertain data and datetime processing.\n\nHistorical data can be obtained from Yahoo! using `get_yahoo_hist`::\n \n >>> from stockbot.sources import get_yahoo_hist\n >>> get_yahoo_hist('YHOO')\n {'high': 41.48, 'last': 41.110001, 'datetime': datetime.datetime(2016, 11, 21, 21, 0, tzinfo=), 'volume': 11338000, 'low': 40.939999, 'close': 41.110001, 'open': 41.439999}\n \nHistorical data can also be obtained from zipline bundles using the `get_zipline_hist` function::\n\n >>> from stockbot.sources import get_zipline_hist\n >>> get_zipline_hist('YHOO', 'close', \n 2016-01-04 00:00:00+00:00 31.41\n Freq: C, Name: Equity(3177 [YHOO]), dtype: float64\n\nLook up symbols with `stockbot.sources.get_symbol` which searches Yahoo! finance for the passed term.\n\nZipline trading algorithms that utilize the Directional Movement technical indicator system are provided in \n`stockbot.algo`. For example, the following zipline trading algorithm would use ADX and DI to trade the\ntop trending stocks and Stochastic Oscillators to trade the top oscillating stocks in the S&P 500 index::\n\n from logbook import Logger\n from stockbot.algo.core import (\n adx_init,\n trade_di,\n trade_so,\n )\n from stockbot.core import get_sp500_list\n\n def initialize(context):\n return adx_init(\n context,\n name='adx_di_so',\n top_rank=5,\n bot_rank=5,\n di_window=14,\n symbols=get_sp500_list(),\n log=Logger('Stockbot'),\n )\n\n def handle_data(context, data):\n # increment counter and log datetime\n context.i += 1\n context.adx['log'].info('processing %s' % context.get_datetime())\n\n # trade trending S&P500 stocks using the DI system\n trade_di(\n context,\n data,\n window=context.adx['di_window'],\n portfolio=[i for (i, adx) in context.adx['top']],\n capital_ppi=1.0/(len(context.adx['top'])+len(context.adx['bot'])),\n log=context.adx['log'],\n )\n\n # trade oscillating S&P500 stocks using the SO system\n trade_so(\n context,\n data,\n window=context.adx['di_window'],\n portfolio=[i for (i, adx) in context.adx['bot']],\n capital_ppi=1.0/(len(context.adx['top'])+len(context.adx['bot'])),\n log=context.adx['log'],\n )\n\nTo run this algorithm in a docker container, copy the code above into a file and issue the following::\n\n $ zipline run -f --start --end \n\nUse the the `` format for dates. Use `-o /path/file.pickle` to capture pickled results that\ncan be used in python.\n\n\n\n\nHistory\n-------\n\n0.1.0 (2015-09-23)\n---------------------\n\n* created basic market data sourcing from Yahoo! and CNBC\n\n0.2.0 (2016-11-22)\n------------------\n\n* created S&P500 stock listing scraper\n* implemented TA-lib for technical analysis (ADX, DI, STOCH)\n* added zipline bundles to data sourcing\n* created zipline trading algorithms for trending and oscillating instruments", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ChrisPappalardo/stockbot", "keywords": "stockbot", "license": "CC BY-NC-ND 4.0", "maintainer": null, "maintainer_email": null, "name": "stockbot", "package_url": "https://pypi.org/project/stockbot/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/stockbot/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/ChrisPappalardo/stockbot" }, "release_url": "https://pypi.org/project/stockbot/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "Stock market analysis library written in Python.", "version": "0.2.0" }, "last_serial": 2477150, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "d6825a4aa6ac6e83bb736f3558321593", "sha256": "454b8e41fc084becd22d569b60609c223ac35f349d2d2dce4b55dd489b52a481" }, "downloads": -1, "filename": "stockbot-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d6825a4aa6ac6e83bb736f3558321593", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 3099, "upload_time": "2015-09-23T19:45:43", "url": "https://files.pythonhosted.org/packages/50/53/2d672b3eee7ed477d449acc4d6155d6923a79aba225c1367b36385a4dfef/stockbot-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1e78934802e60eba9042510393c74fe4", "sha256": "7c5cd9e9698d7465e855a3e31bddff6fb01b29a7ed14f592cec2435e21a53e86" }, "downloads": -1, "filename": "stockbot-0.1.0.tar.gz", "has_sig": false, "md5_digest": "1e78934802e60eba9042510393c74fe4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14681, "upload_time": "2015-09-23T19:45:37", "url": "https://files.pythonhosted.org/packages/6d/9b/5eb2032efd4ce4483e6fdf6500dfd47eff62c8066fdc9116c5784ebb9b22/stockbot-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "f9e8f251b9825acb8f77c2b30868d940", "sha256": "35584c1add67aab4c5133ebf0fe1558586a2c30cc39b4f27b36e93622f107974" }, "downloads": -1, "filename": "stockbot-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f9e8f251b9825acb8f77c2b30868d940", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13692, "upload_time": "2016-11-22T19:53:13", "url": "https://files.pythonhosted.org/packages/d2/06/ae78da1d82499c92688dbafec0c6f4baaf671cebfba92a2805ff443cd35d/stockbot-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6a4ef76069f1d2d283d7a93d867ed1f9", "sha256": "fb6ed254f28f06de8be054b74a8e8c9dc224c9b658b39402c112ffa637dec27a" }, "downloads": -1, "filename": "stockbot-0.2.0.tar.gz", "has_sig": false, "md5_digest": "6a4ef76069f1d2d283d7a93d867ed1f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 94492, "upload_time": "2016-11-22T19:53:10", "url": "https://files.pythonhosted.org/packages/2e/14/1435092093d3bd1b36a341d832e12c9f6f5661b8a760836adeb970b99dd7/stockbot-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f9e8f251b9825acb8f77c2b30868d940", "sha256": "35584c1add67aab4c5133ebf0fe1558586a2c30cc39b4f27b36e93622f107974" }, "downloads": -1, "filename": "stockbot-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f9e8f251b9825acb8f77c2b30868d940", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13692, "upload_time": "2016-11-22T19:53:13", "url": "https://files.pythonhosted.org/packages/d2/06/ae78da1d82499c92688dbafec0c6f4baaf671cebfba92a2805ff443cd35d/stockbot-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6a4ef76069f1d2d283d7a93d867ed1f9", "sha256": "fb6ed254f28f06de8be054b74a8e8c9dc224c9b658b39402c112ffa637dec27a" }, "downloads": -1, "filename": "stockbot-0.2.0.tar.gz", "has_sig": false, "md5_digest": "6a4ef76069f1d2d283d7a93d867ed1f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 94492, "upload_time": "2016-11-22T19:53:10", "url": "https://files.pythonhosted.org/packages/2e/14/1435092093d3bd1b36a341d832e12c9f6f5661b8a760836adeb970b99dd7/stockbot-0.2.0.tar.gz" } ] }