{ "info": { "author": "Sam Kleiner", "author_email": "sam@skleiner.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "# Binance DB\n\nA local cache for Binance data, stored in Postgres\n\n## Setup\n\n### Server\n\nOn the server you wish to run the Postgres DB on.\n\n```bash\ngit clone https://github.com/StoicPerlman/binance-db.git\nexport BDB_POSTGRES_PASS=supersecret\ndocker-compose up -d\n```\n\nThis will pull all available 1 minute candles from Binance and store them in a Postgres DB container. This container has a persistant volume configured for the data, meaning it can be deleted and restarted as much as you want.\n\nWhen started it will check if there is any existing data in the DB. If not it will fetch all. This takes less than 15 mintes and takes up about 250 MB at the time of this writing. If there is existing data it will pull just the data starting from the newest entry in the DB.\n\nA thread is started and connected to the Binance web socket. This will add new data as it is available. If you do not want continuously updating data you can run both containers then just kill the binance-db one.\n\n### Client\n\nYou can pip install this package to connect to DB and have a sqlalchemy session started for use in your own app.\n\n```bash\npip3 install binance-db\n```\n\n```python\n# if you did not override any settings on the server \n# all you have to supply is url and password\nfrom binance_db.db import BinanceDB\nfrom binance_db.candle import Candle\n\nbdb = BinanceDB(user=pguser, password=pgpass, url=pgurl, port=pgport, db=pgdb)\n\n# this is a normal sqlalchemy session\n# see binance_db.candle.Candle for schema\ndb = bdb.get_session()\n\nnew = db.query(Candle).filter_by(pair='BTCUSDT').order_by(Candle.close_time.desc()).first()\n\nprint(new.pair)\nprint(new.open_time)\nprint(new.close_time)\nprint(new.open_price)\nprint(new.close_price)\nprint(new.high)\nprint(new.low)\nprint(new.volume)\nprint(new.qav) # Quote asset volume\nprint(new.trades) # Number of trades\nprint(new.tbbav) # Taker buy base asset volume\nprint(new.tbqav) # Taker buy quote asset volume\n```\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/StoicPerlman/binance-db/archive/0.0.2.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/StoicPerlman/binance-db", "keywords": "binance data cache", "license": "", "maintainer": "", "maintainer_email": "", "name": "binance-db", "package_url": "https://pypi.org/project/binance-db/", "platform": "", "project_url": "https://pypi.org/project/binance-db/", "project_urls": { "Download": "https://github.com/StoicPerlman/binance-db/archive/0.0.2.tar.gz", "Homepage": "https://github.com/StoicPerlman/binance-db" }, "release_url": "https://pypi.org/project/binance-db/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "Binance data cache", "version": "0.0.2" }, "last_serial": 3970358, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "1b9a08e1cf8786aaebf2e42d3b4766c0", "sha256": "236abf9eb94a03d44cacfb84724fdb57ae5078e00fc14f4f7186769f31af981c" }, "downloads": -1, "filename": "binance_db-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1b9a08e1cf8786aaebf2e42d3b4766c0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3641, "upload_time": "2018-06-17T02:46:32", "url": "https://files.pythonhosted.org/packages/e4/1b/4b6d5635b99477d6a7792dd7648c5cb3b24017afbfe6af675ff28927652b/binance_db-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dae85bb90a4eb5a27e17b1f91d64356f", "sha256": "32769fe2253a3da7f45d9fd178d03a4784f85bf53a36c49e1525cea2481c2e26" }, "downloads": -1, "filename": "binance-db-0.0.1.tar.gz", "has_sig": false, "md5_digest": "dae85bb90a4eb5a27e17b1f91d64356f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3217, "upload_time": "2018-06-17T02:49:08", "url": "https://files.pythonhosted.org/packages/03/b4/f7441f941edc0ce7efa98f1e32f06994a79fbc31a04716852b71703351d6/binance-db-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "5c6c8fc2158bf805580a4d0e7d336412", "sha256": "4cb4de9e1b5eaa9c1cae3f7fdd6ceea17beae6eb3649f6c3a26ed0681f35dfd1" }, "downloads": -1, "filename": "binance-db-0.0.2.tar.gz", "has_sig": false, "md5_digest": "5c6c8fc2158bf805580a4d0e7d336412", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4497, "upload_time": "2018-06-17T02:53:31", "url": "https://files.pythonhosted.org/packages/de/48/39e30a4d7c745cb5c0ac2ab18f806fa51165a6cf57c6da386e09c2e3005a/binance-db-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5c6c8fc2158bf805580a4d0e7d336412", "sha256": "4cb4de9e1b5eaa9c1cae3f7fdd6ceea17beae6eb3649f6c3a26ed0681f35dfd1" }, "downloads": -1, "filename": "binance-db-0.0.2.tar.gz", "has_sig": false, "md5_digest": "5c6c8fc2158bf805580a4d0e7d336412", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4497, "upload_time": "2018-06-17T02:53:31", "url": "https://files.pythonhosted.org/packages/de/48/39e30a4d7c745cb5c0ac2ab18f806fa51165a6cf57c6da386e09c2e3005a/binance-db-0.0.2.tar.gz" } ] }