Queue gets filled by the listener thread and the data can be pulled in the while loop.
Let me know if any confusion.
Be sure to disconnect before clearing the variables, as the listener thread will still be running.
#%%
from ibapi.client import EClient
from ibapi.wrapper import EWrapper
from ibapi.contract import Contract
from threading import Thread
from ibapi.common import BarData
from queue import Queue
import pandas as pd
import matplotlib.pyplot as plt
class MyIB(EWrapper, EClient):
def...
I think Matlab has prebuilt library for IB. If you have access to matlab then it’s better than python hands down. Most people use python because it’s free.
What’s the idea of cancelling and placing such small increment orders within a minute? Is your algo benefiting from that small change in the fill price within that minute? Just curious
Not sure, but seems main logic would be the maintenance of the “book” for each instrument. That is the bid and the offers. Now we then match bid offers that match
Just download anaconda, install and launch spyder. You will have everything you need pre packaged. Will also come in handy when you want to finally automate.
I have written an historical data downloader for myself in python for IB. It is designed with pacing violations in mind and uses IB API. (keystrokes are for 1980s)
It has an UI also. (I don’t like to read my own code:D:D:D).