This is probably a fairly simple question; I have very little experience with the IB API. Within their sample ActiveX Excel sheet there is the ability to download account and portfolio data from TWS. My question is; How can I separate this page and incorporate it into a new Excel workbook. I would like to be able to download my account positions, then run some other calculations using this data (option greeks, P/L, etc). I like the ability to click a button (macro) and get my current positions, as opposed to entering them manually. Thanks.
Not sure if I understand correctly but I used to do this just by updating the latest portfolio info from IB (using their spreadsheet template you're referring to) and copy/pastevalue into a separate workbook for analysis (where I also kept historical portfolio snapshots for comparison - usually daily or after a sig change). You could fully automate that process but even if you didn't it should be much faster than entering each position manually. I can probably find some old samples if you'd like.
Ok thanks. Yeah, I could copy/paste then run my numbers. I just like to have things automated (although it will probably save me 5 secs). Any sheets are appreciated.
RE: copy/paste I'm not familiar with IB's API but there has to be a better way than copy/paste. I would think that you can export the data to a CSV file then import the CSV file into another software program, such as Excel.
Basically, I want to know how to move the vb codes/modules into a new workbook. I have tried import/export, and other methods, but it doesn't work.
I suppose TWSActiveX.xls and ThirdPartyFile.xls can run at the time. I think there are two solutions : 1/ Merge both files (but it might not work): Copy/Paste the spreadsheets âGeneralâ,âAccountâ,âPortfolioâ from TWSActiveX.xls to ThirdPartyFile.xls Copy/Paste the modules present in the spreadsheets âGeneralâ, âAccountâ, âPortfolioâ from TWSActiveX.xls to ThirdPartyFile.xls Copy/Paste modules and class modules from TWSActiveX.xls to ThirdPartyFile.xls At this stage you should check modules are compatible (variables, functions, procedures from TWSActiveX and ThirdPartyFile should have different names). Try to run both applications at the same time: it may crash for various reasons⦠2/ An easy solution: Insert a new spreadsheet in ThirdPartyFile.xls Copy/paste âPortfolioâ from TWSActiveX.xls to ThirdPartyFile.xls Rename this spreadsheet as âPortfolioâ Next, you link the cells you want from ThirdPartyFile.xls to TWSActiveX.xls. For instance, click on cell A6 of [ThirdPartyFile.xls]Portfofio, insert â=â, click on cell A6 of TWSActiveX.xls>Portfolio Now in A6 you have â=[TwsActiveX.xls]Portfolio!$A$6â Remove both â$â Now in A6 you have â=[TwsActiveX.xls]Portfolio!A6â Copy/paste the formula in A6 for the range A6:S206 Run TWSActiveX.xls i.e. General> Click âConnect to TWS Buttonâ Account> Click âRequest Account Updatesâ Now, you should have updates of your portfolio in TWSActiveX.xls and ThirdPartyFile.xls