So Iâve been wanting to learn how to program for a while now. I have zero experience and am having a tough time getting started. I can find beginner resources, and I can find trading resources, but not many beginner resources specifically related to trading. I also get confused because there seems to be multiple ways to go about doing many things and I have no idea which is the right course to take.
Iâd like to document the path here as I go from complete and utter newb to actually programming something useful to my trading. I invite anyone who wishes to participate to join in. Iâll be using C#.NET/ SQL and I trade through IB for futures and RediPlus for stocks. Feel free to use the language and trading platform of your choice. I hope to break down the steps required to get started into little bite-size pieces and post working examples and / or code snippits. Please save any arguments about this language is better that that. If you feel this way, then play along and post the examples in the language of your choice. The more languages and platforms represented, the better this reference will be for those that follow.
Setup: I picked up an academically priced version of MS Visual Studio Pro 2005 for $140 on ebay. This includes SQL server 2005. I have installed the IB API and enabled TWS to accept DDE, ActiveX and socket connections. RediPlus also uses an ActiveX API although it is not nearly as well documented as IBâs API.
If you want to play along, youâll need an IDE. Microsoft offers express versions of Visual Studio and SQL for free. They include everything I think youâll need. I know there are also free Java and other language IDEâs.
Microsoft Visual Studio Express can be found here:
http://msdn.microsoft.com/vstudio/express/
I had downloaded the C# Express edition before I purchased VS2005 and on the start page is a great, free video series that walks you through some of the basics called the RSS Reader project. It has nothing to do with trading, but it is a good start for learning about Visual Studio and connecting to a SQL express database. Itâs about 8 hours of video in total and well worth the time. More beginner videos here:
http://msdn.microsoft.com/vstudio/express/beginner/windows/tier1/
A rough outline of what Iâd like to accomplish:
-Connect to TWS and Redi.
-Get price and size quotes for one single symbol. ( these two goals alone would feel like a small victory)
-Perform some simple calculations on this price data.
-Get position and open order info.
-Store price ticks in some way (write them to SQL?)
-Use this stored data in some simple calculations
-Submit an order by clicking a button and get execution info back
-Submit an order based on some condition being met and get execution info back
-Log trades to SQL
-Track open orders and update them based on some condition (for example a trailing stop)
-Expand my single-symbol examples into examples that do the same thing for a small portfolio.
So Iâm not talking about backtesting, charting, or full fledged automated trading systems. I really just want to learn the basics of interacting with my trading platform via the API.
Part of me is completely intimidated by programming, and another part of me thinks it really can be THAT hard if there are armies of third world programmers, many of whom probably donât even speak English, pumping out volumes of code. Why not just pay them their $10 an hour to do it for me you may ask? I do. I have several small apps Iâve had developed that I run every day. But Iâm a hands-on person that likes to tinker. I want to know how they work and I want to be able to maintain them and make changes myself. Iâm willing to put in the time and hopefully I can figure this out.
So Iâm hoping there are other people like me out there that want to learn this but donât know where to start. This is it. This is where you start. And Iâm also hoping that there are some more experienced programmers out there that will nudge us in the right direction without excessively mocking our seemingly idiotic questions. My mom always told me that people help those who help themselves. So I hope that by showing some initiative a few kind souls will take us under their wing.
Iâd like to document the path here as I go from complete and utter newb to actually programming something useful to my trading. I invite anyone who wishes to participate to join in. Iâll be using C#.NET/ SQL and I trade through IB for futures and RediPlus for stocks. Feel free to use the language and trading platform of your choice. I hope to break down the steps required to get started into little bite-size pieces and post working examples and / or code snippits. Please save any arguments about this language is better that that. If you feel this way, then play along and post the examples in the language of your choice. The more languages and platforms represented, the better this reference will be for those that follow.
Setup: I picked up an academically priced version of MS Visual Studio Pro 2005 for $140 on ebay. This includes SQL server 2005. I have installed the IB API and enabled TWS to accept DDE, ActiveX and socket connections. RediPlus also uses an ActiveX API although it is not nearly as well documented as IBâs API.
If you want to play along, youâll need an IDE. Microsoft offers express versions of Visual Studio and SQL for free. They include everything I think youâll need. I know there are also free Java and other language IDEâs.
Microsoft Visual Studio Express can be found here:
http://msdn.microsoft.com/vstudio/express/
I had downloaded the C# Express edition before I purchased VS2005 and on the start page is a great, free video series that walks you through some of the basics called the RSS Reader project. It has nothing to do with trading, but it is a good start for learning about Visual Studio and connecting to a SQL express database. Itâs about 8 hours of video in total and well worth the time. More beginner videos here:
http://msdn.microsoft.com/vstudio/express/beginner/windows/tier1/
A rough outline of what Iâd like to accomplish:
-Connect to TWS and Redi.
-Get price and size quotes for one single symbol. ( these two goals alone would feel like a small victory)
-Perform some simple calculations on this price data.
-Get position and open order info.
-Store price ticks in some way (write them to SQL?)
-Use this stored data in some simple calculations
-Submit an order by clicking a button and get execution info back
-Submit an order based on some condition being met and get execution info back
-Log trades to SQL
-Track open orders and update them based on some condition (for example a trailing stop)
-Expand my single-symbol examples into examples that do the same thing for a small portfolio.
So Iâm not talking about backtesting, charting, or full fledged automated trading systems. I really just want to learn the basics of interacting with my trading platform via the API.
Part of me is completely intimidated by programming, and another part of me thinks it really can be THAT hard if there are armies of third world programmers, many of whom probably donât even speak English, pumping out volumes of code. Why not just pay them their $10 an hour to do it for me you may ask? I do. I have several small apps Iâve had developed that I run every day. But Iâm a hands-on person that likes to tinker. I want to know how they work and I want to be able to maintain them and make changes myself. Iâm willing to put in the time and hopefully I can figure this out.
So Iâm hoping there are other people like me out there that want to learn this but donât know where to start. This is it. This is where you start. And Iâm also hoping that there are some more experienced programmers out there that will nudge us in the right direction without excessively mocking our seemingly idiotic questions. My mom always told me that people help those who help themselves. So I hope that by showing some initiative a few kind souls will take us under their wing.
)so eventually I'd like to figure out the mechanics of capturing and recording OHLC 1 min data. Should be more manageable than every tick.