pyEX/stocks.py
def _bookToDF(b):
    '''internal'''
    quote = b.get('quote', [])
    asks = b.get('asks', [])
    bids = b.get('bids', [])
    trades = b.get('trades', [])

    df1 = pd.io.json.json_normalize(quote)
    df1['type'] = 'quote'

    df2 = pd.io.json.json_normalize(asks)
    df2['symbol'] = quote['symbol']
    df2['type'] = 'ask'

    df3 = pd.io.json.json_normalize(bids)
    df3['symbol'] = quote['symbol']
    df3['type'] = 'bid'

    df4 = pd.io.json.json_normalize(trades)
    df4['symbol'] = quote['symbol']
    df3['type'] = 'trade'

    df = pd.concat([df1, df2, df3, df4], sort=True)
    _toDatetime(df)
    return df
def _bookToDF(b):
    '''internal'''
    quote = b.get('quote', [])
    asks = b.get('asks', [])
    bids = b.get('bids', [])
    trades = b.get('trades', [])

    df1 = pd.io.json.json_normalize(quote)
    df1['type'] = 'quote'

    df2 = pd.io.json.json_normalize(asks)
    df2['symbol'] = quote['symbol']
    df2['type'] = 'ask'

    df3 = pd.io.json.json_normalize(bids)
    df3['symbol'] = quote['symbol']
    df3['type'] = 'bid'

    df4 = pd.io.json.json_normalize(trades)
    df4['symbol'] = quote['symbol']
    df3['type'] = 'trade'

    df = pd.concat([df1, df2, df3, df4], sort=True)
    _toDatetime(df)
    return df
def _bookToDF ( b ) : quote = b . get ( 'quote' , [ ] ) asks = b . get ( 'asks' , [ ] ) bids = b . get ( 'bids' , [ ] ) trades = b . get ( 'trades' , [ ] ) df1 = pd . io . json . json_normalize ( quote ) df1 [ 'type' ] = 'quote' df2 = pd . io . json . json_normalize ( asks ) df2 [ 'symbol' ] = quote [ 'symbol' ] df2 [ 'type' ] = 'ask' df3 = pd . io . json . json_normalize ( bids ) df3 [ 'symbol' ] = quote [ 'symbol' ] df3 [ 'type' ] = 'bid' df4 = pd . io . json . json_normalize ( trades ) df4 [ 'symbol' ] = quote [ 'symbol' ] df3 [ 'type' ] = 'trade' df = pd . concat ( [ df1 , df2 , df3 , df4 ] , sort = True ) _toDatetime ( df ) return df
internal
internal