Error Field #541 on IB (calling options/futures)

Discussion in 'Automated Trading' started by ogarbitrage, Apr 5, 2011.

  1. Having trouble recording data on options and futures through IB's api.

    This is what I enter in my attempt to open a connection to the April 11 130 Call on SPY for time and sales data recording.

    CONID: 82167858
    Underlying: SPY
    Type: STK
    Expiry: 11-Apr
    Exchange: SMART
    Primary Exchange: NONE
    Currency: USD
    Multiplier: 100
    Last Trade Date: APR 15 '11
    Strike: 130
    Right: CALL
    Local Symbol: 110416C00130000

    So I have two unique numbers for this contract: CONID and Local Symbol. Everything is correct to the best of my knowledge.

    And still, I get this: "Error: SPY.SMART..USD Error Code: 200 Error Message: Invalid value in field # 541"

    There is no record or explanation as to what Field #541 designates. I have googled. I have searched the IB forum. I have done guess and check. Does anyone know how to approach this issue?
     
  2. aripplet

    aripplet

    Type: STK

    should be OPT
     
  3. Thanks, fixed that. Fixed the major issue too.

    Error 541 is for MaturityDate (or Last Trade Date), format must be YYYYMMDD for anyone who runs into the same problem. Not to get the two confused, expiration date must be in the format MMYYYY.
     
  4. aripplet

    aripplet

    pretty sure that expiration date could be YYYYMMDD
     
  5. I can't say for certain but you're probably right. Depends on the contract being referenced. I read in the IB manual that the format is used to distinguish weekly, monthly, and quarterly options.
     
  6. aripplet

    aripplet

    Yes, for futures, it's not that regulated, see?


    ESM1 = makeFutContract('ES', 'GLOBEX', '20110617')

    NQM1 = makeFutContract('NQ', 'GLOBEX', '20110617')

    YMM1 = makeFutContract('YM', 'ECBOT', '201106')
     
  7. I see, appreciate it very much.
     
  8. Yalexey

    Yalexey


    ogarbitrage Thanks a lot, I've met the same problem with IB TWS and MultiCharts Version 7.0 Release (Build 4510). I've put the right expiration dates in Symbol Mapping mapping manually.
     
  9. samovar

    samovar

    I also saw this error when requesting historical ticks for VIX FUT with the expiry set to '2020401'.

    I was missing a '0' in front of '4'.

    These cryptic errors suck. How hard would it be for the IB programmers to output something useful, like "Invalid expiration date"?!