DEV Community

Cover image for DataPatternX: Candlestick Pattern Analysis Starter Kit
Mohammad Sarabi
Mohammad Sarabi

Posted on • Edited on

DataPatternX: Candlestick Pattern Analysis Starter Kit

This is a submission for the Neon Open Source Starter Kit Challenge : Ultimate Starter Kit

My Kit: DataPatternX

Introducing DataPatternX, a versatile and powerful starter kit designed to simplify candlestick pattern detection and data visualization in financial datasets. Whether you're a seasoned data analyst or just getting started with market analysis, DataPatternX offers a streamlined, modular approach to identifying key market patterns using PostgreSQL and Python.

Project Overview

DataPatternX is structured to ensure ease of use and scalability. The project is organized into key modules:

DataPatternX/
│
├── .env                  # Environment variables
├── requirements.txt      # Python dependencies
├── README.md             # Project documentation
├── DataPatternX.py       # Entry point for running your project
├── .gitignore            # Git ignore file
├── LICENSE               # License information
│
├── config/               # Configuration settings
│   └── config.py
│
├── db/                   # Database connection and query execution
│   ├── connection.py
│   └── queries.py
│
├── pattern_query/        # SQL queries for pattern detection
│   ├── patterns.py
│   └── sql_files/
│       ├── engulfing_bearish.sql
│       ├── engulfing_bullish.sql
│       ...
│
└── plotter/              # Plotting functions and classes
    └── plot_chart.py
Enter fullscreen mode Exit fullscreen mode
  • DataPatternX is structured to ensure ease of use and scalability. The project is organized into key modules:
  • Configuration (config/): Manage your environment variables and settings efficiently.
  • Database Operations (db/): Seamlessly connect to your PostgreSQL database and execute pattern detection queries.
  • Pattern Queries (pattern_query/): Leverage SQL files to detect various candlestick patterns like engulfing, morning star, and more.
  • Visualization (plotter/): Generate dynamic and insightful candlestick charts using Plotly, complete with markers highlighting detected patterns.
  • Main Script (DataPatternX.py): The entry point for running your project, with options for querying patterns, saving results, and plotting charts.

Key Features

  • Pattern Detection: Supports a variety of candlestick patterns with customizable SQL queries.
  • Database Flexibility: Easily connect to any PostgreSQL database.
  • Data Visualization: Create detailed candlestick charts with pattern markers.
  • Modular Design: Each component is designed to be reusable and extendable. Example usage:
  py DataPatternX.py -t ohlc_data Hammer Engulfing_bullish --plot --save patterns.csv
Enter fullscreen mode Exit fullscreen mode

Link to Kit

You can find the full project on GitHub: DataPatternX. The repository includes a comprehensive README with setup instructions, making it easy to get started.

GitHub logo m-sarabi / DataPatternX

DataPatternX is a starter kit for seamless data pattern analysis. It connects to a PostgreSQL database (e.g., Neon Serverless Postgres), retrieves complex data patterns, and plots charts. The kit includes modules for database connection, query execution, chart plotting, and easy CLI tools for efficient interaction.

DataPatternX

Overview

This starter kit is designed to help you quickly set up a project that connects to a database retrieves candlestick pattern data using complex queries, manages pattern files, and plots charts. The project is modular and easy to extend, making it suitable for various applications.

Features

  • Database Connection: Easy database connection using db/connection.py.
  • Data Retrieval: Retrieves data patterns from the database using complex SQL queries defined in db/queries.py.
  • Chart Plotting: Plots charts using the data retrieved, implemented in plotter/plot_chart.py.
  • Main Integration: Orchestrates all components in DataPatternX.py.

Getting Started

Prerequisites

  • Python 3.x (tested with Python 3.12)
  • PostgreSQL (or a serverless option such as Neon Serverless PostgreSQL)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/starter-kit.git
    cd starter-kit
    Enter fullscreen mode Exit fullscreen mode
  2. Install the required Python packages:

    pip install -r requirements.txt
    Enter fullscreen mode Exit fullscreen mode
  3. Set up your database. You can use a local SQL instance or a serverless option like Neon Serverless PostgreSQL.

Configuration

To…

My Journey

While working on DataPatternX, I aimed to create a tool that would not only simplify pattern detection but also make the process more intuitive for users. The choice of PostgreSQL, especially with the flexibility offered by modern solutions like Neon’s serverless Postgres, was driven by its robust support for window functions, essential for the accurate detection of patterns in time series data. Python, with its rich ecosystem of data libraries, complemented this by providing the tools necessary for analysis and visualization.

However, my journey with this project took an unexpected turn. Despite my enthusiasm as an Iranian developer to participate in the Neon Open Source Starter Kit Challenge, I discovered that I was ineligible due to my nationality. Although this was disheartening, I chose to complete and share the project regardless. The experience was rewarding, and I hope it serves as a valuable resource for the community.

Conclusion

Building DataPatternX allowed me to explore the intersection of financial data analysis and open-source development, pushing the boundaries of what I could achieve despite the challenges. I invite you to check out the project, write your thoughts, and explore what it has to offer.

Your feedback is highly valued

Top comments (2)

Collapse
 
annavi11arrea1 profile image
Anna Villarreal

Happy you did it anyways! Great job.

Collapse
 
msarabi profile image
Mohammad Sarabi

Thanks ✌️