示例#1
0
	def update_and_open_db(self):
		if self.analysis_only:
		    self._open_db()
	        else:
		    #
		    #Check if todays price file is created
		    #
		    reader = db_util.open_reader_fixed('names')
		    for row in reader:
	    	        self.nameArray.append(row)
		 
		    if db_util.check_update('price'):
		        print "Found Update"
		        self._open_db()
		    else:
		        #
	    	        # Check if today is a market day
		        #
	    	        if self._today_is_market_day():
		    	    print "TODAY IS MARKET DAY"
			    #
			    # Update Price and SMA DB (opens them too)
			    #
			    self.update_price_db()
			    self.update_sma_db()
	    	        else:
	    	    	    self._open_db()
示例#2
0
	def _open_db(self):
		#
	 	# Open Name Db
		#
		self.nameArray = []
		reader = db_util.open_reader_fixed('names')
		for row in reader:
	    	    self.nameArray.append(row)
		 
		#
	 	# Open Price Db
		#
		self.priceArray = []
		reader = db_util.open_reader('price')
		for row in reader:
	    	    self.priceArray.append(row)

		#
	 	# Open SMA Db
		#
		self.smaArray = []
		reader = db_util.open_reader('sma')
		for row in reader:
	    	    self.smaArray.append(row)
		#
		# Open 50day SMA
		#
		self.sma50Array = []
		reader = db_util.open_reader('sma50')
		for row in reader:
	    	    self.sma50Array.append(row)
示例#3
0
    def update_and_open_db(self):
        if self.analysis_only:
            self._open_db()
        else:
            #
            #Check if todays price file is created
            #
            reader = db_util.open_reader_fixed('names')
            for row in reader:
                self.nameArray.append(row)

            if db_util.check_update('price'):
                print "Found Update"
                self._open_db()
            else:
                #
                # Check if today is a market day
                #
                if self._today_is_market_day():
                    print "TODAY IS MARKET DAY"
                    #
                    # Update Price and SMA DB (opens them too)
                    #
                    self.update_price_db()
                    self.update_sma_db()
                else:
                    self._open_db()
示例#4
0
    def _open_db(self):
        #
        # Open Name Db
        #
        self.nameArray = []
        reader = db_util.open_reader_fixed('names')
        for row in reader:
            self.nameArray.append(row)

        #
        # Open Price Db
        #
        self.priceArray = []
        reader = db_util.open_reader('price')
        for row in reader:
            self.priceArray.append(row)

        #
        # Open SMA Db
        #
        self.smaArray = []
        reader = db_util.open_reader('sma')
        for row in reader:
            self.smaArray.append(row)
        #
        # Open 50day SMA
        #
        self.sma50Array = []
        reader = db_util.open_reader('sma50')
        for row in reader:
            self.sma50Array.append(row)
示例#5
0
    def _open_db(self):
        #
        # Open Name Db
        #
        self.nameArray = []
        reader = db_util.open_reader_fixed("names")
        for row in reader:
            self.nameArray.append(row)

        #
        # Open Price Db
        #
        self.priceArray = []
        reader = db_util.open_reader("price")
        for row in reader:
            self.priceArray.append(row)

        #
        # Open SMA Db
        #
        self.smaArray = []
        reader = db_util.open_reader("sma")
        for row in reader:
            self.smaArray.append(row)