Esempio n. 1
0
 def __init__(self):
     EWrapper.__init__(self)
     EClient.__init__(self, wrapper=self)
Esempio n. 2
0
 def __init__(self):
     EClient.__init__(self, self)
     self.lastStamp = datetime.datetime.utcnow()
Esempio n. 3
0
 def __init__(self, wrapper):
     ## Set up with a wrapper inside
     EClient.__init__(self, wrapper)
Esempio n. 4
0
 def __init__(self):
     EClient.__init__(self, self)
     self.df = pd.DataFrame(columns=['Time', 'Open', 'Close'])
Esempio n. 5
0
    def __init__(self, wrapper):
        ## Set up with a wrapper inside
        EClient.__init__(self, wrapper)

        self._market_data_q_dict = {}
Esempio n. 6
0
 def __init__(self, wrapper):
     EClient.__init__(self, wrapper)
Esempio n. 7
0
 def __init__(self):
     EClient.__init__(self, self)
     self.nextorderId = 1
Esempio n. 8
0
 def __init__(self, callback:Callable[[str, Dict], Any]  ):
     wrapper.EWrapper.__init__(self)
     EClient.__init__(self, wrapper=self)
     
     self.sendMessage = callback
     self.EVENT_IS_CONNECTED = threading.Event()                  # Events for main thread    
Esempio n. 9
0
 def __init__(self, wrapper, reqIDoffset, log=logtoscreen("ibClient")):
     ## Set up with a wrapper inside
     EClient.__init__(self, wrapper)
     self.ib_init_request_id_factory(reqIDoffset)
     self.log = log
     self.last_historic_price_calltime = datetime.datetime.now()
 def __init__(self):
     EClient.__init__(self, self)
     self.data = []
     log('Real time data connection is being established with IB', LOG_PATH)
 def options(self,expiry,strike,right,database="Quotes",table=None):
     table = self.symbol if table == None else table
     global app
     app = EClient(Wrapper(self.qdate,self.symbol,self.currency,database,table,expiry,strike,right,self.window))
     app.connect(host="127.0.0.1",port=4001,clientId=123)
     app.run()
 def equities(self,database="Quotes",table="Spot"):
     global app
     app = EClient(Wrapper(self.qdate,self.symbol,self.currency,database,table,window=self.window))
     app.connect(host="127.0.0.1",port=4001,clientId=123)
     app.run()        
Esempio n. 13
0
 def __init__(self, wrapper):
     EClient.__init__(self, wrapper)
     self._account_cache = simpleCache(max_staleness_seconds=5 * 60)
     self._account_cache.update_data = self._update_accounting_data
     self._market_data_q_dict = {}
     self._commissions = list_of_execInformation()
Esempio n. 14
0
    def __init__(self):
        EClient.__init__(self, self)

        self.positions = {}
        self.currentDataReqId = 0
        self.dataReqIds = {}
Esempio n. 15
0
 def __init__(self, ticker, conid):
     self.ticker = ticker
     self.conid = conid
     self.list = []
     EClient.__init__(self, self)
Esempio n. 16
0
    def __init__(self, wrapper):
        ## Set up with a wrapper inside
        EClient.__init__(self, wrapper)

        self._market_data_q_dict = {}
        self._commissions=list_of_execInformation()
Esempio n. 17
0
File: ib.py Progetto: bpourriahi/aat
 def __init__(self, order_event_queue, market_data_queue):
     EClient.__init__(self, self)
     self.nextOrderId = None
     self._order_event_queue = order_event_queue
     self._market_data_queue = market_data_queue
 def __init__(self):
     EClient.__init__(self, self)
     EWrapper.__init__(self)
Esempio n. 19
0
 def __init__(self):
     EClient.__init__(self,self) 
     self.data={}    
 def __init__(self,TestWrapper):
     EClient.__init__(self,TestWrapper)
Esempio n. 21
0
 def __init__(self):
     EClient.__init__(self, self)
     self.nextValidOrderId = None
     self.permId2ord = {}
     self.df = pd.DataFrame( columns=['Date', 'Open', 'High', 'Low', 'Close', 'Volume'])
     self.s = pd.Series()
