import python_forex_quotes # this lib was build on an older version of python some functions don't work such as print. # in ForexDataClient.py # Change urllib.urlopen( to urllib.request.urlopen( # also change #import urllib to #import urllib.request import MySQLdb # https://stackoverflow.com/questions/51146117/installing-mysqlclient-in-python-3-6-in-windows today = datetime.datetime.today().weekday() weekend = False basePrice = 1.324 pair = "" userNameCheck = False userName = "" # forex markets closes on weekends client = python_forex_quotes.ForexDataClient("iPLcRg1tsNOa5zw7ni1LQG53IBKjkVo6") symbols = client.getSymbols() print(symbols) if client.marketIsOpen(): print("Market status: Open") db = MySQLdb.connect("localhost", "root", "root", "pythondb") # connect to mySQL database elif today == 6 or today == 5 or today == 4: # if today is sat or sun or friday weekend = True print("Forex is closed on weekends") db = MySQLdb.connect("localhost", "root", "root", "pythondb") # connect to mySQL database else: print("Market status: Closed") print("Database not connected!") def database(table, item):
def test(): import python_forex_quotes client = python_forex_quotes.ForexDataClient('e4TUqPzLotulJKk7cmfzDsjdXZMRPKAS')
import python_forex_quotes client = python_forex_quotes.ForexDataClient('YOUR_API_KEY') if client.marketIsOpen() == True: print "Market is open!" print client.getSymbols() print client.getQuotes(['EURUSD', 'GBPJPY']) print client.quota() print client.convert('EUR', 'USD', 100)
#!/usr/bin/env python import datetime import time import python_forex_quotes from microdotphat import write_string, scroll, scroll_vertical, scroll_to, clear, show # https://1forge.com/ # pip install python_forex_quotes apikey = "" client = python_forex_quotes.ForexDataClient(apikey) print("Press Ctrl+C to exit.") while True: try: rate = client.getQuotes(['USDJPY', 'GBPJPY']) except: write_string("Can not get exchange. Retry 30 seconds later. ") for x in range(600): scroll() show() time.sleep(0.05) for line, text in enumerate(rate): write_string(text["symbol"], offset_y=line * 2 * 7, kerning=False) write_string(str(text["price"])[0:6], offset_y=(line * 2 + 1) * 7, kerning=False) show() for y in range(8): time.sleep(5)