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.05k stars 583 forks source link

How to use Artic properly #937

Open octosport opened 2 years ago

octosport commented 2 years ago

Arctic Version

Any

Arctic Store

ChunkStore

Platform and version

Linux

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

Although the library seems very powerful it lacks simple production use cases. If I take the example in ChunkStore:

>>> df = DataFrame(data={'data': [1, 2, 3, 4, 5, 6, 7, 8, 9],
                         'open': [1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9],
                         'close': [1.2, 2.3, 3.4, 4.5, 5.6, 6.7, 7.8, 8.9, 9.0],
                         'prev_close': [.1, .2, .3, .4, .5, .6, .7, .8, .8],
                         'volume': [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000]
                         },
                   index=MultiIndex.from_tuples([(dt(2016, 1, 1), 1),
                                                 (dt(2016, 1, 2), 1),
                                                 (dt(2016, 1, 3), 1),
                                                 (dt(2016, 2, 1), 1),
                                                 (dt(2016, 2, 2), 1),
                                                 (dt(2016, 2, 3), 1),
                                                 (dt(2016, 3, 1), 1),
                                                 (dt(2016, 3, 2), 1),
                                                 (dt(2016, 3, 3), 1)],
                                                names=['date', 'id'])
                   )

>>> lib.write('column_test', df, chunk_size='D')
>>> lib.read('column_test', columns=['prev_close', 'volume'])

               prev_close  volume
date       id                    
2016-01-01 1          0.1    1000
2016-01-02 1          0.2    2000
2016-01-03 1          0.3    3000
2016-02-01 1          0.4    4000
2016-02-02 1          0.5    5000
2016-02-03 1          0.6    6000
2016-03-01 1          0.7    7000
2016-03-02 1          0.8    8000
2016-03-03 1          0.8    9000

Maybe my understanding is not correct and the database is not designed for these cases which is perfectly fine. Otherwise, I can not find this information in the doc.

Thanks

vietlq commented 2 years ago

@mehertz ^^ probably you need to write one more article to address these requests haha