Documentation for python-stdnet's DEVELOPMENT version. Get the release docs here.
backends: Redis.
An application which implements a specialised remote stdnet.odm.Structure for managing numeric multivariate timeseries and perform remote analysis on them. The main classes for this application are ColumnTS, the stand alone data structure, and the correspondent ColumnTSField which can be used as a stdnet.odm.StructureField on a stdnet.odm.StdModel.
The API is straightforward:
from datetime import date
from stdnet.apps.columnts import ColumnTS
ts = ColumnTS(id='test')
ts.add(date(2012,2,21), {'open': 603.87, 'close': 614.00})
It can also be used as a datastructure fields. For example:
from stdnet import odm
from stdnet.apps.columnts import ColumnTSField
class Ticker(odm.StdModel):
code = odm.SymbolField()
data = ColumnTSField()
These two methods execute statistical analysis on the data stored in one ColumnTS. The ColumnTS.istats method performs analysis by selecting time range by rank, while ColumnTS.stats method performs analysis by selecting ranges by a start and an end date (or datetime).
A specialised stdnet.odm.TS structure for numeric multivariate timeseries.
Return the front pair of the structure
Return the back pair of the structure
Provide data information for this ColumnTS. If no parameters are specified it returns the number of data points for each fields, as well as the start and end date.
Number of fields.
Perform a multivariate statistic calculation of this ColumnTS from start to end.
Parameters: |
|
---|
Perform a multivariate statistic calculation of this ColumnTS from a start date/datetime to an end date/datetime.
Parameters: |
|
---|
Perform cross multivariate statistics calculation of this ColumnTS and other optional series from start to end.
Parameters: |
|
---|
Perform cross multivariate statistics calculation of this ColumnTS and other series.
Parameters: |
|
---|
Merge this ColumnTS with several other series.
Parameters series: | |
---|---|
a list of tuples where the nth element is a tuple of the form: (wight_n, ts_n1, ts_n2, ..., ts_nMn)
|
The result will be calculated using the formula:
ts = weight_1*ts_11*ts_12*...*ts_1M1 + weight_2*ts_21*ts_22*...*ts_2M2 +
...
Merge series and return the results without storing data in the backend server.
The implementation uses several redis structures for a given ColumnTS instance.
This composite data-structure looks and feels like a redis zset. However, the ordered set doesn’t actually store the data, it is there to maintain order and facilitate retrieval by times (scores) and rank.
For a given field, the data is stored in a sequence of 9-bytes string with the initial byte (byte0) indicating the type of data:
<byte0><byte1,...,byte8>