Dinosaur Technology and Trading » Interactive Brokers C# Client

Contract structure elements for cash Forex

(4 posts)

  1. Mark
    Member

    Hi, Karl, and thanks once again for this great C# client.

    Can anyone tell me the correct inputs to the Contract structure for cash Forex? Here's what I'm using so far, but I'm not getting any symbols. No problem with futures or options.

    Contract.Symbol = Curr1;
    Contract.SecurityType = Krs.Ats.IBNet.SecurityType.Cash;
    Contract.Expiry = "";
    Contract.Strike = 0;
    Contract.Right = Krs.Ats.IBNet.RightType.Undefined;
    Contract.Multiplier = "";
    Contract.Exchange = "IDEALPRO";
    Contract.PrimaryExch = "";
    Contract.Currency = Curr2; //localSymbol or maybe "USD"
    Contract.LocalSymbol = localSymbol;

    Using localSymbol for either or both of Contract.Symbol and Contract.Currency doesn't do it either.

    The symbol format used for cash Forex consists of two currencies separate by a dot (e.g., AUD.JPY).

    Thanks for any help.

    Mark

    Posted 9 months ago #
  2. Hey Mark,

    Use the forex contract class under the KRS.ATS.IBNet.Contracts namespace. you can then declore a forex contract with non other than new Forex("AUD","JPY")

    Let me know if that works for you,

    -Karl

    Posted 9 months ago #
  3. Mark
    Member

    Hey Karl,

    Thanks for the reply. I got the details worked out, and here's what works:

    Krs.Ats.IBNet.Contract Contract = new Krs.Ats.IBNet.Contract();
    Collection<Krs.Ats.IBNet.GenericTickType> GTL = new Collection<Krs.Ats.IBNet.GenericTickType>();

    Contract.Symbol = Curr1;
    Contract.SecurityType = Krs.Ats.IBNet.SecurityType.Cash;
    Contract.Expiry = "";
    Contract.Strike = 0;
    Contract.Right = Krs.Ats.IBNet.RightType.Undefined;
    Contract.Multiplier = "";
    Contract.Exchange = exchange;
    Contract.PrimaryExch = "";
    Contract.Currency = Curr2;
    Contract.LocalSymbol = "";

    client.ReqMktData(ID, Contract, GTL);

    For a pair like AUD.JPY, Curr1 = "AUD" and Curr2 = "JPY" -- the only problem I had was that I didn't pass the two parts of the symbol correctly. Now it works.

    Thanks again,

    Mark

    Posted 9 months ago #
  4. Sounds great Mark, thanks for the follow up!

    -Karl

    Posted 9 months ago #

RSS feed for this topic

Reply

You must log in to post.