michaelForb
michaelForb

Reputation: 57

Add tick data from kucoin to pandas dataframe

I receive tick from kucoins'api and i would like to store them using symbol, price and time

async def websocketConnect():
    async def event(msg):
        tick = pd.DataFrame([{"symbol": msg['subject'], "price": msg['data']['price'], "timestamp": msg['data']['time']}])

        allTicks.append(tick, ignore_index=True)

        print(allTicks)

I append tick to allTicks but here is the result :

Empty DataFrame
Columns: [symbol, price, timestamp]
Index: []

Upvotes: 1

Views: 164

Answers (1)

michaelForb
michaelForb

Reputation: 57

Thanks to Neither :

async def websocketConnect():
        async def event(msg):
            tick = pd.DataFrame([{"symbol": msg['subject'], "price": msg['data']['price'], "timestamp": msg['data']['time']}])
    
            allTicks = allTicks.append(tick, ignore_index=True)
    
            print(allTicks)

Upvotes: 1

Related Questions