alpacahq / marketstore

DataFrame Server for Financial Timeseries Data
Apache License 2.0
1.87k stars 226 forks source link

client.write() does not work with python 2.7 #125

Open Notargets opened 6 years ago

Notargets commented 6 years ago

When I try the example in the README, it fails with a corrupted time index:

import numpy as np
import pandas as pd
import pymarketstore as pymkts

data = np.array([(pd.Timestamp('2017-01-01 00:00').value / 10**9, 10.0)], dtype=[('Epoch', 'i8'), ('Ask', 'f4')])

cli = pymkts.Client()

cli.write(data, 'TEST/1Min/Tick')

d2 = cli.query(pymkts.Params('TEST', '1Min', 'Tick')).first().df()
print d2

I get the following output:

# python tests/basic_driver.py 
Empty DataFrame
Columns: [Ask]
Index: []

I believe the problem is in the handling of the numpy data in the driver as compared with the handling in the API code in the marketstore server. To fix this, we should:

Notargets commented 6 years ago

verified that the behavior is this: works with python3, but not with python 2.7, so relabeling issue...