{"id":23191955,"url":"https://github.com/markwinter/ingenium","last_synced_at":"2025-04-05T07:08:55.454Z","repository":{"id":57642832,"uuid":"430059655","full_name":"markwinter/ingenium","owner":"markwinter","description":"Distributed Trading System built on NATS using Golang","archived":false,"fork":false,"pushed_at":"2024-05-21T10:40:28.000Z","size":236,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-10T14:51:38.792Z","etag":null,"topics":["algorithmic-trading","algotrading","distributed","go","golang","nats","trading"],"latest_commit_sha":null,"homepage":"","language":"Go","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/markwinter.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-20T09:24:05.000Z","updated_at":"2024-05-21T18:15:27.000Z","dependencies_parsed_at":"2024-01-10T00:53:21.539Z","dependency_job_id":"15b87adc-83db-41ba-88b3-100eb4300260","html_url":"https://github.com/markwinter/ingenium","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markwinter%2Fingenium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markwinter%2Fingenium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markwinter%2Fingenium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markwinter%2Fingenium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markwinter","download_url":"https://codeload.github.com/markwinter/ingenium/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299834,"owners_count":20916191,"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":["algorithmic-trading","algotrading","distributed","go","golang","nats","trading"],"created_at":"2024-12-18T12:19:31.711Z","updated_at":"2025-04-05T07:08:55.432Z","avatar_url":"https://github.com/markwinter.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ingenium\n\n### Prototyping Stage\n\nThis project is still in prototype stage.\n\n---\n\nIngenium is an event-driven trading system built on top of [NATS](https://nats.io/). It provides a common library (`go get github.com/markwinter/ingenium/pkg`) that allows quick creation of new components. It's expected that end users create their own components, e.g. ingestors and strategies, using the common library that handles correct typing etc. so that components can easily communicate with each other.\n\nIngenium will come with telemetry built in using OpenTelemetry.\n\nThere will also be a web component in the future to view and manage the current state of the system such as\n- View currently running components e.g. enabled strategies, data ingestors\n- Launch backtests\n- View portfolio stats and transaction history\n\n## Components\n\nA simplified diagram of the system is below. In reality you can have multiple of each component running at the same time.\n\n\n           1.                                         2.\n          ┌────────────┐                   ┌────────────┐\n          │            │                   │            │\n          │  Ingestor  │       Data Event  │  Strategy  │\n          │            │     ┌─────────────►            │\n          └──────┬─────┘     │             └───────────┬┘\n                 │           │                         │\n                 │           │                         │\n                 │         ┌─┴──────────────┐          │\n                 │         │                │          │\n                 └─────────►  Event Broker  ◄──────────┘\n               Data Event  │                │     Signal Event\n                           └▲─▲────────────┬┘\n                            │ │            │\n                            │ │            └─────────┐\n                    ┌───────┘ └────────────┐         │Signal Event\n                    │     Order Event /    │         │\n    ┌───────────────▼───┐ Execution Event ┌▼─────────▼──┐\n    │                   │                 │             │\n    │  Order Executor   │                 │  Portfolio  │\n    │                   │                 │             │\n    └───────────────────┘                 └─────────────┘\n     4.                                               3.\n\n\n### Ingestors\n\nIngestors feed market data into the system. The component produces a data event `ingenium.DataEvent` for each market data\nand sends it to a subject in the format: `ingenium.ingestor.data.\u003cstock-symbol\u003e`\n\nExamples of ingestors:\n\n- One-shot jobs that read historical data from a CSV file or an API\n- A long running binary that reads from a live market exchange\n\n### Strategies\n\nStrategies receive data events from Ingestors by subscribing to a data event subject `ingenium.ingestor.data.\u003cstock-symbol\u003e` (or wildcard data `ingenium.ingestor.data.*`). Strategies produce signal events `ingenium.SignalEvent` based on an implemented trading strategy and send it to subject `ingenium.strategy.signal`\n\n### Portfolios\n\nPortfolios receive signal events from Strategies and decide based on several factors whether to generate a market order event `ingenium.OrderEvent` and send it to the subject\n`ingenium.portfolio.order`.\n\n### Order Executors\n\nOrder Executors receive market order events from Portfolios and execute the appropriate order\non the exchange. They also return order execution events back to the Portfolio using the subject `ingenium.executor.execution`. In the case of partial fills, multiple messages are sent containing the original order id so the Portfolio can track its position.\n\n## Events\n\nAll events are defined as Golang structs. Currently they are serialized to JSON.\n\nBelow is a list of all events in the system and their spec\n\n### Market Data\n\nType: `ingenium.ingestor.data`\n\n```GO\ntype DataEvent struct {\n  Type      DataType\n  Symbol    string\n  Timestamp string\n  Ohlc      DataOhlc `json:\",omitempty\"`\n}\n\ntype DataOhlc struct {\n  Open   string\n  High   string\n  Low    string\n  Close  string\n  Volume string\n}\n```\n\n### Signal\n\nType: `ingenium.strategy.signal`\n\n```GO\ntype SignalEvent struct {\n  Symbol string\n  Signal string\n}\n```\n\n### Market Order\n\nType: `ingenium.portfolio.order`\n\n```GO\ntype OrderEvent struct {\n  Id        string\n  Timestamp time.Time\n\n  Symbol   string\n  Side     Side\n  Quantity string\n  Type     OrderType\n\n  TimeInForce   TimeInForce\n  ExtendedHours bool\n\n  LimitPrice   string\n  StopPrice    string\n  TakeProfit   string\n  TrailPrice   string\n  TrailPercent string\n  StopLoss     StopLoss\n}\n\ntype StopLoss struct {\n  LimitPrice string\n  StopPrice  string\n}\n\ntype OrderType string\ntype Side string\ntype TimeInForce string\n\nconst (\n  MarketOrderType    OrderType   = \"market\"\n  LimitOrderType     OrderType   = \"limit\"\n  BuySide            Side        = \"buy\"\n  SellSide           Side        = \"sell\"\n  DayTimeInForce     TimeInForce = \"day\"\n  GtcTimeInForce     TimeInForce = \"gtc\"\n)\n```\n\n### Order Execution\n\nType: `ingenium.executor.execution`\n\n```GO\ntype ExecutionEvent struct {\n  Id        string\n  Timestamp time.Time\n\n  OrderId  string\n  Quantity string\n  Symbol   string\n}\n```\n\n## Roadmap\n\n- A database component to record events, trades, portfolio data etc.\n- Simple telemetry to component clients\n- Allow deploys to local, or to Kube cluster (similar to [Service Weaver](https://serviceweaver.dev/))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkwinter%2Fingenium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkwinter%2Fingenium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkwinter%2Fingenium/lists"}