Esempio n. 1
0
 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()
Esempio n. 2
0
                      default=False,
                      help="Show business dates in the database")
    parser.add_option("--passwords",
                      dest="passwords",
                      help="Passwords file for GW and OFI",
                      default=None)
    parser.add_option("--conngateway",
                      dest="conngateway",
                      action="store_true",
                      help="Use this flag when using a connection gateway",
                      default=False)

    (options, args) = parser.parse_args()

    if options.showBusinessDates:
        refdata = ReferenceData(dbhost=options.dbhost, dbport=options.dbport)
        refdata.showBusinessDates()
        sys.exit(0)

    if options.partition:
        options.partition = [options.partition]

    startOfDay = StartOfDay(bidPrice=options.bidPrice,
                            offerPrice=options.offerPrice,
                            businessDate=options.businessDate,
                            partitions=options.partition,
                            gwHost=options.gwhost,
                            gwPort=options.gwport,
                            ofiHost=options.ofihost,
                            ofiPort=options.ofiport)
    startOfDay.run()