Temporal Similarity Search for Pattern Matching and Outliers in kdb+ 

GitHub Repo


This notebook showcases how to use Temporal Similarity Search (TSS) for advanced pattern matching and outlier detection on stock price data within a kdb+ Historical Database (HDB). By running TSS directly on your data in kdb+, you can efficiently identify patterns and detect anomalies without migrating data or generating embeddings. 

With seamless integration into your kdb+ environment, this workflow takes advantage of high-performance time-series capabilities to enhance stock price analysis. 

Agenda: 

  • Dependencies, Imports & Setup 
  • Start KDB.AI Session 
  • Perform temporal similarity searches on stock price data 
  • Execute outlier detection to spot unusual price movements 
table.search( 
      {"price":patterns()}, 
      type="tss", 
      n=5,	 
      filter=[("=","sym","AAPL")], 
      options=dict(force=True,returnMatches=True)) 

Let’s dive in and leverage kdb+ and KDB.AI to optimize your stock price analysis! Check out the notebook on GitHub