Package: ibquant
IB QuantA command line interface and Python framework for the Interactive Brokers APIs.OverviewIB Quant leveragesib-insyncto interface with Interactive Brokers TWS or Gateway.The CLI is namedib.After installing ibquant, ib's command groups can be shown in terminal with:ib--helpFor now, the CLI mostly serves to replace pytest as qualifying tests that a function or method is working as intended before including in a script. Most CLI commands replicate tasks that can be easily accomplished in the TWS platform.The end goal is that these CLI commands come together in a high level command such asib trader run --strategy=some_strategy_name.pyto have core.Trader run the given strategy and perform appropriate pre, intra, and post trade reporting (logging) requirements, if any.Core Classes and Mixin Interfacescore.AppBaseserves as a base for all other core classescore.Traderdrives a user defined strategy in live tradingcore.Bruteenables brute force optimization of rules based trading strategiescore.Learneris used to optimize gradient based learning strategiesmixins.AccountMixinsenables account features for non-advisor accountsmixins.AdvisorMixinsenables features for an advisor account (groups, model portfolios)mixins.ConnectionMixinshandles the connection to the running TWS or Gateway sesionmixins.ContractMixinsprovides an extended class to definecontractsfor the TWS APImixins.DataMixinsprovides utilities for fetching historical data, and for streaming top of book or limit order book data.mixins.OrderMixinsprovides interfaces for several TWSorder typesmixins.StrategyMixinsprovides a base class for user defined strategiescore.Learner should be used with my ML template,lightning-podInstallationThe package can be installed for standard use or for development.Required dependencies for standard use as a package are shown insetup.cfgunderinstall_requiresof theoptionsgroup.Dev dependencies are shown insetup.cfgunder theoptions.extras_requiregroup.Installing the package for standard useibquant is available via PyPi with pip. Installation can be done with:condacondaenvcreate-nibquantpython-y
condaactivateibquant
pipinstallibquantvenvcd{{pathtoyourproject}}python3-mvenv.venv/# Activate the environment# Linux and MacOSsource.venv/bin/activate# Windows.venv\Scripts\activate.bat# install the packagepipinstallibquantInstalling the package for developmentAfter cloning the repo, the framework can be installed for development with:# creating a virtual environmentcd{{pathtoibquantclone}}python3-mvenv.venv/# Activate the environment# Linux and MacOSsource.venv/bin/activate# Windows.venv\Scripts\activate.bat# install an editable version of the packagepipinstall-e".[dev]"UsageAfter installing ibquant, log into a TWS paper account and test example flows from terminal with:ibadvisormanaged-accountsibaccountsummaryibcontractlookup--contract-type=FutureEach of the above commands will prompt the user for required inputs.localSymbol, multiplier, and currency prompts ofib contract lookupare not requiredEcosystemAside from using ib-insync, ibtrader also provides users with:QuantLibalphalens-reloaded: community maintained version of Quantopian alphalensempyrical-reloaded: community maintained version of Quantopian empyricalpyfolio-reloaded: community maintained version of Quantopian pyfoliozipline-reloaded: community maintained version of Quantopian ziplinenasdaq-data-link: formerly known as QuandlPyEX: an IEX Cloud API toolTA-Lib: a technical analysis library common to PyEX and ZiplineFactors, Indicators, Studies, StrategiesZipline Reloaded provides factors and indicators in thepipeline API. TA-Lib is installed as a dependency of Zipline. Most factors and indicators of both libraries will be reachable via ibtrader.factors.Indicator definitions can be found at:Trading TechnologiesGlossarythinkorswimStudies LibraryIBKRTechnical Analytics GuideSample strategies can be found via the link below.thinkorswimStrategies LibrarySuggested Reading and ReferencesAlgorithmic TradingThe texts shown below are merely suggestions; each text is written by Dr. Yves Hilpisch. The content is not heavy on math notation, and the author has done a great job at providing code examples.Python for Algorithmic TradingFinancial Theory with PythonArtificial Intelligence in FinanceDerivatives Analytics with PythonPythonAs with the above, the books shown below are considered standard suggestions.Fluent Python(Ramalho)High Performance Python(Gorelick et al)Python for Data Analysis(McKinney)Aside from the texts, and possibly a more suitable way to learn professional level Python programming, is to look at the source code of the Quantopian reloaded projects.Trading Information and EducationThe resources shown below are free, and sourced from reputable providers.TD Ameritrade NetworkYouTubeInteractive BrokersTraders' AcademyInteractive BrokersQuant BlogInteractive BrokersYouTubeCME GroupMarketsCME GroupEducationCME GroupYouTubeCBOEMarketsCBOEOptions InstituteCBOEYouTubeNASDAQMarket ActivityNASDAQNews and InsightsQuantopianYouTubetastytrade(the original thinkorswim team)Alpha ArchitectBlogQuantocracyBlogsarXiv Quantitative FinancepapersMan GroupInsightsFINRAInvestors EducationCorporate Finance Institutefree courses