# hakandinger/rsical architecture

> Architecture diagram of the GitHub repository hakandinger/rsical, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hakandinger/rsical
- Repository: https://github.com/hakandinger/rsical

## Overview

##### Project type and purpose
- This is a small open-source C# library/tool that calculates the Exponential Moving Average (EMA)-based Relative Strength Index (RSI) for Binance Kline data.
- It is designed to be integrated into trading bots or data-analysis workflows.

##### File structure
- Top-level:
- LICENSE
- README.md
- RSICalculator.cs
- No frontend or database layers—this is a single-module library.
- RSICalculator.cs holds both the Binance data fetch logic (via Binance.Net) and the RSI computation.

##### README for additional insights
- Uses Binance.Net to fetch historical Kline (candlestick) data from Binance’s REST API.
- Exposes a configurable RSI period.
- Intended integration points are trading bots or other C# applications.

##### Main components
a. External Binance REST API
b. Binance.Net .NET client library (wrapper)
c. RSI Calculation Module (this project’s core in RSICalculator.cs)
d. Consumer Application (e.g., trading bot)

##### Relationships and interactions
1. Consumer Application calls into the RSI Calculation Module.
2. RSI Module uses the Binance.Net client to request Kline data from the Binance REST API.
3. Binance.Net client issues HTTP(S) requests to Binance and parses JSON responses.
4. RSI Module applies EMA logic on the Kline data to compute the RSI series.
5. Computed RSI values are returned to the Consumer Application.

##### Key architectural patterns and design principles
- Single-responsibility: data fetching vs. computation.
- Dependency inversion: consumer depends on an interface/abstraction of the RSI module.
- Extensibility: configurable RSI period and pluggable data sources.

##### Technologies, frameworks, and libraries
- .NET/C# runtime
- Binance.Net (NuGet package) for API access
- System.Net.Http under the hood
- LINQ/collections for EMA calculation

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Components
    ConsumerApp["Consumer Application"]:::internal
    RSIModule["RSI Calculation Module\n(configurable period)"]:::internal
    BinanceNetClient["Binance.Net Client\n(Third-party Library)"]:::thirdparty
    BinanceAPI["Binance REST API"]:::external
    README["Project Documentation"]:::internal
    LICENSE["License File"]:::internal

    %% Data Flows
    ConsumerApp -->|"requests RSI"| RSIModule
    RSIModule -->|"invokes Get Klines"| BinanceNetClient
    BinanceNetClient -->|"HTTP GET Klines"| BinanceAPI
    BinanceAPI -->|"responds with JSON"| BinanceNetClient
    BinanceNetClient -->|"parses JSON"| RSIModule
    RSIModule -->|"computes RSI"| ConsumerApp

    %% Documentation Links
    ConsumerApp --> README
    ConsumerApp --> LICENSE

    %% Click Events
    click RSIModule "https://github.com/hakandinger/rsical/blob/main/RSICalculator.cs"
    click README "https://github.com/hakandinger/rsical/blob/main/README.md"
    click LICENSE "https://github.com/hakandinger/rsical/tree/main/LICENSE"

    %% Styles
    classDef internal fill:#AED6F1,stroke:#2980B9,color:#1B2631;
    classDef thirdparty fill:#ABEBC6,stroke:#27AE60,color:#1B2631;
    classDef external fill:#FAD7A0,stroke:#E67E22,color:#1B2631;
```
