Skip to main content

AHL Research Versioned TimeSeries and Tick store

Project description

Circle CI Travis CI Coverage Status Join the chat at https://gitter.im/manahl/arctic

Arctic is a high performance datastore for numeric data. It supports Pandas, numpy arrays and pickled objects out-of-the-box, with pluggable support for other data types and optional versioning.

Arctic can query millions of rows per second per client, achieves ~10x compression on network bandwidth, ~10x compression on disk, and scales to hundreds of millions of rows per second per MongoDB instance.

Arctic has been under active development at Man AHL since 2012.

Quickstart

Install Arctic

pip install git+https://github.com/manahl/arctic.git

Run a MongoDB

mongod --dbpath <path/to/db_directory>

Using VersionStore

from arctic import Arctic
import quandl

# Connect to Local MONGODB
store = Arctic('localhost')

# Create the library - defaults to VersionStore
store.initialize_library('NASDAQ')

# Access the library
library = store['NASDAQ']

# Load some data - maybe from Quandl
aapl = quandl.get("WIKI/AAPL", authtoken="your token here")

# Store the data in the library
library.write('AAPL', aapl, metadata={'source': 'Quandl'})

# Reading the data
item = library.read('AAPL')
aapl = item.data
metadata = item.metadata

VersionStore supports much more: See the HowTo!

Adding your own storage engine

Plugging a custom class in as a library type is straightforward. This example shows how.

Concepts

Libraries

Arctic provides namespaced libraries of data. These libraries allow bucketing data by source, user or some other metric (for example frequency: End-Of-Day; Minute Bars; etc.).

Arctic supports multiple data libraries per user. A user (or namespace) maps to a MongoDB database (the granularity of mongo authentication). The library itself is composed of a number of collections within the database. Libraries look like:

  • user.EOD

  • user.ONEMINUTE

A library is mapped to a Python class. All library databases in MongoDB are prefixed with ‘arctic_’

Storage Engines

Arctic includes three storage engines:

  • VersionStore: a key-value versioned TimeSeries store. It supports:

    • Pandas data types (other Python types pickled)

    • Multiple versions of each data item. Can easily read previous versions.

    • Create point-in-time snapshots across symbols in a library

    • Soft quota support

    • Hooks for persisting other data types

    • Audited writes: API for saving metadata and data before and after a write.

    • a wide range of TimeSeries data frequencies: End-Of-Day to Minute bars

    • See the HowTo

  • TickStore: Column oriented tick database. Supports dynamic fields, chunks aren’t versioned. Designed for large continuously ticking data.

  • Chunkstore: A storage type that allows data to be stored in customizable chunk sizes. Chunks aren’t versioned, and can be appended to and updated in place.

Arctic storage implementations are pluggable. VersionStore is the default.

Requirements

Arctic currently works with:

  • Python 2.7, 3.4, 3.5, 3.6

  • pymongo >= 3.0

  • Pandas

  • MongoDB >= 2.4.x

Operating Systems: * Linux * macOS

Acknowledgements

Arctic has been under active development at Man AHL since 2012.

It wouldn’t be possible without the work of the AHL Data Engineering Team including:

Contributions welcome!

License

Arctic is licensed under the GNU LGPL v2.1. A copy of which is included in LICENSE

Changelog

1.48 (2017-06-26)

  • BugFix: Rollback #363, as it breaks multi-index dataframe

  • Bugfix: #372 OSX build improvements

1.47 (2017-06-19)

  • Feature: Re-introduce #363 concat flag, essentially undo-ing 1.45

  • BugFix: #377 Fix broken replace_one on BSONStore and add bulk_write

1.46 (2017-06-13)

  • Feature: #374 Shard BSONStore on _id rather than symbol

1.45 (2017-06-09)

  • BugFix: Rollback #363, which can cause ordering issues on append

1.44 (2017-06-08)

  • Feature: #364 Expose compressHC from internal arctic LZ4 and remove external LZ4 dependency

  • Feature: #363 Appending older data (compare to what’s exist in library) will raise. Use concat=True to append only the new bits

  • Feature: #371 Expose more functionality in BSONStore

1.43 (2017-05-30)

  • Bugfix: #350 remove deprecated pandas calls

  • Bugfix: #360 version incorrect in empty append in VersionStore

  • Feature: #365 add generic BSON store

1.42 (2017-05-12)

  • Bugfix: #346 fixed daterange subsetting error on very large dateframes in version store

  • Bugfix: #351 $size queries can’t use indexes, use alternative queries

1.41 (2017-04-20)

  • Bugfix: #334 Chunk range param with pandas object fails in chunkstore.get_chunk_ranges

  • Bugfix: #339 Depending on lz4<=0.8.2 to fix build errors

  • Bugfix: #342 fixed compilation errors on Mac OSX

  • Bugfix: #344 fixed data corruption problem with concurrent appends

