<commit_before>'use strict'

// ----------------------------------------------------------------------------

const assert = require ('assert')

// ----------------------------------------------------------------------------

module.exports = (exchange, orderbook, method, symbol) => {

    const format = {
        // 'symbol': 'ETH/BTC', // reserved
        'bids': [],
        'asks': [],
        'timestamp': 1234567890,
        'datetime': '2017-09-01T00:00:00',
        'nonce': 134234234,
        // 'info': {},
    }

    const keys = Object.keys (format)
    for (let i = 0; i < keys.length; i++) {
        assert (keys[i] in orderbook)
    }

    const bids = orderbook['bids']
    const asks = orderbook['asks']

    for (let i = 0; i < bids.length; i++) {
        if (bids.length > (i + 1)) {
            assert (bids[i][0] >= bids[i + 1][0])
        }
        assert (typeof bids[i][0] === 'number')
        assert (typeof bids[i][1] === 'number')
    }

    for (let i = 0; i < asks.length; i++) {
        if (asks.length > (i + 1)) {
            assert (asks[i][0] <= asks[i + 1][0])
        }
        assert (typeof asks[i][0] === 'number')
        assert (typeof asks[i][1] === 'number')
    }

    if (![

        'ftxus',
        'mexc',
        'xbtce',
        'upbit', // an orderbook might have a 0-price ask occasionally

    ].includes (exchange.id)) {
<commit_msg>test.orderbook.js bitrue exception<commit_after>'use strict'

// ----------------------------------------------------------------------------

const assert = require ('assert')

// ----------------------------------------------------------------------------

module.exports = (exchange, orderbook, method, symbol) => {

    const format = {
        // 'symbol': 'ETH/BTC', // reserved
        'bids': [],
        'asks': [],
        'timestamp': 1234567890,
        'datetime': '2017-09-01T00:00:00',
        'nonce': 134234234,
        // 'info': {},
    }

    const keys = Object.keys (format)
    for (let i = 0; i < keys.length; i++) {
        assert (keys[i] in orderbook)
    }

    const bids = orderbook['bids']
    const asks = orderbook['asks']

    for (let i = 0; i < bids.length; i++) {
        if (bids.length > (i + 1)) {
            assert (bids[i][0] >= bids[i + 1][0])
        }
        assert (typeof bids[i][0] === 'number')
        assert (typeof bids[i][1] === 'number')
    }

    for (let i = 0; i < asks.length; i++) {
        if (asks.length > (i + 1)) {
            assert (asks[i][0] <= asks[i + 1][0])
        }
        assert (typeof asks[i][0] === 'number')
        assert (typeof asks[i][1] === 'number')
    }

    if (![

        'bitrue',
        'ftxus',
        'mexc',
        'xbtce',
        'upbit', // an orderbook might have a 0-price ask occasionally

    ].includes (exchange.id)) {

{'fraction_non_alphanumeric': 0.2798864845689961, 'fraction_numerical': 0.034764100744945015, 'mean_word_length': 1.3898305084745763, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '345690', 'n_tokens_mistral': 958, 'n_tokens_neox': 860, 'n_words': 217}