Esempio n. 1
0
	def init_historicprices(self, tickerid):
		if "data_historicdata" not in dir(self):
			histdict=dict()
		else:
			histdict=self.data_historicdata

		histdict[tickerid]=autodf("date", "open", "high", "low", "close", "volume")
		setattr(self, "data_historicdata", histdict)
		setattr(self, "flag_historicdata_finished", False)
Esempio n. 2
0
    def init_historicprices(self, tickerid):
        if "data_historicdata" not in dir(self):
            histdict=dict()
        else:
            histdict=self.data_historicdata

        if histdict.get(tickerid, None) is None:
            EMPTY_HDATA=autodf("symbol", "sdate", "open", "high", "low", "close", "volume", "barcount", "wap", "hasgaps")
            histdict[tickerid]=EMPTY_HDATA
        print 'init_historicprices histdict: ', histdict
        setattr(self, "data_historicdata", histdict)
        setattr(self, "flag_historicdata_finished", False)
Esempio n. 3
0
    def init_historicprices(self, tickerid):
        if "data_historicdata" not in dir(self):
            histdict = dict()
        else:
            histdict = self.data_historicdata

        EMPTY_HDATA = autodf("price_date", "open_price", "high_price",
                             "low_price", "close_price", "volume")

        histdict[tickerid] = EMPTY_HDATA

        setattr(self, "data_historicdata", histdict)
        setattr(self, "flag_historicdata_finished", False)
Esempio n. 4
0
import time
import datetime
import numpy as np
from swigibpy import EWrapper
from swigibpy import EPosixClientSocket
from IButils import autodf

MEANINGLESS_NUMBER = 999

EMPTY_HDATA = autodf("date", "open", "high", "low", "close", "volume")

timeout = 30  # seconds


class IBWrapper(EWrapper):
    """

        Callback object passed to TWS, these functions will be called directly
    by TWS.

    """
    def init_error(self):
        setattr(self, "flag_iserror", False)
        setattr(self, "error_msg", "")

    def error(self, id, errorCode, errorString):
        """
        error handling, simple for now
       
        Here are some typical IB errors
        INFO: 2107, 2106