1.40 (2017-03-03)

  • BugFix: #330 Make Arctic._lock reentrant

1.39 (2017-03-03)

  • Feature: #329 Add reset() method to Arctic

1.38 (2017-02-22)

  • Bugfix: #324 Datetime indexes must be sorted in chunkstore

  • Feature: #290 improve performance of tickstore column reads

1.37 (2017-1-31)

  • Bugfix: #300 to_datetime deprecated in pandas, use to_pydatetime instead

  • Bugfix: #309 formatting change for DateRange __str__

  • Feature: #313 set and read user specified metadata in chunkstore

  • Feature: #319 Audit log support in ChunkStor

  • Bugfix: #216 Tickstore write fails with named index column

1.36 (2016-12-13)

  • Feature: Default to hashed based sharding

  • Bugfix: retry socket errors during VersionStore snapshot operations

1.35 (2016-11-29)

  • Bugfix: #296 Cannot compress/decompress empty string

1.34 (2016-11-29)

  • Feature: #294 Move per-chunk metadata for chunkstore to a separate collection

  • Bugfix: #292 Account for metadata size during size chunking in ChunkStore

  • Feature: #283 Support for all pandas frequency strings in ChunkStore DateChunker

  • Feature: #286 Add has_symbol to ChunkStore and support for partial symbol matching in list_symbols

1.33 (2016-11-07)

  • Feature: #275 Tuple range object support in DateChunker

  • Bugfix: #273 Duplicate columns breaking serializer

  • Feature: #267 Tickstore.delete returns deleted data

  • Dependency: #266 Remove pytest-dbfixtures in favor of pytest-server-fixtures

1.32 (2016-10-25)

  • Feature: #260 quota support on Chunkstore

  • Bugfix: #259 prevent write of unnamed columns/indexes

  • Bugfix: #252 pandas 0.19.0 compatibility fixes

  • Bugfix: #249 open ended range reads on data without index fail

  • Bugfix: #262 VersionStore.append must check data is written correctly during repack

  • Bugfix: #263 Quota: Improve the error message when near soft-quota limit

  • Perf: #265 VersionStore.write / append don’t aggressively add indexes on each write

1.31 (2016-09-29)

  • Bugfix: #247 segmentation read fix in chunkstore

  • Feature: #243 add get_library_type method

  • Bugfix: more cython changes to handle LZ4 errors properly

  • Feature: #239 improve chunkstore’s get_info method

1.30 (2016-09-26)

  • Feature: #235 method to return chunk ranges on a symbol in ChunkStore

  • Feature: #234 Iterator access to ChunkStore

  • Bugfix: #236 Cython not handling errors from LZ4 function calls

1.29 (2016-09-20)

  • Bugfix: #228 Mongo fail-over during append can leave a Version in an inconsistent state

  • Feature: #193 Support for different Chunkers and Serializers by symbol in ChunkStore

  • Feature: #220 Raise exception if older version of arctic attempts to read unsupported pickled data

  • Feature: #219 and #220 Support for pickling large data (>2GB)

  • Feature: #204 Add support for library renaming

  • Feature: #209 Upsert capability in ChunkStore’s update method

  • Feature: #207 Support DatetimeIndexes in DateRange chunker

  • Bugfix: #232 Don’t raise during VersionStore #append(…) if the previous append failed

1.28 (2016-08-16)

  • Bugfix: #195 Top level tickstore write with list of dicts now works with timezone aware datetimes

1.27 (2016-08-05)

  • Bugfix: #187 Compatibility with latest version of pytest-dbfixtures

  • Feature: #182 Improve ChunkStore read/write performance

  • Feature: #162 Rename API for ChunkStore

  • Feature: #186 chunk_range on update

  • Bugfix: #189 range delete does not update symbol metadata

1.26 (2016-07-20)

  • Bugfix: Faster TickStore querying for multiple symbols simultaneously

  • Bugfix: TickStore.read now respects allow_secondary=True

  • Bugfix: #147 Add get_info method to ChunkStore

  • Bugfix: Periodically re-cache the library.quota to pick up any changes

  • Bugfix: #166 Add index on SHA for ChunkStore

  • Bugfix: #169 Dtype mismatch in chunkstore updates

  • Feature: #171 allow deleting of values within a date range in ChunkStore

  • Bugfix: #172 Fix date range bug when querying dates in the middle of chunks

  • Bugfix: #176 Fix overwrite failures in Chunkstore

  • Bugfix: #178 - Change how start/end dates are populated in the DB, also fix append so it works as expected.

  • Bugfix: #43 - Remove dependency on hardcoded Linux timezone files

