Learn to program with me...

Discussion in 'Automated Trading' started by C99, Mar 23, 2007.

  1. That's actually quite an ignorant and offensive remark.

    If you are a novice, then I suggest that this is a good book to get started with:

    http://www.amazon.com/Modeling-Fina...2624867?ie=UTF8&s=books&qid=1174650609&sr=8-1

    It walks through some basic modelling apps in VB.NET but more importantly, covers some of the fundamental aspects of programming that you should know regardless of which language you choose. If you are already familiar with C#.NET you should be able to follow along with the examples without problems.

    It does briefly cover connecting to data feed APIs etc. but what is covered won't be that relevant to you connecting to IB etc.

    IB doesn't yet have a native .NET API as far as I know so you'll have to deal with interop with ActiveX. The afore mentioned book does provide some information on this topic that may be useful for a beginner.
     
    #11     Mar 23, 2007
  2. bidask

    bidask

    what do you mean?

     
    #12     Mar 23, 2007
  3. C99

    C99

    Sorry, didn't mean that as offensive but I can see how it reads that way. I was thinking that the largest percentage of reference materials, books, videos, and other learning resources are all in English and the language barrier must be a formidable step to overcome before even starting to program.

    I did get the book you linked to as well as a few other entry level books. Problem is I'm so new to this that most of it is still over my head. I think once I clear a few initial hurdles I'll be able to put the info in that book to better use.

    I read somewhere that the latest release of the java api will compile in J# and can then be used as a native .net api, but the advantages of this over activeX are unknown to me right now. Redi is an activeX api as well, so I figure if I go that route with IB then at least some of that knowledge will be transferable.

    Glad to see that there are some interested people. Back in a little while with screenshots of my basic forms.
     
    #13     Mar 23, 2007
  4. C99

    C99

    I have in the past but am looking for much more flexibility. The four programs I currently run are IB, Rediplus, Esignal, and Neoticker. Neoticker is great, but my goal here is to learn to interact directly with my trading platforms.
     
    #14     Mar 23, 2007
  5. #15     Mar 23, 2007
  6. C99

    C99

    Excellent!!! I remembered running across this a few months ago and searched last weekend for about an hour looking for it with no success. This is exactly the bite sized piecies I was talking about. I will try to recreate this in C#.NET and see how far I get. Thanks.
     
    #16     Mar 23, 2007
  7. C99

    C99

    Here's my form for getting connected to IB and getting some ES quotes. This is all drag and drop to design it. Menu has connect, disconnect, and exit options. The form doesn't do anything yet but I'm working on that.

    <img src ="http://elitetrader.com/vb/attachment.php?s=&postid=1409250">
     
    #17     Mar 23, 2007
  8. C99

    C99

    Now I've tried to hook this form up based on ETLURKER's animated gif tutorial in the previous link but am having no luck so far.

    My first question- in the solution folder under references I have three various references to TWS. I first added a reference which showed up as TWSlib. I then right clicked in the tollbox and selected choos items. This added the TWS control to the toolbox which I then dragged onto the form. Somewhere along the way a reference to Interop.TWSLib also showed up in the references section of solution exporer. I think I may have only needed to add the control to the tollbox and drag it to the form, without adding any other references. Can anyone confirm this?

    When I was setting up the form, I decided to go two steps further than the .gif in the link. I decided to add a few more data fields and some text boxes to let the user change the symbol.

    Before making any of those additions functional, I wanted to stick to the tutorial and get a connection and only the last price for the ES. So in my form1.cs file, I have the following code:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace IBTest
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

    private void connectIBToolStripMenuItem_Click(object sender, EventArgs e)
    {
    axTws1.connect("localhost", 7496, 0);
    }

    private void button1_Click(object sender, EventArgs e)
    {
    double strike = new double();
    axTws1.reqMktData(1, "ES", "FUT", "200706", strike, "", "", "GLOBEX", "", "USD", "");
    }

    private void axTws1_tickPrice(object sender, AxTWSLib._DTwsEvents_tickPriceEvent e)
    {
    if ((e.id == 1) && (e.tickType ==1))
    {
    label8.Text = (string)e.price;
    }



    }
    But I get the following error when I try to build it:

    cannot convert type 'double' to 'string'

    This is in reference to that last line of code,
    label8.Text = (string)e.price
    I added that (string) to try and cast it, but that won't work. I get the same error either way. Anyone have any suggestions?

    And also do I need a using statement for the TWS control?

    Thanks.
     
    #18     Mar 23, 2007
  9. C99

    C99

    It's alive!!!

    I changed the last section of code to the following:

    private void axTws1_tickPrice(object sender, AxTWSLib._DTwsEvents_tickPriceEvent e)
    {
    double last = new double();
    if ((e.id == 1) && (e.tickType ==4))
    {
    last = e.price;
    label8.Text = Convert.ToString(last);

    }


    Don't know if this is the correct way to do this, but it builds, connects to TWS and gets the last price. Market is closed right now so I can't see it updating but I'm hopeful it will.

    So this was a productive day for me. Now i want to do the same with redi, but I have a feeling that will not be as easy.

    <img src ="http://www.elitetrader.com/vb/attachment.php?s=&postid=1409394>
     
    #19     Mar 23, 2007
  10. ellevers

    ellevers

    I look forward to your try at redi's api. I use redi and have their code. I have no problem using the dde link for excel, but for window forms projects I just can't figure out their code.
     
    #20     Mar 23, 2007