Esempio n. 1
0
def main():
    exchange = connect()
    write_to_exchange(exchange, {"type": "hello", "team": team_name.upper()})
    td = timedelta(seconds=1)
    c = 0
    sm = ServerMessage(exchange)
    priv_msg = Manipulate(None, exchange)
    while c<10:
        c += 1
        books, trades, open, close = sm.get_current_book(4)
        print(books.keys())
        print(len(trades))
        my_stra = strategy_simple(priv_msg, books, trades)
        print(my_stra)
        if my_stra is None:
            continue
        else:
            priv_msg.trade_process(my_stra["buy"], my_stra["sell"], time_out=5)
            priv_msg.print_all()
            pass
    exchange.close()