{ "info": { "author": "Goutham Balaraman", "author_email": "gouthaman.balaraman@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Topic :: Scientific/Engineering", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Quant Python ToolKit\r\n\r\nThis package is intended to be a layer above QuantLib Python and a few other quantitative libraries \r\nto be more accessible for quantitative finance calculations.\r\n\r\n## Minimal Example\r\nHere is a minimal example for valuing a bond using a provided zero rates.\r\n\r\n from qtk import Controller, Field as F, Template as T\r\n\r\n data = [{\r\n 'Compounding': 'Compounded',\r\n 'CompoundingFrequency': 'Annual',\r\n 'Currency': 'USD',\r\n 'DiscountBasis': '30/360',\r\n 'DiscountCalendar': 'UnitedStates',\r\n 'ListOfDate': ['1/15/2015', '7/15/2015', '1/15/2016'],\r\n 'ListOfZeroRate': [0.0, 0.005, 0.007],\r\n 'ObjectId': 'USD.Zero.Curve',\r\n 'Template': 'TermStructure.Yield.ZeroCurve'},\r\n {\r\n 'DiscountCurve': '->USD.Zero.Curve',\r\n 'ObjectId': 'BondEngine',\r\n 'Template': 'Engine.Bond.Discounting'},\r\n {\r\n 'AccrualCalendar': 'UnitedStates',\r\n 'AccrualDayConvention': 'Unadjusted',\r\n 'AsOfDate': '2016-01-15',\r\n 'Coupon': 0.06,\r\n 'CouponFrequency': 'Semiannual',\r\n 'Currency': 'USD',\r\n 'DateGeneration': 'Backward',\r\n 'EndOfMonth': False,\r\n 'IssueDate': '2015-01-15',\r\n 'MaturityDate': '2016-01-15',\r\n 'ObjectId': 'USD.TBond',\r\n 'PaymentBasis': '30/360',\r\n 'PricingEngine': '->BondEngine',\r\n 'Template': 'Instrument.Bond.TreasuryBond'}]\r\n\r\n res = Controller(data)\r\n asof_date = \"1/15/2015\"\r\n\r\n ret = res.process(asof_date)\r\n tbond = res.object(\"USD.TBond\")\r\n print tbond.NPV()\r\n\r\n\r\nThe basic idea here is that once you have the data prepared, the `Controller` can be invoked to do the calculations. \r\nA few points that are worth noting here. \r\n\r\n- All the data is textual and rather intuitive. For instance, the coupon\r\n frequency is just stated as `Annual` or `Semiannual`. The same is true for a lot of other fields. For dates,\r\n the `dateutil` package is used to parse and covers a wide variety of formats. \r\n\r\n- The `data` is essentially a `list` of `dict` with each `dict` corresponding to a specific `object` as determined\r\n by the value to the key `Template` in each `dict`. Each `object` here has a name as specified by the value of the \r\n key `ObjectId`\r\n \r\n- One of the values can refer to another object described by a `dict` by using the `reference` syntax. For instance,\r\n the first `dict` in the `data` list (with `ObjectId` given as *USD.Zero.Curve* ) variable refers to an interest \r\n rate term structure of zero rates. The next object is a discounting bond engine, and require an yield curve as \r\n input for the discount curve. Here the yield curve is refered by using the prefix `->` along with the name of the\r\n object we are referring to.\r\n \r\n- Here, the `Controller` parses the data, and figures out the dependency and processes the object in the correct order\r\n and fulfills the dependencies behind the scenes. \r\n \r\n## Introspection\r\n \r\nThere are a few convenience methods that provide help on how to construct the data packet. For example,\r\nthe `help` method in the template prints out the summary and list of fields on how to construct\r\nthe data packet for the template.\r\n\r\n > T.TS_YIELD_BOND.help()\r\n \r\n**Description**\r\n\r\nA template for creating yield curve by stripping bond quotes.\r\n\r\n**Required Fields**\r\n\r\n - `Template` [*Template*]: 'TermStructure.Yield.BondCurve'\r\n - `InstrumentCollection` [*List*]: Collection of instruments\r\n - `AsOfDate` [*Date*]: Reference date or as of date\r\n - `Country` [*String*]: Country\r\n - `Currency` [*String*]: Currency\r\n\r\n**Optional Fields**\r\n\r\n - `ObjectId` [*String*]: A unique name or identifier to refer to this dictionary data\r\n - `InterpolationMethod` [*String*]: The interpolation method can be one of the following choices: LinearZero, CubicZero, FlatForward, LinearForward,LogCubicDiscount.\r\n - `DiscountBasis` [*DayCount*]: Discount Basis\r\n - `SettlementDays` [*Integer*]: Settlement days\r\n - `DiscountCalendar` [*Calendar*]: Discount Calendar\r\n\r\nThe `help` method prints the description in `info` method in Markdown format. While using IPython/Jupyter notebooks, the description\r\nprints in a nice looking format. One can start with a sample data packet to fill out the input fields using the `sample_data` method.\r\n\r\n > T.TS_YIELD_BOND.sample_data()\r\n \r\n {'AsOfDate': 'Required (Date)',\r\n 'Country': 'Required (String)',\r\n 'Currency': 'Required (String)',\r\n 'DiscountBasis': 'Optional (DayCount)',\r\n 'DiscountCalendar': 'Optional (Calendar)',\r\n 'InstrumentCollection': 'Required (List)',\r\n 'InterpolationMethod': 'Optional (String)',\r\n 'ObjectId': 'Optional (String)',\r\n 'SettlementDays': 'Optional (Integer)',\r\n 'Template': 'TermStructure.Yield.BondCurve'}\r\n \r\n \r\n## Installation\r\n\r\nYou can install qtk using `pip` or `easy_install`\r\n\r\n pip install qtk\r\n \r\nor\r\n\r\n easy_install qtk\r\n \r\n`qtk` has a dependency on `QuantLib-Python` which needs to be installed as well.\r\n\r\n\r\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/gouthambs/qtk-python", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "qtk", "package_url": "https://pypi.org/project/qtk/", "platform": "any", "project_url": "https://pypi.org/project/qtk/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/gouthambs/qtk-python" }, "release_url": "https://pypi.org/project/qtk/0.1.3/", "requires_dist": null, "requires_python": null, "summary": "A QuantLib Python ToolKit", "version": "0.1.3" }, "last_serial": 2306609, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "8ed9fc8cafc9dc24cf21b21ed185a2b3", "sha256": "651907b8e324f522d87836a3cdca19d78666102a51b09636cfea4d879af38566" }, "downloads": -1, "filename": "qtk-0.0.0.zip", "has_sig": false, "md5_digest": "8ed9fc8cafc9dc24cf21b21ed185a2b3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7808, "upload_time": "2016-06-11T19:06:54", "url": "https://files.pythonhosted.org/packages/15/46/ec36753d0b4b354117f08f76692542094e412750f3670f513ed7e7e401f5/qtk-0.0.0.zip" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "f1f886cee4990bf072021e50197c70b5", "sha256": "85d92974e4ad24de2491d16ea46f6f22c229bd69dc0609dca1cedeea0628ce49" }, "downloads": -1, "filename": "qtk-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f1f886cee4990bf072021e50197c70b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18253, "upload_time": "2016-07-22T03:49:11", "url": "https://files.pythonhosted.org/packages/c5/57/893942803f09d89af73d1ce6245d397aefee41f6860f62c9b5a8f9854786/qtk-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "3199b2e10aac0261f1fc18f492496852", "sha256": "66fb1139f027c2043a069c12e4f312d6941699426992660289aac5d2363eabc1" }, "downloads": -1, "filename": "qtk-0.1.1.tar.gz", "has_sig": false, "md5_digest": "3199b2e10aac0261f1fc18f492496852", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19597, "upload_time": "2016-07-22T04:25:18", "url": "https://files.pythonhosted.org/packages/04/57/5d5d54dbe790e94c4fdad455d4966445f4c094de66e47b86674828900247/qtk-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "24bb8c0df26e2d42fb8fee1c5a8b5603", "sha256": "54d46853aee2b7f610c52ae73ce6c137083a314afd725419255224ad861b307d" }, "downloads": -1, "filename": "qtk-0.1.2.tar.gz", "has_sig": false, "md5_digest": "24bb8c0df26e2d42fb8fee1c5a8b5603", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24419, "upload_time": "2016-08-19T02:05:02", "url": "https://files.pythonhosted.org/packages/17/b1/8bbd09f2592ee38f3c779d22783d7c5235c599e8354cb316040969333bc1/qtk-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "7374cfb47f3737deb2681aea42f493da", "sha256": "d421f221deee857e02bb0aaadc97b18abe5e93f4599768df72b1def30df131f1" }, "downloads": -1, "filename": "qtk-0.1.3.zip", "has_sig": false, "md5_digest": "7374cfb47f3737deb2681aea42f493da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45790, "upload_time": "2016-08-26T14:53:08", "url": "https://files.pythonhosted.org/packages/5f/01/652686261a836fb0a05b9b05398dfa5a09a523392b494ba0ca00c86f0fed/qtk-0.1.3.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7374cfb47f3737deb2681aea42f493da", "sha256": "d421f221deee857e02bb0aaadc97b18abe5e93f4599768df72b1def30df131f1" }, "downloads": -1, "filename": "qtk-0.1.3.zip", "has_sig": false, "md5_digest": "7374cfb47f3737deb2681aea42f493da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45790, "upload_time": "2016-08-26T14:53:08", "url": "https://files.pythonhosted.org/packages/5f/01/652686261a836fb0a05b9b05398dfa5a09a523392b494ba0ca00c86f0fed/qtk-0.1.3.zip" } ] }