{ "info": { "author": "Xavier Bruhiere", "author_email": "xavier.bruhiere@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Science/Research", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Office/Business :: Financial", "Topic :: Scientific/Engineering :: Information Analysis", "Topic :: System :: Distributed Computing" ], "description": "Intuition as a REST Service\n===========================\n\n> This plugin provides a RESTFul interface to intuition\n\n\nInstallation\n------------\n\n```console\n$ git clone https://github.com/hackliff/intuition-plugins\n$ cd intuition-plugins/rest\n$ (sudo) python setup.py install\n$ (sudo) pip install honcho # Optionnaly\n```\n\nCurrently the plugin searchs for portfolios data in [Rethinkdb](rethinkdb.com).\nCheck out their installation page and [how to use it in\nintuition](https://github.com/hackliff/insights/blob/master/insights/plugins/database.py)\n\n\nUsage and API\n-------------\n\nRun the server in a first console\n\n```console\n$ # Rethinkdb informations\n$ export DB_HOST=localhost\n$ export DB_PORT=28015\n$ export DB_NAME=portfolios\n$ export BROKER_HOST=localhost\n$ export BROKER_PORT=6379\n\n$ telepathy --help\n$ telepathy --bind 0.0.0.0 --debug &\n$ celery -A telepathy.trades worker --loglevel info\n\n$ # Or more convenient, use the procfile in intuition-plugins/rest/app\n$ honcho start -f /path/to/intuition-plugins/rest/app/Procfile\n```\n\nIn another terminal\n\n* Request portfolio metrics\n\n```console\n$ curl -X GET http://localhost:5000/api/v1/doc\n\n$ curl -X GET http://localhost:5000/api/v1/portfolios?id=chuck&key=portfolio.cash\n$ GET /api/v1/portfolios?id=chuck&key=cmr.algo_volatility\n$ # the key is the data path (check below), the id the database table (i.e. the argument you gave to --id)\n\n$ # You can retrieve many keys at the same time\n$ GET /api/v1/portfolios?id=chuck&key=cmr.algo_volatility&key=portfolio.cash\n\n$ # Or for many portfolios\n$ GET /api/v1/portfolios?id=chuck&id=gekko&key=cmr.algo_volatility\n\n$ # Or even more informations\n$ GET /api/v1/portfolios?id=chuck&key=portfolio\n$ GET /api/v1/portfolios?id=chuck\n\n$ # You can request time series given epoch times.\n$ # If the \"to\" parameter is missing, it will be set to now\n$ GET /api/v1/portfolios?id=chuck&key=portfolio.portfolio_value&from=1389183632\n```\n\n* Trigger backtests or live sessions\n\n```console\n# Trigger the session\n$ POST /api/v1/trades/{{ id }}?context=mongodb::172.17.0.4:27017/{{ conf_id }}&bot=true\n\n# Get the status\n$ GET /api/v1/trades/{{ id }}\n```\n\n\n* Interact with the portfolio manager\n\n```console\n$ # Make the portfolio buy (or sell negative)\n$ # You can add as many 'deal' parameter as you want\n$ POST /api/v1/order/{{ id }}?deal={{ sid }}:{{ amount }}\n```\n\n\nNotes\n-----\n\n* The [Dashboard plugin](https://github.com/hackliff/intuition-plugins/blob/master/dashboard/readme.md)\nuses this API\n\n* At a specific date, intuition stores this type of data\n\n```json\n{\n \"date\": Thu Jan 09 2014 18:58:04 GMT+00:00,\n \"id\": \"08bc3177-034b-4317-9e8e-d9a160adcafc\",\n \"positions_value\": 49921.24627,\n \"returns\": -0.023526527502224052,\n \"start_date\": Thu Jan 09 2014 17:01:04 GMT+00:00,\n \"starting_cash\": 50000,\n \"cmr\": {\n \"algo_volatility\": 0,\n \"algorithm_period_return\": 0,\n \"alpha\": -0.0794,\n \"benchmark_period_return\": 1001,\n \"benchmark_volatility\": 0,\n \"beta\": 0,\n \"excess_return\": -0.0794,\n \"information\": null,\n \"max_drawdown\": 0,\n \"period_label\": \"2014-01\",\n \"sharpe\": null,\n \"sortino\": 0,\n \"trading_days\": 1,\n \"treasury_period_return\": 0.0794\n },\n \"portfolio\": {\n \"capital_used\": -51097.572645111206,\n \"cash\": -1097.572645111206,\n \"pnl\": -1176.3263751112027,\n \"portfolio_value\": 48823.6736248888,\n \"positions\": {\n \"USD/JPY\": {\n \"amount\": 47,\n \"cost_basis\": 104.7801341943,\n \"last_sale_price\": 104.787,\n \"sid\": \"USD/JPY\"\n }\n }\n}\n```", "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/hackliff/intuition-plugins", "keywords": null, "license": "Apache 2.0", "maintainer": null, "maintainer_email": null, "name": "telepathy", "package_url": "https://pypi.org/project/telepathy/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/telepathy/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/hackliff/intuition-plugins" }, "release_url": "https://pypi.org/project/telepathy/0.0.4/", "requires_dist": null, "requires_python": null, "summary": "This plugin provides a RESTFul interface to intuition", "version": "0.0.4" }, "last_serial": 980207, "releases": { "0.0.4": [ { "comment_text": "", "digests": { "md5": "b6698ae22fccfbffad115ab26ed0d24c", "sha256": "2551220a7e274af246379dd8241c3ed33afd5d73d8c27cf5c9058b1f9f1cc8ea" }, "downloads": -1, "filename": "telepathy-0.0.4.tar.gz", "has_sig": false, "md5_digest": "b6698ae22fccfbffad115ab26ed0d24c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6362, "upload_time": "2014-01-24T14:44:21", "url": "https://files.pythonhosted.org/packages/77/f4/58aa2612aa10bfffa96213c0c28a6ac7631104e9ddb775159b4027e8bed7/telepathy-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b6698ae22fccfbffad115ab26ed0d24c", "sha256": "2551220a7e274af246379dd8241c3ed33afd5d73d8c27cf5c9058b1f9f1cc8ea" }, "downloads": -1, "filename": "telepathy-0.0.4.tar.gz", "has_sig": false, "md5_digest": "b6698ae22fccfbffad115ab26ed0d24c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6362, "upload_time": "2014-01-24T14:44:21", "url": "https://files.pythonhosted.org/packages/77/f4/58aa2612aa10bfffa96213c0c28a6ac7631104e9ddb775159b4027e8bed7/telepathy-0.0.4.tar.gz" } ] }