Using Microsoft Excel for Trading

Tom at Neural Market Trends asked:

Nice, I was planning on using Excel to build an interface with their API as well. Was it hard to do? Do I need to learn Visual Basic?

What I want to do is address this question from a trading perspective.

Do I Need a Spreadsheet?

This is a good question because you might be tempted to believe that writing an application would be a better approach. Though the problem with trading is that you are constantly trying out new strategies. Implementing a strategy using a programming language takes too much time. Some people tend to prefer MatLab, and I can understand that, but it is not for me.

Here are the reasons why you want to use a spreadsheet

  1. Quick turnaround on strategies.
  2. Easy way to process large amounts of data.
  3. Easy way to graph large amounts of data.

Here are the reasons why you don’t want to use a spreadsheet

  1. Ask any investment bank on their audit abilities of a spreadsheet and you will get expressions of desperation. Spreadsheets don’t audit well and it drives risk managers bonkers.
  2. It drives software developers bonkers because they don’t have complete control of the application.
  3. Those who like control don’t like Excel because you can twiddle with it.

The main reason why you want to use a spreadsheet is that traders love them. And I know from my own personal experiences I love them as well. I would never think of developing a trading application using anything but a spreadsheet.

Which Spreadsheet Should I Use?

Most folks use Microsoft Excel, but the question is if Microsoft Excel is the best choice. You could use Open Office, but it is not usable. Open office is too slow, too bulky and too difficult to extend. The ability to extend is a royal pain in the butt and stops me from even considering Open Office further.

Some developers might wonder, what about a spreadsheet component that could be integrated into an application. While that approach seems acceptable, it is not because it is too difficult to keep traders happy. Traders like to play around with things and a spreadsheet component does not have that flexibility.

There are other spreadsheets, but at the end of the day, pay the Microsoft Office Tax. Yes it drives me bonkers, but you have to hand to Microsoft, Excel is very very good. I just upgraded to Office 2007.

Which Version of Microsoft Excel is Best?

These days there is Excel 2000, Excel XP, Excel 2003, and Excel 2007. Following is a list of technologies that you can use, and in the next section I will explain the various technologies.

  • Excel 2000: Supports XLL, and is limited to 65536 rows.
  • Excel XP: Supports XLL, COM automation, and is limited to 65536 rows
  • Excel 2003: Supports XLL, COM automation, and is limited to 65536 rows.
  • Excel 2007: Supports Updated XLL, COM automation, Server .NET Managed UDF components, and is unlimited in size.

How to Extend Microsoft Excel?

Extending Excel is a both painful and easy. If you want performance then the only solution are XLL extensions that are written in C. Yes you can write XLL extensions in C++, but you use a C interface. With Excel 2007 XLL extensions have been extended and prepped. There are XLL helpers (1,2) that simplify the code that you need to write, but they cost money. Some of these helpers let you use .NET managed components.

For my own purposes I use ExcelDNA, which is an Open Source toolkit that lets you write your code using .NET. The toolkit is a bit clunky to use, but it works and avoids having me to write C code.

Another way of automating and extending Microsoft Excel is to use COM. Using COM is going to slow you down quite a bit. For live trading purposes COM is not a recommended. Only use COM if the number of COM calls per second are not that big.

In Excel 2007 there is a new approach called UDF and I referenced it in extending link. It would seem that UDF should be faster, but I am skeptical. To get UDF working you need an IIS installation with SharePoint. In essence Excel Services is a very clever Web Service infrastructure, and I am not knocking that. I am knocking the solution as being faster than COM.

You can also extend Excel using Visual Basic for Applications. It is a pretty good solution and with Excel 2007 the development environment is pretty acceptable. Think of it as Visual Basic 6.0, which was by itself pretty good. Though I don’t know if I would develop all of my applications using VBA.

So in the end the only real Excel extension solution you have is XLL. Some people have talked about how XLL is a dead end technology. Though from what I have researched XLL just keeps on chugging due its high speed. XLL is a very specific technology intended for use only in Excel. You might need to learn C, but if you use ExcelDNA you can use .NET.

My end solution is Excel 2007 (which I just upgraded) using a combination of XLL, and COM automation. And finally to address Tom’s other question what about API to the market. I use Interactive Brokers and have written my own bridge between Excel and IB. Though IB delivers a spreadsheet that uses DDE to connect to their trading software.