1.25 (2016-05-23)

  • Bugfix: Ensure that Tickstore.write doesn’t allow out of order messages

  • Bugfix: VersionStore.write now allows writing ‘None’ as a value

1.24 (2016-05-10)

  • Bugfix: Backwards compatibility reading/writing documents with previous versions of Arctic

1.22 (2016-05-09)

  • Bugfix: #109 Ensure stable sort during Arctic read

  • Feature: New benchmark suite using ASV

  • Bugfix: #129 Fixed an issue where some chunks could get skipped during a multiple-symbol TickStore read

  • Bugfix: #135 Fix issue with different datatype returned from pymongo in python3

  • Feature: #130 New Chunkstore storage type

1.21 (2016-03-08)

  • Bugfix: #106 Fix Pandas Panel storage for panels with different dimensions

1.20 (2016-02-03)

  • Feature: #98 Add initial_image as optional parameter on tickstore write()

  • Bugfix: #100 Write error on end field when writing with pandas dataframes

1.19 (2016-01-29)

  • Feature: Add python 3.3/3.4 support

  • Bugfix: #95 Fix raising NoDataFoundException across multiple low level libraries

1.18 (2016-01-05)

  • Bugfix: #81 Fix broken read of multi-index DataFrame written by old version of Arctic

  • Bugfix: #49 Fix strifying tickstore

1.17 (2015-12-24)

  • Feature: Add timezone suppport to store multi-index dataframes

  • Bugfix: Fixed broken sdist releases

1.16 (2015-12-15)

  • Feature: ArticTransaction now supports non-audited ‘transactions’: audit=False with ArcticTransaction(Arctic('hostname')['some_library'], 'symbol', audit=False) as at: ... This is useful for batch jobs which read-modify-write and don’t want to clash with concurrent writers, and which don’t require keeping all versions of a symbol.

1.15 (2015-11-25)

  • Feature: get_info API added to version_store.

1.14 (2015-11-25)

1.12 (2015-11-12)

  • Bugfix: correct version detection for Pandas >= 0.18.

  • Bugfix: retrying connection initialisation in case of an AutoReconnect failure.

1.11 (2015-10-29)

  • Bugfix: Improve performance of saving multi-index Pandas DataFrames by 9x

  • Bugfix: authenticate should propagate non-OperationFailure exceptions (e.g. ConnectionFailure) as this might be indicative of socket failures

  • Bugfix: return ‘deleted’ state in VersionStore.list_versions() so that callers can pick up on the head version being the delete-sentinel.

1.10 (2015-10-28)

  • Bugfix: VersionStore.read(date_range=…) could do the wrong thing with TimeZones (which aren’t yet supported for date_range slicing.).

1.9 (2015-10-06)

  • Bugfix: fix authentication race condition when sharing an Arctic instance between multiple threads.

1.8 (2015-09-29)

  • Bugfix: compatibility with both 3.0 and pre-3.0 MongoDB for querying current authentications

1.7 (2015-09-18)

  • Feature: Add support for reading a subset of a pandas DataFrame in VersionStore.read by passing in an arctic.date.DateRange

  • Bugfix: Reauth against admin if not auth’d against a library a specific library’s DB. Sometimes we appear to miss admin DB auths. This is to workaround that until we work out what the issue is.

1.6 (2015-09-16)

  • Feature: Add support for multi-index Bitemporal DataFrame storage. This allows persisting data and changes within the DataFrame making it easier to see how old data has been revised over time.

  • Bugfix: Ensure we call the error logging hook when exceptions occur

1.5 (2015-09-02)

  • Always use the primary cluster node for ‘has_symbol()’, it’s safer

1.4 (2015-08-19)

  • Bugfixes for timezone handling, now ensures use of non-naive datetimes

  • Bugfix for tickstore read missing images

1.3 (2015-08-011)

  • Improvements to command-line control scripts for users and libraries

  • Bugfix for pickling top-level Arctic object

1.2 (2015-06-29)

  • Allow snapshotting a range of versions in the VersionStore, and snapshot all versions by default.

1.1 (2015-06-16)

  • Bugfix for backwards-compatible unpickling of bson-encoded data

  • Added switch for enabling parallel lz4 compression

1.0 (2015-06-14)

  • Initial public release

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arctic-1.48.0.tar.gz (460.8 kB view details)

Uploaded Source

Built Distributions

arctic-1.48.0-py2.7-linux-x86_64.egg (312.1 kB view details)

Uploaded Source

arctic-1.48.0-cp36-cp36m-manylinux1_x86_64.whl (480.7 kB view details)

Uploaded CPython 3.6m

