base currencies and point change added for cryptos

This commit is contained in:
Neythen 2021-05-25 19:57:34 +01:00
parent 8295ca593e
commit 87fe5a67d6
135 changed files with 76 additions and 74 deletions

View File

@ -48,29 +48,33 @@ def readCryptoCSV(file_path, max_stocks):
CSV = csv.reader(f) CSV = csv.reader(f)
next(CSV) next(CSV)
i = 0 i = 0
unique_bases = []
for row in CSV: for row in CSV:
print(row) print(row)
if i < max_stocks: if i < max_stocks:
i += 1 i += 1
try: try:
symbol, name, current_price, opening_price = row symbol, name, base, current_price, opening_price = row
symbols.append(symbol) symbols.append(symbol)
names.append(name) names.append(name)
stock_info[name] = [symbol, current_price, opening_price] stock_info[name] = [symbol, base, current_price, opening_price]
if base not in unique_bases:
unique_bases.append(base)
except: except:
symbol = row[0] symbol, name, base = row
name = row[1] if base not in unique_bases:
unique_bases.append(base)
symbols.append(symbol) symbols.append(symbol)
names.append(name) names.append(name)
stock_info[name] = [symbol] stock_info[name] = [symbol, base]
else: else:
print('max stocks exceeded') print('max stocks exceeded')
break break
f.close() f.close()
return names, stock_info return names, stock_info, unique_bases
def emptyInfo(symbols, stock_info): def emptyInfo(symbols, stock_info):
update = False update = False
@ -91,10 +95,9 @@ def updateStockPrices(symbols):
quotes = [finnhubClient.quote(symbol) for symbol in symbols] quotes = [finnhubClient.quote(symbol) for symbol in symbols]
current_prices = [quote['c'] for quote in quotes] current_prices = [quote['c'] for quote in quotes]
opening_prices = [quote['o'] for quote in quotes] opening_prices = [quote['o'] for quote in quotes]
print(current_prices)
print(opening_prices)
print(current_prices, opening_prices)
CSV = open('csv/tickers.csv', 'w+') CSV = open('csv/tickers.csv', 'w+')
CSV.write('name,current,opening\n') CSV.write('name,current,opening\n')
for i, symbol in enumerate(symbols): for i, symbol in enumerate(symbols):
@ -166,18 +169,21 @@ def updateStockPricesIEX(symbols):
CSV.write(symbol + ',' + str(current_prices[i]) + ',' + str(opening_prices[i]) + '\n') CSV.write(symbol + ',' + str(current_prices[i]) + ',' + str(opening_prices[i]) + '\n')
CSV.close() CSV.close()
print(lasts)
def updateCrypto(coins, coin_info): def updateCrypto(coins, coin_info, unique_bases):
response = coingecko_client.get_price(ids=','.join(coins), vs_currencies = 'usd', include_24hr_change=True) response = coingecko_client.get_price(ids=','.join(coins), vs_currencies = unique_bases, include_24hr_change=True)
CSV = open('csv/crypto.csv', 'w+') CSV = open('csv/crypto.csv', 'w+')
CSV.write('symbol,name,current,24hr change\n') CSV.write('symbol,name,base,current,24hr change\n')
for coin in coins: for coin in coins:
info = coin_info[coin]
CSV.write(coin_info[coin][0] + ',' + coin+ ',' + str(response[coin]['usd']) + ',' + str(response[coin]['usd_24h_change']) + '\n') print(info)
CSV.write(info[0] + ',' + coin + ',' + info[1] + ',' +str(response[coin][info[1]]) + ',' + str(response[coin]['usd_24h_change']) + '\n')
CSV.close() CSV.close()
@ -223,17 +229,15 @@ if __name__ == '__main__':
closing = NY_time.replace(hour=16, minute=0, second=0, microsecond=0) closing = NY_time.replace(hour=16, minute=0, second=0, microsecond=0)
NY_time = datetime.now(NY_zone) NY_time = datetime.now(NY_zone)
print(NY_time)
symbols, stock_info = readCSV('csv/tickers.csv', max_stocks) symbols, stock_info = readCSV('csv/tickers.csv', max_stocks)
updateStockPrices(symbols) updateStockPrices(symbols)
updateUpdate(NY_time) updateUpdate(NY_time)
while True: while True:
coins, coin_info = readCryptoCSV('csv/crypto.csv', max_stocks) coins, coin_info, unique_bases = readCryptoCSV('csv/crypto.csv', max_stocks)
print(coins)
print(coin_info) updateCrypto(coins, coin_info, unique_bases)
updateCrypto(coins, coin_info)
updateNews() updateNews()
@ -256,7 +260,7 @@ if __name__ == '__main__':
f = open('csv/last_update.csv', 'r') f = open('csv/last_update.csv', 'r')
CSV = csv.reader(f) CSV = csv.reader(f)
last_update_str = next(CSV)[0] last_update_str = next(CSV)[0]
print(last_update_str)
last_update = datetime.strptime(last_update_str, "%d/%m/%Y %H:%M:%S") last_update = datetime.strptime(last_update_str, "%d/%m/%Y %H:%M:%S")
yday_closing = closing - dt.timedelta(days=1) yday_closing = closing - dt.timedelta(days=1)
@ -264,7 +268,7 @@ if __name__ == '__main__':
yday_closing = datetime.strptime(yday_str, "%d/%m/%Y %H:%M:%S") yday_closing = datetime.strptime(yday_str, "%d/%m/%Y %H:%M:%S")
print(last_update < yday_closing)
if last_update < yday_closing: if last_update < yday_closing:
updateStockPrices(symbols) updateStockPrices(symbols)

