{"id":13930148,"url":"https://github.com/hosseinmoein/Lynx","last_synced_at":"2025-07-19T12:31:45.575Z","repository":{"id":131914850,"uuid":"169771822","full_name":"hosseinmoein/Lynx","owner":"hosseinmoein","description":"A very light weight dependency graph for systems with massive calculation complexities or scheduling systems ","archived":false,"fork":false,"pushed_at":"2024-04-01T17:17:10.000Z","size":714,"stargazers_count":44,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-08T18:26:30.410Z","etag":null,"topics":["alpha","calculations","dependencies","dependency","dependency-graph","dependency-manager","optimization","python","risk-modelling","scheduling","trading-platform","trading-systems"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hosseinmoein.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-02-08T17:21:50.000Z","updated_at":"2023-11-20T16:21:39.000Z","dependencies_parsed_at":"2023-04-09T02:07:04.637Z","dependency_job_id":"ed9726ab-686e-4f73-b6ae-dad07b6473c8","html_url":"https://github.com/hosseinmoein/Lynx","commit_stats":null,"previous_names":["hosseinmoein/lynx"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hosseinmoein%2FLynx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hosseinmoein%2FLynx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hosseinmoein%2FLynx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hosseinmoein%2FLynx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hosseinmoein","download_url":"https://codeload.github.com/hosseinmoein/Lynx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226607597,"owners_count":17658482,"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","calculations","dependencies","dependency","dependency-graph","dependency-manager","optimization","python","risk-modelling","scheduling","trading-platform","trading-systems"],"created_at":"2024-08-07T18:04:50.283Z","updated_at":"2024-11-26T19:30:52.514Z","avatar_url":"https://github.com/hosseinmoein.png","language":"Python","funding_links":[],"categories":["python"],"sub_categories":[],"readme":"\u003cimg src=\"dep_graph2.jpg\" alt=\"drawing\" width=\"400\"/\u003e\n\n# Dependency Graph\nThis is a dependency graph. The very end product is SystemItem and an example of that could be seen in \u003cI\u003eapp/tests/test_system_item.py\u003c/I\u003e.\nThe goal of this is to manage systems that have a large number of calculations that should happen in special order when an external event happens. Basically this mimics an ecosystem (or Excel), if you will. There are a lot of components in an ecosystem and when an external stimulus enters the system, it triggers a lot of reactions until the system comes to an equilibrium again. Trading alpha and risk models are also similar to an ecosystem with a lot of factors that can change as a result of external market events (e.g. a new bid, a new trade, etc.).\u003cBR\u003e\n    \n```Python\nfrom system_item import DependencyResult, SystemItem\n\n\nclass USTreasuryBond(SystemItem):\n    \"\"\"A crude simulation of a US treasury bond.\"\"\"\n\n    def __init__(self) -\u003e None:\n        \"\"\"Initialize.\"\"\"\n        super().__init__()\n        self.add_float_column('price', 0)\n        self.add_float_column('yield', 0)\n        self.add_float_column('dv01', 0)\n        self.add_datetime_column('expiration', None)\n        self.wire()\n\n    def price_to_yield(self, price_col: float, yield_col: float) -\u003e DependencyResult:\n        \"\"\"Price to yield calculation.\"\"\"\n        price = self.get(column=price_col).get_value()\n        yield_val = price / 100.0 * 1.5\n        self.get(column=yield_col).set_value(yield_val)\n        return DependencyResult.SUCCESS\n\n    def yield_to_price(self, yield_col: float, price_col: float) -\u003e DependencyResult:\n        \"\"\"Yield to price calculation.\"\"\"\n        yield_val = self.get(column=yield_col).get_value()\n        price = yield_val / 1.5 * 100.0\n        self.get(column=price_col).set_value(price)\n        return DependencyResult.SUCCESS\n\n    def price_to_dv01(self, price_col: float, dv01_col: float) -\u003e DependencyResult:\n        \"\"\"Price to dv01 calculation.\"\"\"\n        price = self.get(column=price_col).get_value()\n        self.get(column=dv01_col).set_value(price / 100.0)\n        return DependencyResult.SUCCESS\n\n    def dv01_action(self, dv01_col: float) -\u003e DependencyResult:\n        \"\"\"Action taken when dv01 changes\"\"\"\n        global SOMETHING_TO_CHANGE\n        SOMETHING_TO_CHANGE *= 2\n        return DependencyResult.SUCCESS\n\n    def wire(self) -\u003e None:\n        \"\"\"Setup the dependencies.\"\"\"\n        self.add_dependency('price', 'yield', self.price_to_yield)\n        self.add_dependency('yield', 'price', self.yield_to_price)\n        self.add_dependency('price', 'dv01', self.price_to_dv01)\n        self.add_action('dv01', self.dv01_action)\n\n\nus_bond = USTreasuryBond()\n\n# Trigger circular price \u003c-\u003e yield dependency\nus_bond.get(column='price').set_value(100.5)\n# After the above line:\n#     us_bond.get(column='price').get_value() == 100.5\n#     us_bond.get(column='yield').get_value() == 1.50749999\n#     us_bond.get(column='dv01').get_value() == 1.005\n```\n\n# Documentation\n[Graph Documentation](DepGraph.md)\u003cBR\u003e\n\n# Test/Example\n[Dependency Test](app/tests/test_system_item.py)\u003cBR\u003e\n[DataItem/ContainerItem Test](app/tests/test_data_item.py)\n    \n## [License](LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhosseinmoein%2FLynx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhosseinmoein%2FLynx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhosseinmoein%2FLynx/lists"}