man-group / arctic

High performance datastore for time series and tick data
https://arctic.readthedocs.io/en/latest/
GNU Lesser General Public License v2.1
3.06k stars 583 forks source link

BUG: Timestamp not preserved during write #483

Closed bashtage closed 6 years ago

bashtage commented 6 years ago

Arctic Version

1.56

Arctic Store

TickStore

Platform and version

Windows/Mongo 3.4

Description of problem and/or code sample that reproduces the issue

import datetime
import pytz
import arctic
from arctic.date import DateRange

data = [{'index': datetime.datetime(2004, 1, 14, 8, 30, 4, 807000, tzinfo=pytz.utc),
  'price': 9142.12,
  'qualifiers': ''}]

client = arctic.Arctic('localhost')
if 'BUG-TEST' in client.list_libraries():
    client.delete_library('BUG-TEST')
client.initialize_library('BUG-TEST',arctic.TICK_STORE)
lib = client['BUG-TEST']
lib.write('blah', data)
data_range = DateRange(datetime.datetime(2004, 1, 14, tzinfo=pytz.utc),
                       datetime.datetime(2004, 1, 15, tzinfo=pytz.utc))
reread = lib.read('blah', data_range)
print(reread)

Running this returns

2004-01-14 08:30:04.806000+00:00  9142.12      

Note the millisecond is 806000, not 807000 as was inserted.

aflag commented 6 years ago

This seems related: https://github.com/manahl/arctic/issues/226

bmoscon commented 6 years ago

fixed