{"id":13533075,"url":"https://github.com/nymath/torchqtm","last_synced_at":"2025-04-01T21:31:49.532Z","repository":{"id":167488937,"uuid":"643119933","full_name":"nymath/torchqtm","owner":"nymath","description":"TorchQuantum is a backtesting framework that integrates the structure of PyTorch and WorldQuant's Operator for efficient quantitative financial analysis.","archived":false,"fork":false,"pushed_at":"2023-07-13T07:00:23.000Z","size":30595,"stargazers_count":27,"open_issues_count":1,"forks_count":9,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-05-21T13:57:28.737Z","etag":null,"topics":["alpha-model","deep-learning","function-approximation","quantitative-finance"],"latest_commit_sha":null,"homepage":"https://nymath.github.io/torchqtm/navigate/","language":"Cython","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nymath.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-05-20T06:50:30.000Z","updated_at":"2024-04-22T16:51:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"a9be32e9-9ca2-4d50-8085-e1db8606551b","html_url":"https://github.com/nymath/torchqtm","commit_stats":null,"previous_names":["nymath/torchquantum","nymath/torchqtm"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nymath%2Ftorchqtm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nymath%2Ftorchqtm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nymath%2Ftorchqtm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nymath%2Ftorchqtm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nymath","download_url":"https://codeload.github.com/nymath/torchqtm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246713221,"owners_count":20821858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alpha-model","deep-learning","function-approximation","quantitative-finance"],"created_at":"2024-08-01T07:01:16.366Z","updated_at":"2025-04-01T21:31:44.516Z","avatar_url":"https://github.com/nymath.png","language":"Cython","readme":"\u003cimg src=\"https://github.com/nymath/torchquantum/blob/main/src/fig/logo.png\" align=\"right\" width=\"196\" /\u003e\n\n# torchquantum\n\nTorchQuantum is a backtesting framework that integrates\nthe structure of PyTorch and WorldQuant's Operator for\nefficient quantitative financial analysis.\n\n## Contents\n\n- [Installation](#installation)\n- [Features](#features)\n- [Contribution](#contribution)\n\n## Installation\n\nfor Unix:\n\n```shell\ncd /path/to/your/directory\ngit clone git@github.com:nymath/torchquantum.git\ncd ./torchquantum\n```\n\nBefore running examples, you should compile the cython code.\n\n```shell\npython setup.py build_ext --inplace\n```\n\nNow you can run examples\n\n```shell\npython ./examples/main.py\n```\n\nIf you are not downloading the dataset, then you should\n\n```shell\ncd ./examples\nmkdir largedata\ncd ./largedata\nwget https://github.com/nymath/torchquantum/releases/download/V0.1/stocks_f64.pkl.zip\nunzip stocks_f64.pkl.zip\nrm stocks_f64.pkl.zip\ncd ../\ncd ../\ngit checkout dev\n```\n\n## Example\n\nYou can easily create an alpha through torchquantum!\n\n```python\nimport torchqtm.op as op\nimport torchqtm.op.functional as F\n\n\nclass NeutralizePE(op.Fundamental):\n    def __init__(self, env):\n        super().__init__(env)\n        self.lag = op.Parameter(5, required_optim=False, feasible_region=None)\n\n    def forward(self):\n        self.data = F.divide(1, self.env.PE)\n        self.data = F.winsorize(self.data, 'std', 4)\n        self.data = F.normalize(self.data)\n        self.data = F.group_neutralize(self.data, self.env.Sector)\n        self.data = F.regression_neut(self.data, self.env.MktVal)\n        self.data = F.ts_mean(self.data, self.lag)\n        return self.data\n```\n\n- `F` is library that contains the operators defined by WorldQuant.\n- `op.Fundamental` implies the NeutralizePE belongs to fundamental alpha.\n- `self.lag` is the parameter of rolling mean, which can be optimized through grid search.\n\n## Features\n\n- High-speed backtesting framework (most of the operators are implemented through cython)\n- A revised gplearn library that is compatible with Alpha mining.\n- CNN and other state of the art models for mining alphas.\n- Event Driven backtesting framework is available.\n\n## Contribution\n\nFor more information, we refer to [Documentation](https://nymath.github.io/torchquantum/navigate).\n\n## Join us\n\nIf you are interested in quantitative finance and are committed to devoting\nyour life to alpha mining, you can contact me through WeChat at Ny_math.\n\n## References\n\n[quantopian/alphalens](https://github1s.com/quantopian/alphalens/blob/HEAD/alphalens/performance.py)\n\n[quantopian/zipline](https://github1s.com/quantopian/zipline/blob/HEAD/zipline/performance.py)\n\n","funding_links":[],"categories":["Alpha Collections"],"sub_categories":["Expression based alpha"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnymath%2Ftorchqtm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnymath%2Ftorchqtm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnymath%2Ftorchqtm/lists"}