hadrianl / ibapi

Interactive Brokers API - GoLang Implement
MIT License
130 stars 59 forks source link

Your API version does not support fractional size rules. Please upgrade to a minimum version 163 #43

Open alekna opened 1 year ago

alekna commented 1 year ago

Code:

func marketData(c *cli.Context) error {
    var err error
    ibwrapper := &Wrapper{}
    ctx, _ := context.WithTimeout(context.Background(), time.Second*30)
    ic := NewIbClient(ibwrapper)
    ic.SetContext(ctx)
    err = ic.Connect(c.String("api_host"), c.Int("api_port"), 0)
    if err != nil {
        log.Panic("Connect failed:", err)
    }
    if err := ic.HandShake(); err != nil {
        log.Panic("HandShake failed:", err)
    }

    ic.ReqCurrentTime()

    contract := Contract{Symbol: "EUR", SecurityType: "CASH", Currency: "USD", Exchange: "IDEALPRO"}
    ic.ReqTickByTickData(1, &contract, "BidAsk", 0, true)

    ic.Run()
    err = ic.LoopUntilDone()
    return nil
}

Log:

"level":"info","ts":1689142639.5435812,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/client.go:107","msg":"Connect to client","host":"192.168.16.4","port":7497,"clientID":0}
{"level":"info","ts":1689142639.5439203,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/client.go:177","msg":"HandShake with TWS or GateWay"}
{"level":"info","ts":1689142639.5537026,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/client.go:223","msg":"handShake info","serverVersion":161}
{"level":"info","ts":1689142639.553725,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/client.go:224","msg":"handShake info","connectionTime":"20230712 09:17:19 EET"}
{"level":"info","ts":1689142639.5560975,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/wrapper.go:125","msg":"<ManagedAccounts>","accountList":["U........"]}
{"level":"info","ts":1689142639.5985842,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/wrapper.go:121","msg":"<NextValidID>","reqID":1}
{"level":"info","ts":1689142639.5986145,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/wrapper.go:112","msg":"<ConnectAck>..."}
{"level":"info","ts":1689142639.5986314,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/client.go:272","msg":"HandShake completed"}
{"level":"info","ts":1689142639.5986576,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/client.go:3046","msg":"run client"}
{"level":"info","ts":1689142639.5987244,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/wrapper.go:658","msg":"<Error>","reqID":-1,"errCode":2104,"errString":"Market data farm connection is OK:usfuture"}
{"level":"info","ts":1689142639.5987353,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/wrapper.go:658","msg":"<Error>","reqID":-1,"errCode":2104,"errString":"Market data farm connection is OK:eufarm"}
{"level":"info","ts":1689142639.5987415,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/wrapper.go:658","msg":"<Error>","reqID":-1,"errCode":2104,"errString":"Market data farm connection is OK:cashfarm"}
{"level":"info","ts":1689142639.5987535,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/wrapper.go:658","msg":"<Error>","reqID":-1,"errCode":2104,"errString":"Market data farm connection is OK:usfarm"}
{"level":"info","ts":1689142639.5987659,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/wrapper.go:658","msg":"<Error>","reqID":-1,"errCode":2106,"errString":"HMDS data farm connection is OK:euhmds"}
{"level":"info","ts":1689142639.5987751,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/wrapper.go:658","msg":"<Error>","reqID":-1,"errCode":2106,"errString":"HMDS data farm connection is OK:ushmds"}
{"level":"info","ts":1689142639.5987809,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/wrapper.go:658","msg":"<Error>","reqID":-1,"errCode":2158,"errString":"Sec-def data farm connection is OK:secdefeu"}
{"level":"info","ts":1689142639.600078,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/wrapper.go:652","msg":"<CurrentTime>","time":1689142639}
{"level":"info","ts":1689142639.6430283,"caller":"ibapi@v0.0.0-20230320023235-f1841ded5152/wrapper.go:658","msg":"<Error>","reqID":1,"errCode":10285,"errString":"Your API version does not support fractional size rules. Please upgrade to a minimum version 163."}
t00ts commented 1 year ago

Exact same issue here.

TWS error code 10285 is still not documented in API Reference at the time of this writing.

As far as I can tell, this has to do with MAX_CLIENT_VER, which is sent to TWS/GW during the handshake process.

If that value is temporarily set to 163 the error is gone, so looks like the library is behind. Need to dig deeper into it, but it should be fixable from the client side.

hadrianl commented 10 months ago

I would try to catch up with the latest upgrade of IB API