user13691262
user13691262

Reputation: 1

Need help in limiting ibkr api send to 50msg/min

How can I limit send to 50 msg/min for my requests? I am trying to get data for all SnP500 symbols but the following code keeps getting same error.

   
    def sendreq(self):
        count = 0
        
        self.reqContractDetails(1010, contract)
        count += 1

        if count > 30:
            print(send)
            print('sleeping')
            # print(contract)
            time.sleep(1)
            count = 0

Received the following error:

Error: 9 100 Max rate of messages per second has been exceeded:max=50 rec=61 (1)

Upvotes: 0

Views: 160

Answers (1)

brian
brian

Reputation: 10989

You set send=0 every call and check if it's > 30.

You are using the same reqId every time, how will you differentiate the responses?

Probably a typo in the question but it's 50/sec limit (actually a 250/5sec average)

I don't think that's how globals work in python, instead it should be declared in the class and use self.send.

Upvotes: 0

Related Questions