arctic-1.48.0-cp36-cp36m-macosx_10_7_x86_64.whl (318.8 kB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

arctic-1.48.0-cp35-cp35m-manylinux1_x86_64.whl (478.8 kB view details)

Uploaded CPython 3.5m

arctic-1.48.0-cp35-cp35m-macosx_10_7_x86_64.whl (317.9 kB view details)

Uploaded CPython 3.5m macOS 10.7+ x86-64

arctic-1.48.0-cp27-cp27mu-manylinux1_x86_64.whl (464.6 kB view details)

Uploaded CPython 2.7mu

arctic-1.48.0-cp27-cp27m-manylinux1_x86_64.whl (464.6 kB view details)

Uploaded CPython 2.7m

arctic-1.48.0-cp27-cp27m-macosx_10_7_x86_64.whl (307.3 kB view details)

Uploaded CPython 2.7m macOS 10.7+ x86-64

File details

Details for the file arctic-1.48.0.tar.gz.

File metadata

  • Download URL: arctic-1.48.0.tar.gz
  • Upload date:
  • Size: 460.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for arctic-1.48.0.tar.gz
Algorithm Hash digest
SHA256 1bf69a0787b490e5986b86bf7751f57f97fcb948a3025576ca78d2ab286479c7
MD5 3ce8ce48fcc379d8e150ec3ba588e76a
BLAKE2b-256 f04c93769d1fc37c8a14bb78c221d26ac3d187db3346d444bc9332b58ff6f133

See more details on using hashes here.

File details

Details for the file arctic-1.48.0-py2.7-linux-x86_64.egg.

File metadata

File hashes

Hashes for arctic-1.48.0-py2.7-linux-x86_64.egg
Algorithm Hash digest
SHA256 c4a393ab339ecc0fdbf1f2a1e6bf568cd46a2f0de9403a15eb5638f9fdf9e0ee
MD5 ea012674689841e97b863ad16a6b23d7
BLAKE2b-256 fc9e187899e921dab49b3be94931ad91b13054879aeab1866a591a9ad982ab17

See more details on using hashes here.

File details

Details for the file arctic-1.48.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for arctic-1.48.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b2541662f5a3f748f592c8b5f34b07a5144e113004e8949d02dac4c7e1d81a8a
MD5 44939073299078477c4252e7316b2242
BLAKE2b-256 c0e7a81b24b9a6f21183d6f1d9fbb3542622ef3dd7c7af827eeaaf1cbc83e008

See more details on using hashes here.

File details

Details for the file arctic-1.48.0-cp36-cp36m-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for arctic-1.48.0-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 20b33b4ef9f4a9cf405e188d83a1dc65def734bb519cd1ed6be431837a27b1a4
MD5 c4a6d1e8e4afad3b75cfc4f285d1d92f
BLAKE2b-256 a4d611c2fba094546b4df640a9af7685e0db887725b7ead7f99bd34175498da2

See more details on using hashes here.

File details

Details for the file arctic-1.48.0-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for arctic-1.48.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 6d7e899ca5d10bf36282c163d864844f61d292e1ec1e120af2cdc4808a2cd464
MD5 1437d24338db37b82e36b47559729529
BLAKE2b-256 7231325773e79f4336d1f13d92a0777ba4899e7fe3def8d2548405a7d49c0194

See more details on using hashes here.

File details

Details for the file arctic-1.48.0-cp35-cp35m-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for arctic-1.48.0-cp35-cp35m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 9df52e6489ddb89398b0c441bda997c6ea6723790e364dc70f56593296c1da0d
MD5 41ad4e1a958ce8136c0c47f16fc475c1
BLAKE2b-256 f5275ed88ad8656a9f592437897284378538dccc50b8f8321700fa5b35352b6f

See more details on using hashes here.

File details

Details for the file arctic-1.48.0-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for arctic-1.48.0-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ba4199799da339866db4a191bf6b736a1ffc0faa34a71ced18a1eaf0e7329754
MD5 748b0d540e1e38adf20271bb94065a31
BLAKE2b-256 04a3998c5ea7de85e747d199297b5691bc57f486d3b3a6450cc60ab3236af743

See more details on using hashes here.

File details

Details for the file arctic-1.48.0-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for arctic-1.48.0-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c7f88e5d3d8dc1d826db23b752beddacba0184c9b4772ce2f8742c7ecd57de08
MD5 d873cd0a67d8b350a51ad0be1b7726fa
BLAKE2b-256 495c34b6629178d07577931e4ec7a11083bbf96e6370d6196f6e4a29d8bbca32

See more details on using hashes here.

File details

Details for the file arctic-1.48.0-cp27-cp27m-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for arctic-1.48.0-cp27-cp27m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 6faad355607af58925db77dba69bd0d8719fc74c2fcfe6c0cd75188a95fc59b9
MD5 d96d630ee33cd2e259371ed1014898eb
BLAKE2b-256 c9de9545b6ac70e80c373c323b388cdbac3b88427415cdedd084881213c1e54e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page