{ "info": { "author": "Roberto Haddock Lobo", "author_email": "rhlobo+stockexperiments@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Other Environment", "Intended Audience :: Developers", "Intended Audience :: Financial and Insurance Industry", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Office/Business :: Financial :: Investment", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "bovespaParser\n=============\nA Python parser for BM&F Bovespa Historical Series Files\n\n\n### Features:\n- Parses COTAHISTXXXX.TXT files\n- Parses data passed as string array\n- Configurable to retrieve specific data:\n * Contains market type filters (VISTA, OPCOES, ...)\n * Accepts configuration of desired data fields to be retrieved\n * Data fields order can be freely specified\n\n### Installing:\n pip install bovespaparser\nThere are no external dependencies.\n\n### Usage\n#### Getting started\nIn the sample code presented bellow, you can check out how to parse a file and print it's data out:\n```python\nimport bovespaparser.bovespaparser as bvparser\n\nwith open('filename', 'rU') as f:\n\tresult = bvparser.parsedata(f)\n\nprint result\n```\n\nThe results returned by the `parsedata` function consists of a list of lists: a list of records, where a record holds some information-data for a stock paper in a certain day (a line on the given file).\n\nThe `parsedata` function has two optional parameters:\n```python\ndef parsedata(data, opts=[CODNEG, DATA, PREABE, PREMIN, PREMAX, PREULT, QUATOT], market=VISTA):\n # implementation ...\n```\n- **opts** parameter: specifies what information should be retrieved for each stock paper tick;\n- **market** parameter: specifies the desired market data (filters out other markets)\n\nCalling the function (using the default parameters) would then return a list of records holding:\n- **symbol** - the stock symbol (str)\n- **date** - the period of the quotation tick (datetime.datetime)\n- **open** - stock tick open value (float)\n- **min** - stock tick min value (float)\n- **max** - stock tick max value (float)\n- **close** - stock tick close value (float)\n- **volume** - the volume in the period (int)\n\nSo, it easy to analyse results:\n```python\nfor symbol, datetime, f_open, f_min, f_max, f_close, volume in results:\n # process data ...\n```\n\nTo find out more about the available parameter options and its meanings, refer to the official BMFBOVESPA documentation (also present on the docs directory).\n\n#### Importing data into pandas\nBellow, a (not so pretty/optimized) example of how to import data from a file and creating `pandas dataframes` for each stock symbol:\n```python\n# -*- coding: utf-8 -*-\n\n\nimport pandas\nimport collections\nimport bovespaparser.bovespaparser as bvparser\n\n\nclass CotahistImporter(object):\n\n def __init__(self, f):\n self.dataFrameMap = {}\n\n dataMap = collections.defaultdict(list)\n mapping = [(\"open\", 1), (\"high\", 2), (\"low\", 3), (\"close\", 4), (\"volume\", 5)]\n\n for symbol, datetime, openv, minv, maxv, close, volume in bvparser.parsedata(f):\n symbolData = dataMap.get(symbol)\n symbolData.append([datetime, openv, maxv, minv, close, volume])\n\n for symbol in dataMap.keys():\n dataMap.get(symbol).sort()\n data = zip(*dataMap.get(symbol))\n timeseries = dict((column_name, pandas.TimeSeries(data[column_index], index=data[0], name=column_name)) for column_name, column_index in mapping)\n self.dataFrameMap[symbol] = pandas.DataFrame(timeseries, columns=['open', 'high', 'low', 'close', 'volume'])\n\n def getDataFrameMap(self):\n return self.dataFrameMap\n```\n\n### Links:\n- [BovespaParser Annoucment Blog Post](http://how.i.drycode.it/2012/09/python-bovespa-parser.html)\n- [BovespaParser Git Repository]( https://github.com/rhlobo/bovespaParser)\n- [Documentation](http://www.bmfbovespa.com.br/shared/iframe.aspx?idioma=pt-br&url=http://www.bmfbovespa.com.br/pt-br/cotacoes-historicas/FormSeriesHistoricas.asp)\n (for Bovespa's Historical Series data files)\n\n---------------------------------------\n### Any feedback is always appreciated!\n- Write to the author: ", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/bovespaparser", "keywords": "bovespa,parser,historical,series,cotahist,stock", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "bovespaparser", "package_url": "https://pypi.org/project/bovespaparser/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/bovespaparser/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/bovespaparser" }, "release_url": "https://pypi.org/project/bovespaparser/0.6.5/", "requires_dist": null, "requires_python": null, "summary": "Bovespa's historical series files parser.", "version": "0.6.5" }, "last_serial": 1361572, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "db34c5bd66649de7a70e46939ccb121a", "sha256": "bca9c1e454b68d9a6db1619f5cb16980384dd1ffbe3ef38c7725ff0aab561e08" }, "downloads": -1, "filename": "bovespaparser-0.2-py2.7.egg", "has_sig": false, "md5_digest": "db34c5bd66649de7a70e46939ccb121a", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 4803, "upload_time": "2012-08-22T00:14:10", "url": "https://files.pythonhosted.org/packages/e7/31/94adbb766e3b690d05614129ea55ef903f57f113ea5cd591715dc09eecfd/bovespaparser-0.2-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "d9476cd2975504bd0be80c420e4693f6", "sha256": "31483a0dfbd26b8e14601d89346a3174780a48c65935cce76b54c54a57c6e53d" }, "downloads": -1, "filename": "bovespaparser-0.2.tar.gz", "has_sig": false, "md5_digest": "d9476cd2975504bd0be80c420e4693f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2468, "upload_time": "2012-08-22T00:14:09", "url": "https://files.pythonhosted.org/packages/1e/06/c6e347164a6e1599cbce6fe0bf3542ac8584a35058e7fb393a9e055f39c7/bovespaparser-0.2.tar.gz" } ], "0.3": [ { "comment_text": "built for Linux-3.2.0-32-generic-pae-i686-with-glibc2.7", "digests": { "md5": "8648e4cb70c3a2932285ce55424e9bb6", "sha256": "053ade1110fb515eea2e0c29b00b29b3f35c66f8203a6e5a0ae527ec01580473" }, "downloads": -1, "filename": "bovespaparser-0.3.linux-i686.tar.gz", "has_sig": false, "md5_digest": "8648e4cb70c3a2932285ce55424e9bb6", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 3902, "upload_time": "2012-10-26T01:51:21", "url": "https://files.pythonhosted.org/packages/cd/2b/1b4132b4f44e3cbc57b7915e1ba889bdb0177056a8939317541e38ee480e/bovespaparser-0.3.linux-i686.tar.gz" } ], "0.4": [], "0.5": [], "0.6.1": [ { "comment_text": "", "digests": { "md5": "5845711d9b7a6a7b1b89239d1ae53580", "sha256": "4857ee3a2769ece2acb42aa3c748a1d4f0bc3b134f7c9d00565c9c32c2c528c0" }, "downloads": -1, "filename": "bovespaparser-0.6.1.tar.gz", "has_sig": false, "md5_digest": "5845711d9b7a6a7b1b89239d1ae53580", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3836, "upload_time": "2014-12-26T20:24:44", "url": "https://files.pythonhosted.org/packages/38/8a/145f91968661b9b25f331dc87cf58f42744a37e492a0b03cd59a82933db8/bovespaparser-0.6.1.tar.gz" } ], "0.6.2": [ { "comment_text": "", "digests": { "md5": "5900dd2ef397315eac2198b5d97bbe76", "sha256": "310eac48b4daac0df559952f9fbb3371d34034afe9a20f270ceb00d3c4f18cfb" }, "downloads": -1, "filename": "bovespaparser-0.6.2.tar.gz", "has_sig": false, "md5_digest": "5900dd2ef397315eac2198b5d97bbe76", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3851, "upload_time": "2014-12-26T20:28:47", "url": "https://files.pythonhosted.org/packages/1a/da/1dc59b0640d2794c0625508aa359bad66502258bbbf341bfc9bc3c0b98f6/bovespaparser-0.6.2.tar.gz" } ], "0.6.3": [ { "comment_text": "", "digests": { "md5": "1d89033aee243bbc78c072d949a0c9bd", "sha256": "48ace3eb8618db4215eea08f0a1e57f44a94d46eda5848fa98d88be37b88f33d" }, "downloads": -1, "filename": "bovespaparser-0.6.3.tar.gz", "has_sig": false, "md5_digest": "1d89033aee243bbc78c072d949a0c9bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3873, "upload_time": "2014-12-26T20:33:00", "url": "https://files.pythonhosted.org/packages/88/cb/00e1625182ef5a48e71fd88d728b41ed7181c3d55ed0ce50b9cd88f35e43/bovespaparser-0.6.3.tar.gz" } ], "0.6.4": [ { "comment_text": "", "digests": { "md5": "1f25aa02d4af800c5e4979b0342c6fd7", "sha256": "05604eefcb1f7ee868a27ea71004a018ee403d0864dfc2d868b177a7d6531baf" }, "downloads": -1, "filename": "bovespaparser-0.6.4.tar.gz", "has_sig": false, "md5_digest": "1f25aa02d4af800c5e4979b0342c6fd7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4256, "upload_time": "2014-12-26T20:46:45", "url": "https://files.pythonhosted.org/packages/85/3a/b98145e7655608a9ba8c35bdd2e7249aec36d21b68a9e028887b70c5b2e7/bovespaparser-0.6.4.tar.gz" } ], "0.6.5": [ { "comment_text": "", "digests": { "md5": "89c657e7685edf54e579bccaed9af332", "sha256": "235592bf677cf9527c5d7abe07f4aef3f88bd175af521ac7b2fb717ad869127c" }, "downloads": -1, "filename": "bovespaparser-0.6.5.tar.gz", "has_sig": false, "md5_digest": "89c657e7685edf54e579bccaed9af332", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4259, "upload_time": "2014-12-26T20:48:07", "url": "https://files.pythonhosted.org/packages/57/fb/f6e440d9ff3c17cbec9fd31ad0c5517e483f298104c0a30092b31643c8e3/bovespaparser-0.6.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "89c657e7685edf54e579bccaed9af332", "sha256": "235592bf677cf9527c5d7abe07f4aef3f88bd175af521ac7b2fb717ad869127c" }, "downloads": -1, "filename": "bovespaparser-0.6.5.tar.gz", "has_sig": false, "md5_digest": "89c657e7685edf54e579bccaed9af332", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4259, "upload_time": "2014-12-26T20:48:07", "url": "https://files.pythonhosted.org/packages/57/fb/f6e440d9ff3c17cbec9fd31ad0c5517e483f298104c0a30092b31643c8e3/bovespaparser-0.6.5.tar.gz" } ] }