i need help to get data history from time and sale tws api. i try get by this code, But I did not understand what is Ticks BY Ticks and more where am i wrong in the code, and how should it show to get the information I want? I would be happy Exmaple to help Thank you https://interactivebrokers.github.io/tws-api/historical_time_and_sales.html
from ibapi.client import EClient
from ibapi.wrapper import EWrapper
from ibapi.contract import Contract
from ibapi.ticktype import TickTypeEnum
class TestApp(EWrapper,EClient):
def __init__(self):
EClient.__init__(self, self)
def error(self, reqId, errorCode, errorString):
print("ERRRR",reqId, " ",errorCode," ",errorString)
def historicalTicks(self, reqId: int, ticks: ListOfHistoricalTick, done: bool):
print("HistoricalTick. ReqId:", reqId, ticks)
def main():
app = TestApp()
app.disconnect()
app.connect("127.0.0.1", 7496, 0)
contract = Contract()
contract.symbol = "AAPL"
contract.secType = "STK"
contract.exchange = "SMART"
contract.currency = "USD"
contract.primaryExchange = "NASDAQ"
app.reqHistoricalTicks(18001, eurusd_contract,"20170712 21:39:33", "", 10, "TRADES", 1, True, [])
app.run()
if __name__ == "__main__":
main()