I'm encountering an issue with my Python script utilizing the Interactive Brokers API. The script is aimed at retrieving market data, but I'm encountering several errors. Here's a summary of the problem and the code snippet:
Error Summary:
ERROR -1 2104 Market data farm connection is OK:usfarm.nj
ERROR -1 2104 Market data farm connection is OK:cafarm
ERROR -1 2104 Market data farm connection is OK:cashfarm
ERROR -1 2104 Market data farm connection is OK:usfarm
ERROR -1 2106 HMDS data farm connection is OK:ushmds
ERROR -1 2158 Sec-def data farm connection is OK:secdefil
ERROR 1 10285 Your API version does not support fractional size rules. Please upgrade to a minimum version 163.
Additional Information: I attempted to update the Interactive Brokers API using the following command:
pip install --upgrade ibapi
However, this update did not resolve the issue. Code Snippet:
from ibapi.client import EClient
from ibapi.wrapper import EWrapper
from ibapi.contract import Contract
import threading
import time
class IBapi(EWrapper, EClient):
def __init__(self):
EClient.__init__(self, self)
def tickPrice(self, reqId, tickType, price, attrib):
if tickType == 2 and reqId == 1:
print('The current ask price is: ', price)
def run_loop():
app.run()
app = IBapi()
app.connect('127.0.0.1', 7497, 123)
# Start the socket in a thread
api_thread = threading.Thread(target=run_loop, daemon=True)
api_thread.start()
time.sleep(1) # Sleep interval to allow time for connection to server
# Create contract object
eurusd_contract = Contract()
eurusd_contract.symbol = 'EUR'
eurusd_contract.secType = 'CASH'
eurusd_contract.exchange = 'IDEALPRO'
eurusd_contract.currency = 'USD'
# Request Market Data
app.reqMktData(1, eurusd_contract, '', False, False, [])
time.sleep(10) # Sleep interval to allow time for incoming price data
app.disconnect()
I'd appreciate any insights on why I'm encountering these errors and how to resolve them.