コード例 #1
0
    def disableDates(self):
        if self.pressed == 0:
            self.pressed = 1
        else:
            self.pressed = 0
        #print(self.pressed)
        if self.pressed == 1:
            self.date1TextBox.configure(state='disabled')
            self.date2TextBox.configure(state='disabled')
            self.startDate = '1900-01-01'

            if self.stockVar.get() == 4:
                self.tickerSymbol = self.tickerTextBox.get()

            self.endDate = ystockquote.get_last_trade_date(self.tickerSymbol)
            month = self.endDate[1:self.endDate.find('/')]
            if month in ['1', '2', '3', '4', '5', '6', '7', '8', '9']:
                month = '0' + month
            print(month)
            day = self.endDate[self.endDate.find('/') +
                               1:self.endDate.rfind('/')]
            if day in ['1', '2', '3', '4', '5', '6', '7', '8', '9']:
                day = '0' + day
            print(day)
            year = self.endDate[self.endDate.rfind('/') + 1:len(self.endDate) -
                                1]
            #print(self.endDate)
            print(year)  #, month, day)
            self.endDate = year + '-' + month + '-' + day
            print(self.startDate, self.endDate)
        if self.pressed == 0:
            self.date1TextBox.configure(state='normal')
            self.date2TextBox.configure(state='normal')
コード例 #2
0
 def test_get_all_alignment_new(self):
     """ Compare bulk 'all_info' values to individual values.
     Currently broken due to misalignment from invalid CSV in
     fields: f6, k3, and maybe j2, a5, b6.
     """
     symbol = 'GOOG'
     all_info = quote_properties.get_all(symbol)
     self.assertIsInstance(all_info, dict)
     self.assertEquals(
         all_info['PreviousClose'],
         ystockquote.get_previous_close(symbol))
     self.assertEquals(
         all_info['Volume'],
         ystockquote.get_volume(symbol))
     self.assertEquals(
         all_info['BidRealtime'],
         ystockquote.get_bid_realtime(symbol))
     self.assertEquals(
         all_info['AskRealtime'],
         ystockquote.get_ask_realtime(symbol))
     self.assertEquals(
         all_info['LastTradePriceOnly'],
         ystockquote.get_last_trade_price(symbol))
     self.assertEquals(
         all_info['Open'],
         ystockquote.get_today_open(symbol))
     self.assertEquals(
         all_info['DaysHigh'],
         ystockquote.get_todays_high(symbol))
     self.assertEquals(
         all_info['LastTradeDate'],
         ystockquote.get_last_trade_date(symbol))
コード例 #3
0
	def disableDates(self):
		if self.pressed == 0:
			self.pressed = 1
		else:
			self.pressed = 0
		#print(self.pressed)
		if self.pressed == 1:
			self.date1TextBox.configure(state='disabled')
			self.date2TextBox.configure(state='disabled')
			self.startDate = '1900-01-01'
			
			if self.stockVar.get() == 4:
				self.tickerSymbol = self.tickerTextBox.get()
				
			self.endDate = ystockquote.get_last_trade_date(self.tickerSymbol)
			month = self.endDate[1 : self.endDate.find('/')]
			if month in ['1','2','3','4','5','6','7','8','9']:
				month = '0' + month
			print(month)
			day = self.endDate[self.endDate.find('/') + 1 : self.endDate.rfind('/')]
			if day in ['1','2','3','4','5','6','7','8','9']:
				day = '0' + day
			print(day)
			year = self.endDate[self.endDate.rfind('/') + 1 : len(self.endDate) - 1]
			#print(self.endDate)
			print(year)#, month, day)
			self.endDate = year + '-' + month + '-' + day
			print(self.startDate, self.endDate)
		if self.pressed == 0: 
			self.date1TextBox.configure(state='normal')
			self.date2TextBox.configure(state='normal')
コード例 #4
0
 def test_get_all_alignment(self):
     """ Compare bulk 'all_info' values to individual values.
     Currently broken due to misalignment from invalid CSV in
     fields: f6, k3, and maybe j2, a5, b6.
     """
     symbol = 'GOOG'
     all_info = ystockquote.get_all(symbol)
     self.assertIsInstance(all_info, dict)
     self.assertEquals(
         all_info['previous_close'],
         ystockquote.get_previous_close(symbol))
     self.assertEquals(
         all_info['volume'],
         ystockquote.get_volume(symbol))
     self.assertEquals(
         all_info['bid_realtime'],
         ystockquote.get_bid_realtime(symbol))
     self.assertEquals(
         all_info['ask_realtime'],
         ystockquote.get_ask_realtime(symbol))
     self.assertEquals(
         all_info['last_trade_price'],
         ystockquote.get_last_trade_price(symbol))
     self.assertEquals(
         all_info['today_open'],
         ystockquote.get_today_open(symbol))
     self.assertEquals(
         all_info['todays_high'],
         ystockquote.get_todays_high(symbol))
     self.assertEquals(
         all_info['last_trade_date'],
         ystockquote.get_last_trade_date(symbol))