ipo calendar
This commit is contained in:
parent
68ad7bef41
commit
f43918081e
232
stockTicker.py
232
stockTicker.py
@ -69,7 +69,7 @@ class StockTicker():
|
|||||||
'Sports (Team Stats)':lambda : self.getLeagueTableImage('premier_league'), 'Sports (Past Games)': lambda:self.getLeagueImage('NBA', 'past'),
|
'Sports (Team Stats)':lambda : self.getLeagueTableImage('premier_league'), 'Sports (Past Games)': lambda:self.getLeagueImage('NBA', 'past'),
|
||||||
'Sports (Upcoming Games)': lambda : self.getLeagueImage('NHL', 'future'), 'Sports (Live Games)': lambda: self.getLeagueImage('NBA', 'live'),
|
'Sports (Upcoming Games)': lambda : self.getLeagueImage('NHL', 'future'), 'Sports (Live Games)': lambda: self.getLeagueImage('NBA', 'live'),
|
||||||
'News':self.getNewsImage, 'Custom Messages': self.getUserMessages, 'Commodities': self.getCommoditiesImage, 'Indices': self.getIndicesImage, 'Movies': self.getMoviesImage,
|
'News':self.getNewsImage, 'Custom Messages': self.getUserMessages, 'Commodities': self.getCommoditiesImage, 'Indices': self.getIndicesImage, 'Movies': self.getMoviesImage,
|
||||||
|
'IPO Calendar':self.getIpoImage, 'IPO Calendar Prof':self.getIpoProfessional,
|
||||||
|
|
||||||
'Stocks Prof': self.getStockProfessional, 'Crypto Prof': self.getCryptoProfessional, 'Forex Prof': self.getForexProfessional,
|
'Stocks Prof': self.getStockProfessional, 'Crypto Prof': self.getCryptoProfessional, 'Forex Prof': self.getForexProfessional,
|
||||||
'Current Weather Prof': self.getTodayWeatherProfessional, 'News Prof':self.getNewsProfessional, 'Commodities Prof':self.getCommoditiesProfessional, 'Indices Prof': self.getIndicesProfessional,
|
'Current Weather Prof': self.getTodayWeatherProfessional, 'News Prof':self.getNewsProfessional, 'Commodities Prof':self.getCommoditiesProfessional, 'Indices Prof': self.getIndicesProfessional,
|
||||||
@ -78,12 +78,12 @@ class StockTicker():
|
|||||||
|
|
||||||
self.JSONs = {'Stocks': 'csv/stocks_settings.json', 'Crypto': 'csv/crypto_settings.json', 'Forex': 'csv/forex_settings.json',
|
self.JSONs = {'Stocks': 'csv/stocks_settings.json', 'Crypto': 'csv/crypto_settings.json', 'Forex': 'csv/forex_settings.json',
|
||||||
'Daily Forecast':'csv/daily_weather.json', 'Current Weather': 'csv/current_weather.json', 'Commodities':'csv/commodities_settings.json', 'Indices': 'csv/indices_settings.json',
|
'Daily Forecast':'csv/daily_weather.json', 'Current Weather': 'csv/current_weather.json', 'Commodities':'csv/commodities_settings.json', 'Indices': 'csv/indices_settings.json',
|
||||||
'Sports (Team Stats)': 'csv/league_tables.json', 'Sports (Past Games)': 'csv/past_games.json',
|
'Sports (Team Stats)': 'csv/league_tables.json', 'Sports (Past Games)': 'csv/past_games.json', 'IPO Calendar': 'csv/ipo_settings.json',
|
||||||
'Sports (Upcoming Games)': 'csv/upcoming_games.json', 'Sports (Live Games)': 'csv/live_games.json', 'Movies': 'csv/movie_settings.json',
|
'Sports (Upcoming Games)': 'csv/upcoming_games.json', 'Sports (Live Games)': 'csv/live_games.json', 'Movies': 'csv/movie_settings.json',
|
||||||
'News':'csv/news_settings.json', 'Custom Images': 'csv/image_settings.json', 'Custom GIFs': 'csv/GIF_settings.json', 'Custom Messages': 'csv/message_settings.json',
|
'News':'csv/news_settings.json', 'Custom Images': 'csv/image_settings.json', 'Custom GIFs': 'csv/GIF_settings.json', 'Custom Messages': 'csv/message_settings.json',
|
||||||
'Stocks Prof': 'csv/stocks_settings.json', 'Crypto Prof': 'csv/crypto_settings.json', 'Forex Prof': 'csv/forex_settings.json',
|
'Stocks Prof': 'csv/stocks_settings.json', 'Crypto Prof': 'csv/crypto_settings.json', 'Forex Prof': 'csv/forex_settings.json',
|
||||||
'Current Weather Prof': 'csv/current_weather.json', 'News Prof':'csv/news_settings.json', 'Commodities Prof':'csv/commodities_settings.json', 'Indices Prof': 'csv/indices_settings.json',
|
'Current Weather Prof': 'csv/current_weather.json', 'News Prof':'csv/news_settings.json', 'Commodities Prof':'csv/commodities_settings.json', 'Indices Prof': 'csv/indices_settings.json',
|
||||||
'Daily Forecast Prof':'csv/daily_weather.json', 'Sports (Team Stats) Prof': 'csv/league_tables.json', 'Sports (Upcoming Games) Prof': 'csv/upcoming_games.json', 'Sports (Past Games) Prof': 'csv/past_games.json', 'Custom Messages Prof': 'csv/message_settings.json', 'Custom Images Prof': 'csv/image_settings.json', 'Movies Prof': 'csv/movie_settings.json', 'Sports (Live Games) Prof': 'csv/live_games.json'}
|
'Daily Forecast Prof':'csv/daily_weather.json', 'Sports (Team Stats) Prof': 'csv/league_tables.json', 'Sports (Upcoming Games) Prof': 'csv/upcoming_games.json', 'Sports (Past Games) Prof': 'csv/past_games.json', 'Custom Messages Prof': 'csv/message_settings.json', 'Custom Images Prof': 'csv/image_settings.json', 'Movies Prof': 'csv/movie_settings.json', 'Sports (Live Games) Prof': 'csv/live_games.json', 'IPO Calendar Prof': 'csv/ipo_settings.json'}
|
||||||
|
|
||||||
|
|
||||||
def openImage(self, image_file):
|
def openImage(self, image_file):
|
||||||
@ -4310,6 +4310,226 @@ class StockTicker():
|
|||||||
return self.stitchImage(image_list)
|
return self.stitchImage(image_list)
|
||||||
|
|
||||||
|
|
||||||
|
def getIpoImage(self):
|
||||||
|
|
||||||
|
f = open('csv/ipo_settings.json', 'r')
|
||||||
|
ipo_settings = json.load(f)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
if ipo_settings['title']:
|
||||||
|
title_img = self.openImage('feature_titles/ipo.png')
|
||||||
|
image_list = [title_img]
|
||||||
|
else:
|
||||||
|
image_list = []
|
||||||
|
|
||||||
|
font = ImageFont.load("./fonts/7x14B.pil")
|
||||||
|
font2 = ImageFont.load("./fonts/6x13.pil")
|
||||||
|
small_font = ImageFont.load("./fonts/6x10.pil")
|
||||||
|
|
||||||
|
if ipo_settings['symbols'][0] != 'No Data':
|
||||||
|
try:
|
||||||
|
for ipo in ipo_settings['symbols']:
|
||||||
|
x_offset = 10
|
||||||
|
x_offset2 = 10
|
||||||
|
name_img = self.textImage(ipo['name'].upper(), font, r = 255, g = 255, b = 255)
|
||||||
|
|
||||||
|
try:
|
||||||
|
if ipo['symbol'] == "":
|
||||||
|
symbol_img = self.textImage('($N/A)', font2, r = 255, g = 255, b = 255)
|
||||||
|
else:
|
||||||
|
symbol_img = self.textImage('($'+ ipo['symbol'] + ')', font2, r = 255, g = 255, b = 255)
|
||||||
|
except:
|
||||||
|
symbol_img = self.textImage('($N/A)', font2, r = 255, g = 255, b = 255)
|
||||||
|
|
||||||
|
date_img = self.textImage(ipo['date'], font2, r = 255, g = 255, b = 0)
|
||||||
|
|
||||||
|
status_1 = self.textImage('Status:', small_font, r=255, g=255, b=255)
|
||||||
|
if ipo['status'] == 'expected':
|
||||||
|
status_img = self.textImage(ipo['status'].capitalize(), small_font, r = 255, g = 255, b = 0) # diff color
|
||||||
|
elif ipo['status'] == 'priced':
|
||||||
|
status_img = self.textImage(ipo['status'].capitalize(), small_font, r = 0, g = 255, b = 0) # diff color
|
||||||
|
elif ipo['status'] == 'withdrawn':
|
||||||
|
status_img = self.textImage(ipo['status'].capitalize(), small_font, r = 255, g = 0, b = 0) # diff color
|
||||||
|
elif ipo['status'] == 'filed':
|
||||||
|
status_img = self.textImage(ipo['status'].capitalize(), small_font, r = 54, g = 69, b = 79) # diff color
|
||||||
|
|
||||||
|
shares_1 = self.textImage('Shares:', small_font, r = 255, g = 255, b = 255)
|
||||||
|
try:
|
||||||
|
shares_img = self.textImage(ipo['shares'], small_font, r = 38, g = 59, b = 232)
|
||||||
|
except:
|
||||||
|
shares_img = self.textImage('N/A', small_font, r = 38, g = 59, b = 232)
|
||||||
|
|
||||||
|
price_1 = self.textImage('Price:', small_font, r = 255, g = 255, b = 255)
|
||||||
|
try:
|
||||||
|
price_img = self.textImage(ipo['price'], small_font, r = 0, g = 255, b = 0)
|
||||||
|
except:
|
||||||
|
price_img = self.textImage('N/A', small_font, r = 0, g = 255, b = 0)
|
||||||
|
|
||||||
|
sharesvalue_1 = self.textImage('Value:', small_font, r=255, g=255, b=255)
|
||||||
|
try:
|
||||||
|
sharesvalue_img = self.textImage(ipo['sharesvalue'], small_font, r = 213, g = 117, b = 0)
|
||||||
|
except:
|
||||||
|
sharesvalue_img = self.textImage('N/A', small_font, r = 213, g = 117, b = 0)
|
||||||
|
|
||||||
|
img = Image.new('RGB', (max(x_offset + name_img.size[0] + 2 + symbol_img.size[0] + 8 + date_img.size[0], x_offset2 + status_1.size[0] +
|
||||||
|
status_img.size[0] + 8 + price_1.size[0] + price_img.size[0] + 8 + shares_1.size[0] + shares_img.size[0] +8
|
||||||
|
+ sharesvalue_1.size[0] + sharesvalue_img.size[0])+30,32))
|
||||||
|
|
||||||
|
img.paste(status_1,(x_offset2, 19))
|
||||||
|
x_offset2 += status_1.size[0]
|
||||||
|
img.paste(status_img, (x_offset2, 19))
|
||||||
|
x_offset2 += status_img.size[0] + 8
|
||||||
|
img.paste(price_1, (x_offset2, 19))
|
||||||
|
x_offset2 += price_1.size[0]
|
||||||
|
img.paste(price_img, (x_offset2, 19))
|
||||||
|
x_offset2 += price_img.size[0] + 8
|
||||||
|
img.paste(shares_1, (x_offset2, 19))
|
||||||
|
x_offset2 += shares_1.size[0]
|
||||||
|
img.paste(shares_img, (x_offset2, 19))
|
||||||
|
x_offset2 += shares_img.size[0] + 8
|
||||||
|
img.paste(sharesvalue_1, (x_offset2, 19))
|
||||||
|
x_offset2 += sharesvalue_1.size[0]
|
||||||
|
img.paste(sharesvalue_img, (x_offset2, 19))
|
||||||
|
|
||||||
|
img.paste(name_img, (x_offset,0))
|
||||||
|
x_offset += name_img.size[0] + 2
|
||||||
|
img.paste(symbol_img, (x_offset, 0))
|
||||||
|
x_offset += symbol_img.size[0] + 8
|
||||||
|
img.paste(date_img, (x_offset, 0))
|
||||||
|
|
||||||
|
line_image = Image.new("RGB", (name_img.size[0] + 2 + symbol_img.size[0] + 8 + date_img.size[0], 1))
|
||||||
|
line_image1 = ImageDraw.Draw(line_image)
|
||||||
|
line_image1.line((0,0,name_img.size[0] + 2 + symbol_img.size[0] + 8 + date_img.size[0],0), fill="blue", width = 0)
|
||||||
|
img.paste(line_image, (10, max(name_img.size[1],symbol_img.size[1])-1))
|
||||||
|
|
||||||
|
image_list.append(img)
|
||||||
|
except:
|
||||||
|
time.sleep(0.1)
|
||||||
|
no_ipo = self.textImage('No Upcoming IPOs for the next 3 weeks.', font, r = 255, g = 255, b = 255)
|
||||||
|
img = Image.new('RGB', (no_ipo.size[0] + 15, 32))
|
||||||
|
img.paste(no_ipo, (10, 10))
|
||||||
|
image_list.append(img)
|
||||||
|
|
||||||
|
elif ipo_settings['symbols'][0] == 'No Data':
|
||||||
|
time.sleep(0.1)
|
||||||
|
no_ipo = self.textImage('No Upcoming IPOs for the next 3 weeks.', font, r = 255, g = 255, b = 255)
|
||||||
|
img = Image.new('RGB', (no_ipo.size[0] + 15, 32))
|
||||||
|
img.paste(no_ipo, (10, 10))
|
||||||
|
image_list.append(img)
|
||||||
|
|
||||||
|
return self.stitchImage(image_list)
|
||||||
|
|
||||||
|
|
||||||
|
def getIpoProfessional(self):
|
||||||
|
|
||||||
|
f = open('csv/ipo_settings.json', 'r')
|
||||||
|
ipo_settings = json.load(f)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
if ipo_settings['title']:
|
||||||
|
title_img = self.openImage('feature_titles/small_feature_titles/ipo.png')
|
||||||
|
image_list = [title_img]
|
||||||
|
else:
|
||||||
|
image_list = []
|
||||||
|
|
||||||
|
font = ImageFont.load("./fonts/5x8.pil")
|
||||||
|
small_font = ImageFont.load("./fonts/4x6.pil")
|
||||||
|
|
||||||
|
if ipo_settings['symbols'][0] != 'No Data':
|
||||||
|
try:
|
||||||
|
for ipo in ipo_settings['symbols']:
|
||||||
|
x_offset = 10
|
||||||
|
x_offset2 = 10
|
||||||
|
name_img = self.textImage(ipo['name'].upper(), font, r = 255, g = 255, b = 255)
|
||||||
|
|
||||||
|
try:
|
||||||
|
if ipo['symbol'] == "":
|
||||||
|
symbol_img = self.textImage('($N/A)', font, r = 255, g = 255, b = 255)
|
||||||
|
else:
|
||||||
|
symbol_img = self.textImage('($'+ ipo['symbol'] + ')', font, r = 255, g = 255, b = 255)
|
||||||
|
except:
|
||||||
|
symbol_img = self.textImage('($N/A)', font, r = 255, g = 255, b = 255)
|
||||||
|
|
||||||
|
date_img = self.textImage(ipo['date'], font, r = 255, g = 255, b = 0)
|
||||||
|
|
||||||
|
status_1 = self.textImage('Status:', small_font, r=255, g=255, b=255)
|
||||||
|
if ipo['status'] == 'expected':
|
||||||
|
status_img = self.textImage(ipo['status'].capitalize(), small_font, r = 255, g = 255, b = 0) # diff color
|
||||||
|
elif ipo['status'] == 'priced':
|
||||||
|
status_img = self.textImage(ipo['status'].capitalize(), small_font, r = 0, g = 255, b = 0) # diff color
|
||||||
|
elif ipo['status'] == 'withdrawn':
|
||||||
|
status_img = self.textImage(ipo['status'].capitalize(), small_font, r = 255, g = 0, b = 0) # diff color
|
||||||
|
elif ipo['status'] == 'filed':
|
||||||
|
status_img = self.textImage(ipo['status'].capitalize(), small_font, r = 54, g = 69, b = 79) # diff color
|
||||||
|
|
||||||
|
shares_1 = self.textImage('Shares:', small_font, r = 255, g = 255, b = 255)
|
||||||
|
try:
|
||||||
|
shares_img = self.textImage(ipo['shares'], small_font, r = 38, g = 59, b = 232)
|
||||||
|
except:
|
||||||
|
shares_img = self.textImage('N/A', small_font, r = 38, g = 59, b = 232)
|
||||||
|
|
||||||
|
price_1 = self.textImage('Price:', small_font, r = 255, g = 255, b = 255)
|
||||||
|
try:
|
||||||
|
price_img = self.textImage(ipo['price'], small_font, r = 0, g = 255, b = 0)
|
||||||
|
except:
|
||||||
|
price_img = self.textImage('N/A', small_font, r = 0, g = 255, b = 0)
|
||||||
|
|
||||||
|
sharesvalue_1 = self.textImage('Value:', small_font, r=255, g=255, b=255)
|
||||||
|
try:
|
||||||
|
sharesvalue_img = self.textImage(ipo['sharesvalue'], small_font, r = 213, g = 117, b = 0)
|
||||||
|
except:
|
||||||
|
sharesvalue_img = self.textImage('N/A', small_font, r = 213, g = 117, b = 0)
|
||||||
|
|
||||||
|
img = Image.new('RGB', (max(x_offset + name_img.size[0] + 2 + symbol_img.size[0] + 5 + date_img.size[0], x_offset2 + status_1.size[0] +
|
||||||
|
status_img.size[0] + 8 + price_1.size[0] + price_img.size[0] + 8 + shares_1.size[0] + shares_img.size[0] +8
|
||||||
|
+ sharesvalue_1.size[0] + sharesvalue_img.size[0])+30,16))
|
||||||
|
|
||||||
|
img.paste(status_1,(x_offset2, 10))
|
||||||
|
x_offset2 += status_1.size[0]
|
||||||
|
img.paste(status_img, (x_offset2, 10))
|
||||||
|
x_offset2 += status_img.size[0] + 8
|
||||||
|
img.paste(price_1, (x_offset2, 10))
|
||||||
|
x_offset2 += price_1.size[0]
|
||||||
|
img.paste(price_img, (x_offset2, 10))
|
||||||
|
x_offset2 += price_img.size[0] + 8
|
||||||
|
img.paste(shares_1, (x_offset2, 10))
|
||||||
|
x_offset2 += shares_1.size[0]
|
||||||
|
img.paste(shares_img, (x_offset2, 10))
|
||||||
|
x_offset2 += shares_img.size[0] + 8
|
||||||
|
img.paste(sharesvalue_1, (x_offset2, 10))
|
||||||
|
x_offset2 += sharesvalue_1.size[0]
|
||||||
|
img.paste(sharesvalue_img, (x_offset2, 10))
|
||||||
|
|
||||||
|
img.paste(name_img, (x_offset,0))
|
||||||
|
x_offset += name_img.size[0] + 2
|
||||||
|
img.paste(symbol_img, (x_offset, 0))
|
||||||
|
x_offset += symbol_img.size[0] + 5
|
||||||
|
img.paste(date_img, (x_offset, 0))
|
||||||
|
|
||||||
|
line_image = Image.new("RGB", (name_img.size[0] + 2 + symbol_img.size[0] + 5 + date_img.size[0], 1))
|
||||||
|
line_image1 = ImageDraw.Draw(line_image)
|
||||||
|
line_image1.line((0,0,name_img.size[0] + 2 + symbol_img.size[0] + 5 + date_img.size[0],0), fill="blue", width = 0)
|
||||||
|
img.paste(line_image, (10, max(name_img.size[1],symbol_img.size[1])-2))
|
||||||
|
|
||||||
|
image_list.append(img)
|
||||||
|
except:
|
||||||
|
time.sleep(0.1)
|
||||||
|
font = ImageFont.load("./fonts/6x13.pil")
|
||||||
|
no_ipo = self.textImage('No Upcoming IPOs for the next 3 weeks.', font, r = 255, g = 255, b = 255)
|
||||||
|
img = Image.new('RGB', (no_ipo.size[0] + 15, 16))
|
||||||
|
img.paste(no_ipo, (10, 1))
|
||||||
|
image_list.append(img)
|
||||||
|
|
||||||
|
elif ipo_settings['symbols'][0] == 'No Data':
|
||||||
|
time.sleep(0.1)
|
||||||
|
font = ImageFont.load("./fonts/6x13.pil")
|
||||||
|
no_ipo = self.textImage('No Upcoming IPOs for the next 3 weeks.', font, r = 255, g = 255, b = 255)
|
||||||
|
img = Image.new('RGB', (no_ipo.size[0] + 15, 16))
|
||||||
|
img.paste(no_ipo, (10, 1))
|
||||||
|
image_list.append(img)
|
||||||
|
|
||||||
|
return self.stitchImage(image_list)
|
||||||
|
|
||||||
|
|
||||||
def displayStocks(self):
|
def displayStocks(self):
|
||||||
|
|
||||||
@ -4331,6 +4551,7 @@ class StockTicker():
|
|||||||
movies = self.getMoviesProfessional()
|
movies = self.getMoviesProfessional()
|
||||||
messages = self.getUserMessagesProfessional()
|
messages = self.getUserMessagesProfessional()
|
||||||
images = self.getUserImagesProfessional()
|
images = self.getUserImagesProfessional()
|
||||||
|
ipo = self.getIpoProfessional()
|
||||||
|
|
||||||
x_offset = 0
|
x_offset = 0
|
||||||
news.paste(weather, (x_offset, 16))
|
news.paste(weather, (x_offset, 16))
|
||||||
@ -4361,6 +4582,8 @@ class StockTicker():
|
|||||||
x_offset += messages.size[0]
|
x_offset += messages.size[0]
|
||||||
news.paste(images, (x_offset, 16))
|
news.paste(images, (x_offset, 16))
|
||||||
x_offset += images.size[0]
|
x_offset += images.size[0]
|
||||||
|
news.paste(ipo, (x_offset, 16))
|
||||||
|
x_offset += ipo.size[0]
|
||||||
self.double_buffer = self.matrix.CreateFrameCanvas()
|
self.double_buffer = self.matrix.CreateFrameCanvas()
|
||||||
while True:
|
while True:
|
||||||
kill = stock_ticker.scrollImage(news, offset_x = 128)
|
kill = stock_ticker.scrollImage(news, offset_x = 128)
|
||||||
@ -4441,6 +4664,9 @@ class StockTicker():
|
|||||||
elif msg == 'MO': #movies
|
elif msg == 'MO': #movies
|
||||||
self.scrollFunctionsAnimated(['movies', 'movies'],animation = 'traditional')
|
self.scrollFunctionsAnimated(['movies', 'movies'],animation = 'traditional')
|
||||||
|
|
||||||
|
elif msg == 'IPO': #ipo
|
||||||
|
self.scrollFunctionsAnimated(['ipo', 'ipo'],animation = 'traditional')
|
||||||
|
|
||||||
elif msg == 'A': #everything
|
elif msg == 'A': #everything
|
||||||
|
|
||||||
#userSettings = ['display_gif', 'text', 'display_image', 'stocks', 'crypto', 'forex', 'today_weather', 'daily_weather', 'league_table', 'league_games', 'news'] # these wil be read from csv, just for demo
|
#userSettings = ['display_gif', 'text', 'display_image', 'stocks', 'crypto', 'forex', 'today_weather', 'daily_weather', 'league_table', 'league_games', 'news'] # these wil be read from csv, just for demo
|
||||||
|
Loading…
Reference in New Issue
Block a user