Discussion in 'Automated Trading' started by Kenpoker, Nov 27, 2007.

  1. Kenpoker


    I would like to know if its possible to use QuickFix/J in order to send request to IB ??

    And if it is, do you think its the best solution?

    Someone could give me more information about the IB FIX ENGINE because i dont realy understand how i could code my ATS on it. (no sample)

  2. RedRat


    I suggest you to program using TWS API. It is simplier then developing for FIX engine.

    I had an experience of programming for TWS API. Then after I experienced serious bugs while upgrading API version I decided to left IB. And I joined VelocityFutures.

    VelocityFutures supports TT FIX and I started programming for it. But it is very complex and my strategy still has bugs. The worse thing there is no paper account for TT FIX and I can not debug :(.

    I have a problems with reconnect to the server.

    You can find some simple examples inside QuickFix package, but they will not work with TT FIX. Because of every provider has some extensions and specific settings :(. I suppose that IB also has special tags for FIX.

    Note that IB FIX will cost you $500 for switching on and $100 every month.

    If you want to switch into FIX I suggest you to change brokerage. Consider VelocityFutures for example.

    Also there are a number of programs which support TT FIX, like NinjaTrader of OpenQuant, www.smartquant.com. You can use them.

  3. Kenpoker


    Basically, Ive already done an ATS for my school project using TWS API.

    And i would like to learn FIX, to program my ATS using FIX.

    So i am looking for a fix engine and a brokerage where i could try to program my ATS on it (in java) and with a demo account.

    Thats why i asked you about QuickFix/J (OpenSource Fix engine)

    But i would like to know witch brokerage i could use with QuickFix ( brokerage with a demo account)
  4. RedRat


    I do not know about brokerages with FIX demo account :(. Velocity did not give me demo although I asked them.

    You can register at
    it is free

    then you will be able to download documents regarding TT FIX and TT SIM, which is exchange simulator. You can debug your programs with TT FIX adaptor which is part of TT SIM.

    They have demo project on C#, I found there which special tags you need to use for TT FIX connection (for example password and account#).

  5. gford



    What types of reconnection issues are you having with TT FIX? Also what do you mean by a paper account?

    I work on the TT FIX Adapter.

  6. RedRat


    Below is only my understanding, I am not an expert in FIX.

    There are two types of connection, one is persistent, other is non-persistent. That is the settings of the server (AFAIK).

    With persistent connection all messages are stored on hard drive and when session is reconnected, server sends again every message. When I downloaded TT SIM it was by default. But if my application receive all executions twice, the counter of open positions will be invalid...

    The non-persistent connection does not send every message. But I have to implement UAN request, to receive open positions and open orders from the server.

    I was not able to test disconnect issuer because of I run program and server on the same PC. Then I went real account with real money (I did not have demo account from Velocity).

    One bad day I saw that my session was disconnected and there is no realtime market data coming. I was impulsive and closed my application, but it already had opened positions. I closed these positions with loss. The demo system running for IB TWS was profitable at that day, but my real running with FIX lost money :(.

    I examine log files, I marked disconnect event bold:

    begin of log file skipped
    11/20/2007 8:33:08 AM
    Logon OK, sessionId = FIX.4.2:YEVORDER->TT_ORDER
    11/20/2007 8:33:08 AM
    Logon OK, sessionId = FIX.4.2:YEVPRICE->TT_PRICE
    NewOrder 1 BUY StrategyStarter.CMySymbol strategy = 0 756.6

    11/20/2007 10:08:31 AM
    Logon OK, sessionId = FIX.4.2:YEVORDER->TT_ORDER
    11/20/2007 10:08:31 AM
    Logon OK, sessionId = FIX.4.2:YEVPRICE->TT_PRICE

    CRITICAL ERROR: onMessage(ExecutionReport) STATUS = NEW, and !nMyID

    8=FIX.4.29=33935=834=449=TT_ORDER50=NONE52=20071120-15:08:44.39456=YEVORDER57=NONE129=NONE1=34695162406=014=017=224D68221:120=031=032=037=224D6822138=139=040=244=7566048=00A0LH00ER2Z54=155=ER258=Downloaded from Gateway59=060=20071120-15:08:44.39477=O150=D151=1167=FUT198=07152jm1200=200712207=CME378=4442=110455=ER2Z710=247

    CRITICAL ERROR: onMessage(ExecutionReport) can not find order!!!

    8=FIX.4.29=34735=834=549=TT_ORDER50=NONE52=20071120-15:08:45.83156=YEVORDER57=NONE129=NONE1=34695162406=014=017=060HD3407:320=031=032=037=060HD340738=139=440=244=7517048=00A0LH00ER2Z54=155=ER258=Order not found on gateway at startup59=060=20071120-15:08:45.83177=O150=4151=0167=FUT198=071509wh200=200712207=CME442=110455=ER2Z710=023
    Continue execution...
    ORDER CANCELED: id = ER2 Order not found on gateway at startup

    CRITICAL ERROR: onMessage(ExecutionReport) can not find order!!!

    8=FIX.4.29=34735=834=649=TT_ORDER50=NONE52=20071120-15:08:45.84756=YEVORDER57=NONE129=NONE1=34695162406=014=017=060HD3858:320=031=032=037=060HD385838=139=440=244=7531048=00A0LH00ER2Z54=255=ER258=Order not found on gateway at startup59=060=20071120-15:08:45.84777=O150=4151=0167=FUT198=07150a05200=200712207=CME442=110455=ER2Z710=229
    Continue execution...
    ORDER CANCELED: id = ER2 Order not found on gateway at startup

    CRITICAL ERROR: onMessage(ExecutionReport) can not find order!!!

    8=FIX.4.29=34735=834=749=TT_ORDER50=NONE52=20071120-15:08:45.86356=YEVORDER57=NONE129=NONE1=34695162406=014=017=0A0ZXY901:320=031=032=037=0A0ZXY90138=139=440=244=7525048=00A0LH00ER2Z54=255=ER258=Order not found on gateway at startup59=060=20071120-15:08:45.86377=O150=4151=0167=FUT198=071505vu200=200712207=CME442=110455=ER2Z710=215
    Continue execution...

    Due to the lack of documentation I can not understand what is going on :(.
    I see two types of server events:

    Downloaded from Gateway
    Order not found on gateway at startup

    Why I receive ORDER CANCELED event? Is my session persistent? My UAT request does not work.

    My algorithm:
    Strategy (0, 1, 2...) produces limit order. I calculate unique ClientId and send this order to the server. Then I receive execution event with status = NEW, it contains my CliendId and server OrderId. I map OrderId -> strategy order.

    Next time my strategy needs to cancel an order, I know OrderId and I can cancel order on the server.

    If I receive FILLED event then I am getting ClientId, find the correspondence strategy order and update strategy positions.

    But after disconnect server sends me NEW event without ClientId, I can not map that order. My program logs error "CRITICAL ERROR: onMessage(ExecutionReport) STATUS = NEW, and !nMyID".

    How should I process messages from the server after disconnect? Could you please help me?

    Thank you in advance.
  7. RedRat


    I need demo FIX account to debug functionality of my application. I asked VelocityFutures 3 times. They promised to help but I did not receive an answer.

    My application works with TT SIM server. But I did not debug disconnect from the server and I had to test this with real money :(.
  8. runtrader


    I'm a professional software architect / developer. I’ve worked in the investment banking industry for many years and I’ve developed and interfaced to many electronic trading systems.

    A few years only a hand full of exchanges / brokers / banks offered FIX connectivity and only to other institutions. However in recent years FIX connectivity has been recognised as the way to go. All brokers / banks worth their salt will need to offer some sort of FIX connectivity or they would be left behind.

    QuickFIX is a good open source FIX engine and is popular. However most professional outfits use the Cameron FIX engine (from orc software)

    Indeed my automated trading system uses FIX to connect to my broker (IB). As part of FIX development most brokers / banks have a development infrastructure for you to test against whilst you develop. Indeed most require you to pass their certification tests before they let you on their live system.
  9. jearnest

    jearnest Velocity Futures


    Due to us running parallel version 6 and 7 FIX environments until all Version 7 FIX issues were resolved completely, we have had to have double the hardware for FIX...

    But now, as of the last month we are done with Version 6 and will have extra equipment to dedicate to developers for FIX, and should be able to re-deploy a "demo" only FIX adapter to connect to our current 2 Demo TT SIM servers...

    Expect this by year end.

  10. Get a copy of Aegis Client Simulator

    #10     Dec 11, 2007