View File

@ -1,3 +1,3 @@
symbol,name,current,24hr change symbol,name,base,current,24hr change
BTC,bitcoin,38402,16.47581759149 BTC,bitcoin,usd,38061,0.15138810082760248
ETH,ethereum,2550.15,29.546988294381478 ETH,ethereum,gbp,1841.33,1.197151365974607

1 symbol name base current 24hr change
2 BTC bitcoin usd 38402 38061 16.47581759149 0.15138810082760248
3 ETH ethereum gbp 2550.15 1841.33 29.546988294381478 1.197151365974607

View File

@ -1 +1 @@
24/05/2021 15:58:28 25/05/2021 14:54:13

1 24/05/2021 15:58:28 25/05/2021 14:54:13

View File

@ -1,21 +1,21 @@
headline headline
UK in race between Covid vaccines and variant, experts warn - The Guardian COVID-19 LIVE UPDATES | SA says consensus reached for talks on pandemic treaty - TimesLIVE
Up to 8,700 patients died after catching Covid in English hospitals - The Guardian WHO, DOST set crucial vaccine tests for Pinoys - INQUIRER.net
Heysham explosion: Cut gas pipe caused fatal blast, say police - BBC News Huawei to unveil new OS - The Manila Times
Buhari orders postponement of FEC, Police Council meeting - Guardian Total lunar eclipse 2021: How to see the super flower blood moon - MARCA.com
Explained: Why are doctors prescribing blood thinners to COVID patients? - Times of India NBI given 10 days to file initial probe findings into 'vaccine for sale' scam | Joel R. San Juan - Business Mirror
'Have you gone bonkers!' Australian ridicules Prince Harry for Archie's first words claim - Express BTS single "Butter" breaks three world records across YouTube and Spotify - Guinness World Records
Oilers Josh Archibald suspended one game for clipping Jets Logan Stanley - Sportsnet.ca “Super Flower Blood Moon” to be visible to southern Albertans early Wednesday morning - Lethbridge News Now
Fire tears through commercial building in downtown New Westminster - CTV News Vancouver U.S. will reopen consulate in Jerusalem, Secretary of State Blinken announces - CBC.ca
Airlines are avoiding Belarus after 'state-sponsored hijacking' of Ryanair flight - CNN 18 COVID-19 community cases in Singapore, including Sengkang General Hospital housekeeper - CNA
India vs England series itinerary unlikely to change after ECB-BCCI back-channel talks - Times of India When to see the total lunar eclipse and 'flower' supermoon - CNN
Epic Games Faces Apple in Final Day of Courtroom Battle Over Monopoly Claims - The Wall Street Journal Match Highlights BAN vs SL 2nd ODI Updates: Ton-Up Mushfiqur Rahim And Bowlers Shine as Bangladesh Beat Sri L - India.com
Damiano David: Eurovision winner cleared of drug use by broadcaster - BBC News Central Bank bans former mortgage firm MD as gardaí investigate - The Irish Times
Nova Scotia reports 49 new COVID-19 cases Monday, active total drops to 894 - CTV News Atlantic Build 2021: Heres everything Microsoft announced at its annual developer conference - The Indian Express
NASA confirms time of Wednesday's super blood moon in Ireland - and where it will be visible to observers - Irish Mirror GLOBALink | Exploring Mars with China's Zhurong rover - Daily News Egypt
Horror caught on CCTV: Man dies after bike dodges check post in Telangana - Hindustan Times Axiom Space lines up second private flight to the ISS, led by record-holding astronaut Peggy Whitson - CNBC
Presidency: Southern governors' plan to enforce open grazing ban is of questionable legality - TheCable COVID-19: Councils say travel not prohibited after meeting government officials over local lockdown fears - Sky News
Former CDC head urges kids COVID-19 vaccinations as agency probes rare heart issues - Fox News Prince Harry makes heartbreakingly sweet comment about 'mummy' Princess Diana in unearthed video showing his once strong bond with Prince William - woman&home
iOS 14.6 now available with new Apple Podcasts subscriptions - The Verge COVID: India's 'white fungus' infections raise new health concerns - DW (English)
Impeachment Witness Gordon Sondland Is Suing Mike Pompeo And U.S. For $1.8 Million - NPR Cllr slammed by party colleagues over child benefit 'subsidy to have sex' claim - Dublin Live
Blinken Dispatched to Middle East Amid Israel-Gaza Truce - The Wall Street Journal Rand Paul points finger at 80s pop star after receiving suspicious powder - The Guardian

