async def setup(): session = aiohttp.ClientSession() loop = asyncio.get_event_loop() database = Database(CONFIG.db_name, db_url=f"http://{CONFIG.host_name}:8123/") logger = Logger(database) dispatcher = DiffDepthStreamDispatcher(database, logger) logger.log_msg("Starting event loop...", LoggingLevel.INFO) for symbol in CONFIG.symbols: if "USD_" in symbol: loop.create_task( handle_depth_stream( symbol[4:], session, dispatcher, database, logger, loop, AssetType.USD_M, )) elif "COIN_" in symbol: loop.create_task( handle_depth_stream( symbol[5:], session, dispatcher, database, logger, loop, AssetType.COIN_M, )) else: loop.create_task( handle_depth_stream(symbol, session, dispatcher, database, logger, loop, AssetType.SPOT))
def main(_): # create log file open('logfile.txt', 'a').close() config = tf.ConfigProto(log_device_placement=True, allow_soft_placement=False) with tf.Session(config=config) as session: # Set Logger Output File sys.stdout = Logger(output_file='logfile.txt') model = Model(session) print('\n\t Start Training') model.train()
import random as rd from model import Logger as log from model import Holder as hld import matplotlib.pyplot as plt import time AREA_SIZE = 100 # HOW_MANY_WE_WANT_TO_SEE CELL_SIZE = 5 # SIZE OF SINGLE CELL TO DETERMINE WINDOW SIZE WINDOW_SIZE = AREA_SIZE * CELL_SIZE TIME = 11111 ENABLE_RANDOM_EVENTS = False AREA_NEW = np.zeros((AREA_SIZE, AREA_SIZE)) AREA_CURRENT = np.zeros((AREA_SIZE, AREA_SIZE)) LIFE, DEATH = 1, 0 DASHBOARD = np.zeros(10) LOG = log.Logger("logger") DB = hld.Holder("databaseXD") def main(): win = gp.GraphWin("GameLife", WINDOW_SIZE, WINDOW_SIZE) win.setBackground((gp.color_rgb(0, 0, 0))) bckg = gp.Image(gp.Point(WINDOW_SIZE / 2, WINDOW_SIZE / 2), WINDOW_SIZE, WINDOW_SIZE) populateAreaRandomly(AREA_CURRENT, AREA_SIZE, 14) l1, _ = countArea(AREA_CURRENT, AREA_SIZE) populateImageFromArea(bckg, AREA_CURRENT, CELL_SIZE, AREA_SIZE) bckg.draw(win) win.getMouse() newArea = AREA_CURRENT for i in range(0, TIME):
from model import Currency, Logger import time import threading from database import create_table, get_all_users, reset_field UPDATE_TIME = 5 GRAPH = 10 log = Logger("./history.txt", UPDATE_TIME) from queue_handler import init_bot, bot_loop, check_queue, update_queue create_table() init_bot() bot_thread = threading.Thread(target=bot_loop) bot_thread.start() btc = Currency('BTC', 'USD') eth = Currency('ETH', 'USD') btc_price = btc.get_price() eth_price = eth.get_price() last_prices = log.get_last_line() if not last_prices == None: last_prices = last_prices.split(",") btc_last_price = float(last_prices[1]) eth_last_price = float(last_prices[2]) btc_delta = (btc_last_price - btc_price) / btc_last_price * 100 eth_delta = (eth_last_price - eth_price) / eth_last_price * 100 else: btc_delta = 0.0 eth_delta = 0.0 log.log([btc_price, eth_price], [btc_delta, eth_delta]) while True: print("\n" * 20)