Esempio n. 22
0
 def __init__(self):
     EClient.__init__(self, self)
     self.data = []  #Initialize variable to store candle
Esempio n. 23
0
	def __init__(self):
		EClient.__init__(self, self)
		self.contract_details = {} #Contract details will be stored here using reqId as a dictionary key
Esempio n. 24
0
 def __init__(self):
     EClient.__init__(self, self)
     self.posns = []
Esempio n. 25
0
    def historicalDataEnd(self, reqId: int, start: str, end: str):
        #8 data is finished
        print("HistoricalDataEnd. ReqId:", reqId, "from", start, "to", end)
        #9 this is the logical end of your program
        app.disconnect()
        print("finished")

    def error(self, reqId, errorCode, errorString):
        # these messages can come anytime.
        print("Error. Id: ", reqId, " Code: ", errorCode, " Msg: ",
              errorString)

    def start(self):
        queryTime = (datetime.datetime.today() -
                     datetime.timedelta(days=180)).strftime("%Y%m%d %H:%M:%S")

        fx = Contract()
        fx.secType = "CASH"
        fx.symbol = "USD"
        fx.currency = "JPY"
        fx.exchange = "IDEALPRO"

        #6 request data, using fx since I don't have Japanese data
        app.reqHistoricalData(4102, fx, queryTime, "1 M", "1 day", "MIDPOINT",
                              1, 1, False, [])


app = EClient(MyWrapper())  #1 create wrapper subclass and pass it to EClient
app.connect("127.0.0.1", 7497, clientId=123)  #2 connect to TWS/IBG
app.run()  #3 start message thread
Esempio n. 26
0
 def __init__(self):
     EClient.__init__(self, self)
     self.barsList = []
Esempio n. 27
0
    def __init__(self, tickers, port, cliente, currentDir):
        EWrapper.__init__(self)
        EClient.__init__(self, wrapper=self)

        ipaddress = "127.0.0.1"
        portid = port  # Gateway: 4002, TWS: 7497
        clientid = cliente

        ###################################################################

        self.precios = []
        self.hora = []
        self.nextValidOrderId = None

        self.Id_File = currentDir + "/" + "NuevoId_file"

        for i in range(5000):
            self.precios.append([None, None, None])
            self.hora.append(None)

        self.commission = None
        self.fill_price = None
        self.remaining = None
        self.errorCode = None
        self.marketDataType = None
        self.open_position = [None, None]
        self.tickers = tickers

        ###################################################################

        self.connect(ipaddress, portid, clientid)
        if self.errorCode == 502:  # el socket no puede ser abierto
            print("########################################")
            print("  Yoe, This Socket cannot be opened or ")
            print("       IB Wateway is closed")
            print("########################################")
            exit()
        thread = Thread(target=self.run)
        thread.start()

        setattr(self, "_thread", thread)

        ###################################################################
        #self.reqIds(-1)
        tiempo = datetime.now(
        )  # esperando confirmacion de la conexion con IB Gateway
        conti = None
        while conti is None:
            if datetime.now() > tiempo + timedelta(seconds=5):
                print(
                    "####################################################################"
                )
                print(
                    "Yoe, 5 seconds passed waiting to stablish connection with IB wateway"
                )
                print("     Let's wait 5s more ...")
                print(
                    "####################################################################"
                )
                tiempo = tiempo + timedelta(seconds=5)
            conti = self.nextValidOrderId
#        print("AQUI connect", self.nextValidOrderId)

        print("########################################")
        print("  Yoe, connection with IB Gateway is ok,")
        print("       nextValidOrderId: %s" % self.nextValidOrderId)
        print("########################################")
Esempio n. 28
0
	def __init__(self):
		EClient.__init__(self, self)
Esempio n. 29
0
 def __init__(self):
     EClient.__init__(self, self)
     self.nextValidOrderId = None
     self.permId2ord = {}
Esempio n. 30
0
 def __init__(self):
     EClient.__init__(self,self) #Esto inicia conexion con los servidores de TWS IB
 def __init__(self, wrapper):
     ## Set up with a wrapper inside
     EClient.__init__(self, wrapper)