def __init__(self, bidPrice=60, offerPrice=None, businessDate=None, partitions=None, gwHost=None, gwPort=None, ofiHost=None, ofiPort=None): refdata = ReferenceData(dbhost=options.dbhost, dbport=options.dbport) self.refdata = refdata self.units = refdata.fetchUnitsUsers() self.products = refdata.fetchProductsInstruments(partitions=partitions, closingPositionOnly=False) self.securities = refdata.fetchSecurities() self.pmmunits = refdata.fetchPMMUnitsProducts() self.pmmusers = refdata.fetchPMMUserNameProducts() self.houseunits = refdata.fetchHouseUnitsUsers() self.mopsuser = refdata.fetchMOPSUserName() self.priceSteps = refdata.fetchPriceSteps() self.businessDate = businessDate self.cachedPrices = {} for key, value in refdata.fetchPriceStepTables().iteritems(): if offerPrice == None: self.cachedPrices[key] = Product.generateRandomUpAndDownPrices(60, 60, 100, 1, 0, 0, value, size=1) else: self.cachedPrices[key] = [(bidPrice, offerPrice)*2] self.attempted = 0 self.successful = 0 self.unsuccessful = [] self.gwHost = gwHost self.gwPort = gwPort self.ofiHost = ofiHost self.ofiPort = ofiPort self.passwords = {} if options.passwords: f = open(options.passwords, "r") for line in f.readlines(): line = line.rstrip("\r\n") loginName, password = line.split(",") self.passwords[loginName] = password f.close()
def __init__(self, bidPrice=60, offerPrice=None, businessDate=None, partitions=None, gwHost=None, gwPort=None, ofiHost=None, ofiPort=None): refdata = ReferenceData(dbhost=options.dbhost, dbport=options.dbport) self.refdata = refdata self.units = refdata.fetchUnitsUsers() self.products = refdata.fetchProductsInstruments( partitions=partitions, closingPositionOnly=False) self.securities = refdata.fetchSecurities() self.pmmunits = refdata.fetchPMMUnitsProducts() self.pmmusers = refdata.fetchPMMUserNameProducts() self.houseunits = refdata.fetchHouseUnitsUsers() self.mopsuser = refdata.fetchMOPSUserName() self.priceSteps = refdata.fetchPriceSteps() self.businessDate = businessDate self.cachedPrices = {} for key, value in refdata.fetchPriceStepTables().iteritems(): if offerPrice == None: self.cachedPrices[key] = Product.generateRandomUpAndDownPrices( 60, 60, 100, 1, 0, 0, value, size=1) else: self.cachedPrices[key] = [(bidPrice, offerPrice) * 2] self.attempted = 0 self.successful = 0 self.unsuccessful = [] self.gwHost = gwHost self.gwPort = gwPort self.ofiHost = ofiHost self.ofiPort = ofiPort self.passwords = {} if options.passwords: f = open(options.passwords, "r") for line in f.readlines(): line = line.rstrip("\r\n") loginName, password = line.split(",") self.passwords[loginName] = password f.close()