ebook img

API Reference Guide PDF

602 Pages·2015·17.66 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview API Reference Guide

APIReference Guide April 2015 Updated through APIRelease 9.72 ©2015 Interactive BrokersLLC.All rightsreserved. Sun,Sun Microsystems,the Sun Logo and Java are trademarksorregistered trademarksofSun Microsystems,Inc.in the United Statesand othercountries.Excel,Windowsand Visual Basic (VB)are trademarksorregistered trademarksofthe Microsoft Corporation in the United Statesand/orin othercountries. Any symbolsdisplayed within these pagesare forillustrative purposesonly,and are not intended to portray any recom- mendation. Contents Contents i Overview 31 About the APIs 32 Installing the APISoftware 33 Run the APIthrough TWS 34 Run the APIthrough the IB Gateway 35 Recommendations 37 APIOrdersand TWSPrecautionary Settings 38 APIOrderIDs 40 New OrderExample 40 Modified OrderExample 40 TraderWorkstation APISettings 41 General 41 Trusted IPAddresses 42 Uninstalling and Re-installing the TWSAPISoftware on Windows 43 DDE forExcel 45 Tutorial: Requesting Real-Time Market Data 46 Tutorial: Requesting Real-Time Market Data -What You Will Need 46 Tutorial: Requesting Real-Time Market Data1.Prepare the Request 47 Tutorial: Requesting Real-Time Market Data2.Request the Data 48 Tutorial: Requesting Real-Time Market Data3.Understand the Formulas 49 The Request 49 The Bid Price Retrieval 49 Tutorial: Requesting Real-Time Market Data4.Obtain the Last Available Error 50 Why isit important to first clearthe errorformula before correcting ourrequest? 51 APIReferenceGuide i Contents Tutorial: Requesting Real-Time Market Data5.Define OtherInstruments 52 How to Find the Definition ofa Contract 52 FormulasforDifferent Security Types 54 Tutorial: Requesting Real-Time Market Data6.Request OtherData Values 55 Tutorial: Requesting Historical Data 57 Tutorial: Requesting Real-Time Market Data -What You Will Need 57 Tutorial: Requesting Historical Data1.Prepare the Request 58 How to Handle Spacesand Colonsin the Formula 59 Enterthe Historical Data Request 60 Tutorial: Requesting Historical Data2.Request the Data -Add a Button 61 Tutorial: Requesting Historical Data3.Request the Data -Add the Code 62 Tutorial: Requesting Historical Data4.Request Duration and BarSize 64 Duration 64 BarSizes 65 Tutorial: Requesting Historical Data5.Examples 65 Getting Started with the DDEforExcel API 67 Download the APIComponentsand Spreadsheet 68 Configure TraderWorkstation to Support APIComponents 69 Open the Sample Spreadsheet 70 Using the DDEforExcel Sample Spreadsheet 71 TickersPage 72 Using the TickersPage 72 TickersPage ToolbarButtons 74 Basic OrdersPage 75 Placing Orders 76 Placing a Combination Order 77 APIReferenceGuide ii Contents Supported OrderTypes 79 Basic OrdersPage ToolbarButtons 79 Extended OrderAttributesPage 79 Manually ProgramExtended OrderAttributes 80 Apply Extended OrderAttributesto Individual Ordersand GroupsofOrders 81 Extended OrderAttributes 81 Conditional OrdersPage 86 Setting Up Conditional Orders 86 Conditional OrderExamples 88 If-Filled order 88 Price-change order 88 Conditional OrdersPage ToolbarButtons 89 Advanced OrdersPage 89 Placing a Bracket Order 90 Placing a Volatility Order 91 Placing a Trailing Stop Limit Order 92 Placing a Scale Order 93 Placing a Relative Order 94 Advanced OrdersPage ToolbarButtons 94 Open OrdersPage 94 Viewing Open Orders 95 Open OrdersTab ToolbarButtons 96 ExecutionsPage 96 Viewing Executions 97 ExecutionsPage ToolbarButtons 97 ExecutionsReporting Page 97 APIReferenceGuide iii Contents Running Execution Reports 98 Account Page 98 Using the Account Page 99 Account Page ToolbarButtons 100 Account Page Values 100 Portfolio Page 104 Viewing YourPortfolio 105 Portfolio Page ToolbarButtons 105 Historical Data Page 106 Viewing Historical Data 106 Historical Data Page ToolbarButtons 108 Historical Data Page Query Specification Fields 108 Market ScannerPage 111 Starting a Market ScannerSubscription 111 Market ScannerParameters 112 Market ScannerPage ToolbarButtons 113 Available Market Scanners 113 Contract DetailsPage 117 Requesting Contract Details 118 Contract DetailsPage ToolbarButtons 118 Bond Contract DetailsPage 119 Requesting Bond Contract Details 119 Bond Contract DetailsPage ToolbarButtons 120 Market Depth Page 120 Using the Market Depth Page 121 Market Depth Page ToolbarButtons 122 APIReferenceGuide iv Contents AdvisorsPage 122 Allocating Sharesto a Single Account 123 Placing an Orderusing an FA Account Group and Method 124 Placing an Orderusing an Allocation Profile 124 AdvisorsPage ToolbarButtons 125 DDEforExcel APIReference 126 Viewing the Code 126 Modules 127 Macros 127 Named Ranges 128 DDESyntax forExcel 129 Using DDESyntax to Request Market Data 134 Active X 137 Linking to the Application using ActiveX 138 Registering Third-Party ActiveX Controls 139 Running the ActiveX APIon 64-bit WindowsXPSystems 140 ActiveX Methods 141 connect() 143 disconnect() 143 reqCurrentTime() 143 setServerLogLevel() 143 reqMktDataEx() 144 cancelMktData() 144 calculateImpliedVolatility() 144 cancelCalculateImpliedVolatility() 145 calculateOptionPrice() 145 APIReferenceGuide v Contents cancelCalculateOptionPrice() 145 reqMarketDataType() 145 placeOrderEx() 146 cancelOrder() 146 reqOpenOrders() 146 reqAllOpenOrders() 146 reqAutoOpenOrders() 146 reqIds() 147 exerciseOptionsEx() 147 reqGlobalCancel() 148 reqExecutionsEx() 148 reqContractDetailsEx() 148 reqMktDepthEx() 149 cancelMktDepth() 149 reqAccountUpdates() 149 reqAccountSummary() 150 cancelAccountSummary() 153 reqPositions() 153 cancelPositions() 153 reqNewsBulletins() 153 cancelNewsBulletins() 154 reqManagedAccts() 154 requestFA() 154 replaceFA() 154 reqHistoricalDataEx() 155 cancelHistoricalData() 157 APIReferenceGuide vi Contents reqScannerParameters() 157 reqScannerSubscriptionEx() 157 cancelScannerSubscription() 158 reqRealTimeBarsEx() 158 cancelRealTimeBars() 159 createComboLegList() 159 createContract() 159 createExecutionFilter() 159 createOrder() 160 createScannerSubscription() 160 createTagValueList 160 createUnderComp() 160 reqFundamentalData() 160 cancelFundamentalData() 161 queryDisplayGroups() 161 subscribeToGroupEvents() 161 updateDisplayGroup() 161 unsubscribeFromGroupEvents() 162 ActiveX Events 163 connectionClosed() 164 currentTime() 164 errMsg() 164 tickPrice() 164 tickSize() 165 tickOptionComputation() 165 tickGeneric() 166 APIReferenceGuide vii Contents tickString() 166 tickEFP() 166 tickSnapshotEnd() 167 marketDataType() 167 orderStatus() 168 openOrderEx() 169 openOrderEnd() 169 nextValidId() 169 permId() 170 deltaNeutralValidation() 170 updateAccountValue() 170 updatePortfolioEx() 172 updateAccountTime() 173 accountDownloadEnd() 173 accountSummary() 173 accountSummaryEnd 176 position() 176 positionEnd() 177 updateNewsBulletin() 177 contractDetailsEx() 177 contractDetailsEnd() 177 bondContractDetails() 178 execDetailsEx() 179 execDetailsEnd() 179 commissionReport() 179 updateMktDepth() 180 APIReferenceGuide viii

Description:
Excel, Windows and Visual Basic (VB) are trademarks or registered trademarks of the. Microsoft .. C#. 367. Tutorial: Building a C# API Sample Application. 368. C# Tutorial: 1. Create . Percentage of Volume (PctVol). 544 557. Tex (TEX). 557. Tex (TEX) Java Code Sample. 558. TWAP (TWAP). 558.
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.