{"id":21870683,"url":"https://github.com/coderixc/interactivebrokerpython","last_synced_at":"2025-07-05T18:33:36.805Z","repository":{"id":251525394,"uuid":"826210141","full_name":"Coderixc/InteractiveBrokerPython","owner":"Coderixc","description":"Welcome","archived":false,"fork":false,"pushed_at":"2024-08-03T15:53:59.000Z","size":19,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T08:48:14.521Z","etag":null,"topics":["algo-trading","algorithmic-trading","fianance","interactive-brokers","python","quant-devloper","quant-trading","quantitative-finance","spx","tws-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Coderixc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-07-09T09:21:51.000Z","updated_at":"2025-01-27T20:14:00.000Z","dependencies_parsed_at":"2024-08-03T18:25:26.110Z","dependency_job_id":null,"html_url":"https://github.com/Coderixc/InteractiveBrokerPython","commit_stats":null,"previous_names":["coderixc/interactivebrokerpython"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Coderixc/InteractiveBrokerPython","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coderixc%2FInteractiveBrokerPython","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coderixc%2FInteractiveBrokerPython/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coderixc%2FInteractiveBrokerPython/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coderixc%2FInteractiveBrokerPython/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Coderixc","download_url":"https://codeload.github.com/Coderixc/InteractiveBrokerPython/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coderixc%2FInteractiveBrokerPython/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263784946,"owners_count":23511004,"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":["algo-trading","algorithmic-trading","fianance","interactive-brokers","python","quant-devloper","quant-trading","quantitative-finance","spx","tws-api"],"created_at":"2024-11-28T06:12:13.791Z","updated_at":"2025-07-05T18:33:36.779Z","avatar_url":"https://github.com/Coderixc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Trading Engine for Interactive Brokers\nThis Python script connects to the Interactive Brokers Trader Workstation (TWS) API to facilitate automated trading. It includes functionality for establishing a connection, retrieving market data, and executing a Butterfly Option Strategy on the SPX index.\n\n# Features\n📌Connection to TWS API: Establish a secure connection with Interactive Brokers to execute trades.\n\n📌Market Data Retrieval: Access real-time and historical market data.\n\n📌Trading Symbol Master: Retrieve master data for trading symbols.\n\n📌Butterfly Option Strategy: Implement a basket-style Butterfly Option Strategy on SPX options with 0 days to expiry.\n\n📌Order Execution: Automatically execute trades based on predefined signals\n\n# Installation\ngit clone https://github.com/Coderixc/InteractiveBrokerPython.git\n\n\n\n# Install dependencies:\nMake sure you have Python installed on your machine. Then, install the necessary packages:\npip install ib_insync\n\n# Setup Interactive Brokers:\nEnsure that Interactive Brokers TWS or IB Gateway is running and API access is enabled.\n\n# Usage\nTrading Engine Class\nThe main class, TradingEngine, is responsible for connecting to the broker, retrieving data, and executing trades.\n\n# Key Methods\n📍ConnectionEstablishment() : This method connects the engine to the TWS API, enabling communication with Interactive Brokers.\n\n📍getMaster() : Retrieves the trading symbol master list to identify available trading symbols.\n\n📍GetMarketData() : Fetches live market data for selected trading symbols or make simulation to get price.\n\n📍GetHistoricalData_Index() : Acquires historical data for stocks to support backtesting and analysis.\n\n📍StartTrading(): Starts the trading process, executing orders based on generated signals.\n\n📍ButterFlyOptionStrategyBasketStyle() : This method implements the butterfly strategy by dynamically selecting the ATM, ITM, and OTM strikes based on the latest market prices.\n\n## Butterfly Option Strategy\nThis project includes a butterfly option strategy for SPX with DTE \"0\" expiry. The strategy involves creating a balanced spread using at-the-money (ATM), in-the-money (ITM), and out-of-the-money (OTM) options.\n\nThis README provides a structured overview of your project, making it easier for others to understand and contribute to your work\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderixc%2Finteractivebrokerpython","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderixc%2Finteractivebrokerpython","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderixc%2Finteractivebrokerpython/lists"}