def main(): dir = os.path.dirname(os.path.realpath(__file__)) pcaps = glob.glob(f"{dir}/../sample_data/COINBASE*") print(pcaps) stats = playback(COINBASE, pcaps, callbacks={L2_BOOK: book, TICKER: ticker, TRADES: trade}) print("\nPlayback complete!") print(stats)
def test_exchange_playback(exchange): Symbols.clear() dir = os.path.dirname(os.path.realpath(__file__)) pcap = glob.glob(f"{dir}/../../sample_data/{exchange}.*") results = playback(exchange, pcap) message_count = get_message_count(pcap) assert results['messages_processed'] == message_count assert lookup_table[exchange] == results['callbacks'] Symbols.clear()
def test_exchange_playback(exchange): Symbols.clear() dir = os.path.dirname(os.path.realpath(__file__)) pcap = glob.glob(f"{dir}/../../sample_data/{exchange}.*") results = playback(exchange, pcap, config="tests/config_test.yaml") message_count = get_message_count(pcap) assert results['messages_processed'] == message_count if exchange == BEQUANT: # for some unknown reason on the github build servers this test always # fails even though it works fine on my local mac and linux machines expected = dict(lookup_table[exchange]) expected[L2_BOOK] = 990 assert lookup_table[exchange] == results[ 'callbacks'] or expected == results['callbacks'] else: assert lookup_table[exchange] == results['callbacks'] Symbols.clear()