RedisTimeSeries / NRedisTimeSeries

.Net Client for RedisTimeSeries
https://redistimeseries.io
BSD 3-Clause "New" or "Revised" License
28 stars 11 forks source link

How to store/retrieve multivariate time series #77

Open giangcoi48k opened 2 years ago

giangcoi48k commented 2 years ago

I have a stock price model, with multiple field-value, like this:

public class IndexSeries
{ 
    public int IndexId {get;set;}
    public long TradingDate {get;set;}  //Unix Epoch milliseconds
    public decimal OpenIndex { get; set; }
    public decimal CloseIndex { get; set; }
    public decimal HighestIndex { get; set; }
    public decimal LowestIndex { get; set; }
    public long TotalMatchVolume { get; set; } 
    public long MatchValue { get; set; }
    public long MatchVolume { get; set; }    
        ...  
}

Data is received with high frequency (at least one second), and I want to use RedisTimeSeries to store/retrieve. How can I do this?

LiorKogan commented 2 years ago

Each time series in RedisTimeSeries can store a single metric. However, you can create multiple time series, each with a different metric.

Hence, in your example, for each stock - you should create 7 time series.

You can also set series metadata for each series (e.g., stock = 1234, datatype = openIndex). You can then aggregate over multiple time series (e.g., over all time series with datatype = openIndex).