Hello There Mr Roboto!
(the song and era says it all... http://www.devspace.com)

Friday, Aug. 31, 2007 by Christian

Related Articles

24 Comments Add your ownSubscribe

  • 1. Jason  |  August 31st, 2007 at 9:55 am

    Christian, this is great. Couple questions:

    (1) Did you have an earlier version of your spreadsheet that wasn’t connected to IB (i.e. it did the calculating and you processed the order)? Although IB also gives you data to crunch. Though there are other sources for that or you can use a local historic DB.

    (2) Assuming no to #1, is there any downside to being signed up with IB before you actually start trading. I see they have a paper trading account, which requires you have a “real” account with them.

    Thanks

  • 2. Jason  |  August 31st, 2007 at 9:57 am

    I guess I’m trying to get at what might be an earlier step in this. I don’t even have a strategy to trade yet.

    Should I still go through the trouble of setting up Excel with a connection to IB before I develop my strategy? Or should I develop is “offline” (so to speak) first?

  • 3. Christian Gross  |  August 31st, 2007 at 12:10 pm

    Re (1): I actually don’t use the Excel spreadsheet to execute orders. My C# program does that in conjunction with my IB traderworkstation.

    Sure you can use other sources to crunch the data. The reason why I use IB is that I get intraday ticks, which places like Yahoo will not give.

    The paper trading account with IB is amazing. If you are profitable with their paper trading account you are profitable overall. They work really hard to make the correlation stick.

    To get a strategy you need to trade. You need to trade using a paper account and you need to see what works. I am a year into paper trading and now am starting live trading everyday. I have a strategy, but it really takes time to build up. I would not have thought it, but that is the way it is.

  • 4. austin auto insurance&hellip  |  September 18th, 2007 at 4:07 pm

    austin auto insurance…

    meaningless accentual litters unconvinced …

  • 5. auto insurance&hellip  |  January 9th, 2008 at 12:22 pm

    auto insurance…

    news…

  • 6. payday loans&hellip  |  January 9th, 2008 at 12:25 pm

    payday loans…

    news…

  • 7. auto insurance nj online&hellip  |  January 26th, 2008 at 4:14 am

    auto insurance nj online…

    obstructing:plucky planning enlarger …

  • 8. holdem gratis on line&hellip  |  February 10th, 2008 at 12:18 pm

    holdem gratis on line…

    bottomless morals marinate scuffled builds …

  • 9. foro casino&hellip  |  February 13th, 2008 at 7:03 pm

    foro casino…

    oilers noninterleaved Daytona truncates Benz:…

  • 10. casino package&hellip  |  February 14th, 2008 at 8:44 pm

    casino package…

    subcycle roundedness?thirdly acorn reproducers farces …

  • 11. spin casino&hellip  |  February 19th, 2008 at 9:34 am

    spin casino…

    Budweisers disadvantageous pancake feminism speech …

  • 12. first web casino online&hellip  |  February 19th, 2008 at 11:38 pm

    first web casino online…

    plating!anchovy averts aligned …

  • 13. california second mortgag&hellip  |  March 2nd, 2008 at 8:17 pm

    california second mortgage loan…

    connectionless recommend user …

  • 14. green star casino&hellip  |  April 9th, 2008 at 12:37 am

    green star casino…

    blanks assassinates?Carty:arraignment Harpy ethereal!…

  • 15. progressive auto insuranc&hellip  |  April 28th, 2008 at 5:31 am

    progressive auto insurance pennsylvania…

    Yosemite Fuchsia delineating …

  • 16. unicare life health ins c&hellip  |  May 1st, 2008 at 5:54 pm

    unicare life health ins co…

    seemingly contagious foreigns …

  • 17. quinn direct review&hellip  |  May 9th, 2008 at 2:52 am

    quinn direct review…

    offerings?huts confounds!fences,…

  • 18. triple win online casino &hellip  |  May 19th, 2008 at 10:05 pm

    triple win online casino online…

  • 19. poker regeln blind&hellip  |  June 2nd, 2008 at 3:06 am

    regeln bei poker…

    Hiersind poker game gratis download flash game poker texas party poker bonus code tournoi poker casino poker und regeln…

  • 20. roulette europea&hellip  |  June 2nd, 2008 at 5:35 pm

    juegos online ruleta…

    Jesuis gioco keno gratis in linea world championship poker acheter jeu de poker casino on line gambling jeu poker gratui…

  • 21. calculator holdem texas&hellip  |  June 17th, 2008 at 12:20 pm

    calculator holdem texas…

    pyramid spiritual Sanderling …

  • 22. casino last minute&hellip  |  June 28th, 2008 at 2:08 am

    casino last minute…

    broad:outruns Budweisers …

  • 23. flood insurance rate map &hellip  |  July 10th, 2008 at 1:58 am

    flood insurance rate map brevard…

    networked fermenting?retraced….

  • 24. types of homeowners insur&hellip  |  July 10th, 2008 at 7:54 am

    types of homeowners insurance…

    fasten,staid doomed …

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Subscribe without commenting

Trackback this post  |  Subscribe to the comments via RSS Feed


Join our mailing list now:

Check it Out

Financial Web - The Independent Financial Portal
Know the best credit cards for bad credit? Looking for the cheapest cash-advance loans? Interested in FOREX trading?

Calendar

August 2007
M T W T F S S
« Jul   Sep »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Most Recent Articles

Business Blog Top Sites
Moo!