Can't render this file because it contains an unexpected character in line 7 and column 12.

View File

@ -1,4 +1,4 @@
name,current,opening name,current,opening
MSFT,250.7,247.785 MSFT,251.215,251.769
NFLX,502.95,501.05 NFLX,500.28,506
GOOG,2406.68,2367 GOOG,2406.31,2420

1 name current opening
2 MSFT 250.7 251.215 247.785 251.769
3 NFLX 502.95 500.28 501.05 506
4 GOOG 2406.68 2406.31 2367 2420

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
final.ppm

Binary file not shown.

Binary file not shown.

BIN
logos/crypto/1INCH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
logos/crypto/AAVE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
logos/crypto/ADA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 908 B

BIN
logos/crypto/ALGO.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
logos/crypto/AMP.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 991 B

BIN
logos/crypto/ANKR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
logos/crypto/AR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
logos/crypto/ARRR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
logos/crypto/ATOM.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
logos/crypto/AVAX.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
logos/crypto/BAKE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
logos/crypto/BAL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
logos/crypto/BAT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
logos/crypto/BCD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
logos/crypto/BCH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
logos/crypto/BCHA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
logos/crypto/BNB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

BIN
logos/crypto/BNT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

BIN
logos/crypto/BSV.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
logos/crypto/BTC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
logos/crypto/BTG.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
logos/crypto/BTT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
logos/crypto/CAKE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
logos/crypto/CDAI.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
logos/crypto/CEL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
logos/crypto/CETH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
logos/crypto/CFX.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
logos/crypto/CHSB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
logos/crypto/CHZ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
logos/crypto/CKB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
logos/crypto/COMP.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
logos/crypto/CRO.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
logos/crypto/CRV.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
logos/crypto/CUSDC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
logos/crypto/DASH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
logos/crypto/DCR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
logos/crypto/DENT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
logos/crypto/DGB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
logos/crypto/DOGE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
logos/crypto/DOT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
logos/crypto/EGLD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
logos/crypto/ENJ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
logos/crypto/EOS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
logos/crypto/ETC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
logos/crypto/ETH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
logos/crypto/FIL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
logos/crypto/FLOW.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
logos/crypto/FTT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

BIN
logos/crypto/GRT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
logos/crypto/GT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

BIN
logos/crypto/HBAR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
logos/crypto/HBTC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
logos/crypto/HNT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
logos/crypto/HOT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
logos/crypto/HT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 966 B

BIN
logos/crypto/ICX.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 852 B

BIN
logos/crypto/IOST.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1015 B

BIN
logos/crypto/KCS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

BIN
logos/crypto/KLAY.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
logos/crypto/KSM.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
logos/crypto/LEO.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
logos/crypto/LINK.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 893 B

BIN
logos/crypto/LPT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

BIN
logos/crypto/LRC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

BIN
logos/crypto/LSK.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
logos/crypto/LTC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
logos/crypto/LUNA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
logos/crypto/MANA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
logos/crypto/MATIC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
logos/crypto/MIOTA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
logos/crypto/MIR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

BIN
logos/crypto/MKR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
logos/crypto/NANO.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
logos/crypto/NEAR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
logos/crypto/NEO.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

BIN
logos/crypto/NEXO.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
logos/crypto/OKB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
logos/crypto/OMG.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
logos/crypto/OMI.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
logos/crypto/ONE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
logos/crypto/ONT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

BIN
logos/crypto/PAX.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
logos/crypto/QTUM.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
logos/crypto/REN.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
logos/crypto/RSR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

BIN
logos/crypto/RUNE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
logos/crypto/RVN.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
logos/crypto/SC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
logos/crypto/SNT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

BIN
logos/crypto/SNX.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
logos/crypto/SOL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 917 B

Some files were not shown because too many files have changed in this diff Show More