# sayan096767/daily-funded architecture

> Architecture diagram of the GitHub repository sayan096767/daily-funded, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sayan096767/daily-funded
- Repository: https://github.com/sayan096767/daily-funded

## Overview

This repository combines a funded-trading platform: a browser terminal for market viewing and order entry, a Cloudflare trading worker for market data and server-side execution/protection, a provider tick consumer, and a Python platform API for purchases, referrals, and administration. The principal trading path is provider ticks through the consumer to the worker; users interact with the terminal for charts and trading. The README is empty, so product capabilities are inferred from the tree and sampled code; backend details and several worker features are only partially sampled.

Main entry points: [`server-market-consumer/src/index.js`](https://github.com/sayan096767/daily-funded/blob/main/server-market-consumer/src/index.js) (Market tick consumer), [`backend/app.py`](https://github.com/sayan096767/daily-funded/blob/main/backend/app.py) (Platform API), [`DailyFundedTradingEngine/throbbing-bonus-6fed/src/index.flexible.js`](https://github.com/sayan096767/daily-funded/blob/main/DailyFundedTradingEngine/throbbing-bonus-6fed/src/index.flexible.js) (Trading worker), [`daily-funded-terminal/src/main.jsx`](https://github.com/sayan096767/daily-funded/blob/main/daily-funded-terminal/src/main.jsx) (Trading terminal UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_terminal["Trading terminal"]
  node_web_terminal["Trading terminal UI<br/>[main.jsx]"]
  node_supplied_terminal["Supplied terminal"]
  node_terminal_data["Terminal data normalization"]
  node_candle_history["Candle history<br/>[candleHistory.js]"]
  node_position_events["Position event helpers"]
end

subgraph group_market["Market and execution"]
  node_worker["Trading worker<br/>[index.flexible.js]"]
  node_protection["Position protection"]
  node_signalr_helper["SignalR feed client<br/>[biquoteSignalR.js]"]
  node_tick_consumer["Market tick consumer<br/>[index.js]"]
  node_tick_normalizer["Tick normalization<br/>[marketTick.js]"]
  node_tick_dispatcher["Tick dispatcher<br/>[tickDispatcher.js]"]
end

subgraph group_platform["Platform services"]
  node_platform_api["Platform API<br/>[app.py]"]
  node_coupon_config["Coupon configuration<br/>[coupon_config.py]"]
end

subgraph group_state["Persistent state"]
  node_firestore[("Firestore")]
  node_object_storage[("R2 object storage")]
  node_worker_store[("Worker persistence<br/>[schema.sql]")]
end

node_trader(("Trader"))
node_biquote{{"Biquote feed"}}
node_nowpayments{{"NOWPayments"}}

node_trader -->|"uses"| node_web_terminal
node_web_terminal -->|"loads history"| node_candle_history
node_web_terminal -->|"uses events"| node_position_events
node_supplied_terminal -->|"normalizes data"| node_terminal_data
node_tick_consumer -->|"normalizes ticks"| node_tick_normalizer
node_tick_consumer -->|"dispatches ticks"| node_tick_dispatcher
node_tick_dispatcher -->|"checks timestamps"| node_tick_normalizer
node_tick_consumer -->|"subscribes"| node_biquote
node_tick_consumer -->|"posts ticks"| node_worker
node_worker -->|"evaluates triggers"| node_protection
node_worker -->|"negotiates feed"| node_signalr_helper
node_worker -.->|"persists candles"| node_worker_store
node_platform_api -->|"imports config"| node_coupon_config
node_platform_api -.->|"reads and writes"| node_firestore
node_platform_api -.->|"uploads proof"| node_object_storage
node_platform_api -.->|"creates invoices"| node_nowpayments

click node_web_terminal "https://github.com/sayan096767/daily-funded/blob/main/daily-funded-terminal/src/main.jsx"
click node_supplied_terminal "https://github.com/sayan096767/daily-funded/blob/main/daily-funded-terminal/src/supplied-terminal.js"
click node_terminal_data "https://github.com/sayan096767/daily-funded/blob/main/daily-funded-terminal/src/suppliedTerminalData.js"
click node_candle_history "https://github.com/sayan096767/daily-funded/blob/main/daily-funded-terminal/src/candleHistory.js"
click node_position_events "https://github.com/sayan096767/daily-funded/blob/main/daily-funded-terminal/src/tradingPositionEvents.js"
click node_worker "https://github.com/sayan096767/daily-funded/blob/main/DailyFundedTradingEngine/throbbing-bonus-6fed/src/index.flexible.js"
click node_protection "https://github.com/sayan096767/daily-funded/blob/main/DailyFundedTradingEngine/throbbing-bonus-6fed/src/positionProtection.js"
click node_signalr_helper "https://github.com/sayan096767/daily-funded/blob/main/DailyFundedTradingEngine/throbbing-bonus-6fed/src/biquoteSignalR.js"
click node_tick_consumer "https://github.com/sayan096767/daily-funded/blob/main/server-market-consumer/src/index.js"
click node_tick_normalizer "https://github.com/sayan096767/daily-funded/blob/main/server-market-consumer/src/marketTick.js"
click node_tick_dispatcher "https://github.com/sayan096767/daily-funded/blob/main/server-market-consumer/src/tickDispatcher.js"
click node_platform_api "https://github.com/sayan096767/daily-funded/blob/main/backend/app.py"
click node_coupon_config "https://github.com/sayan096767/daily-funded/blob/main/backend/coupon_config.py"
click node_worker_store "https://github.com/sayan096767/daily-funded/blob/main/DailyFundedTradingEngine/throbbing-bonus-6fed/schema.sql"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_terminal,node_supplied_terminal,node_terminal_data,node_candle_history,node_position_events toneBlue
class node_worker,node_protection,node_signalr_helper,node_tick_consumer,node_tick_normalizer,node_tick_dispatcher toneAmber
class node_platform_api,node_coupon_config toneMint
class node_firestore,node_object_storage,node_worker_store toneRose
class node_trader,node_biquote,node_nowpayments toneIndigo
```

## Components

### Trading terminal

- [Trading terminal UI](https://github.com/sayan096767/daily-funded/blob/main/daily-funded-terminal/src/main.jsx): `daily-funded-terminal/src/main.jsx`
- [Supplied terminal](https://github.com/sayan096767/daily-funded/blob/main/daily-funded-terminal/src/supplied-terminal.js): `daily-funded-terminal/src/supplied-terminal.js`
- [Terminal data normalization](https://github.com/sayan096767/daily-funded/blob/main/daily-funded-terminal/src/suppliedTerminalData.js): `daily-funded-terminal/src/suppliedTerminalData.js`
- [Candle history](https://github.com/sayan096767/daily-funded/blob/main/daily-funded-terminal/src/candleHistory.js): `daily-funded-terminal/src/candleHistory.js`
- [Position event helpers](https://github.com/sayan096767/daily-funded/blob/main/daily-funded-terminal/src/tradingPositionEvents.js): `daily-funded-terminal/src/tradingPositionEvents.js`

### Market and execution

- [Trading worker](https://github.com/sayan096767/daily-funded/blob/main/DailyFundedTradingEngine/throbbing-bonus-6fed/src/index.flexible.js): `DailyFundedTradingEngine/throbbing-bonus-6fed/src/index.flexible.js`
- [Position protection](https://github.com/sayan096767/daily-funded/blob/main/DailyFundedTradingEngine/throbbing-bonus-6fed/src/positionProtection.js): `DailyFundedTradingEngine/throbbing-bonus-6fed/src/positionProtection.js`
- [SignalR feed client](https://github.com/sayan096767/daily-funded/blob/main/DailyFundedTradingEngine/throbbing-bonus-6fed/src/biquoteSignalR.js): `DailyFundedTradingEngine/throbbing-bonus-6fed/src/biquoteSignalR.js`
- [Market tick consumer](https://github.com/sayan096767/daily-funded/blob/main/server-market-consumer/src/index.js): `server-market-consumer/src/index.js`
- [Tick normalization](https://github.com/sayan096767/daily-funded/blob/main/server-market-consumer/src/marketTick.js): `server-market-consumer/src/marketTick.js`
- [Tick dispatcher](https://github.com/sayan096767/daily-funded/blob/main/server-market-consumer/src/tickDispatcher.js): `server-market-consumer/src/tickDispatcher.js`

### Platform services

- [Platform API](https://github.com/sayan096767/daily-funded/blob/main/backend/app.py): `backend/app.py`
- [Coupon configuration](https://github.com/sayan096767/daily-funded/blob/main/backend/coupon_config.py): `backend/coupon_config.py`

### Persistent state

- **Firestore**
- **R2 object storage**
- [Worker persistence](https://github.com/sayan096767/daily-funded/blob/main/DailyFundedTradingEngine/throbbing-bonus-6fed/schema.sql): `DailyFundedTradingEngine/throbbing-bonus-6fed/schema.sql`

### Other components

- **Trader**
- **Biquote feed**
- **NOWPayments**

## Connections

- Trader → Trading terminal UI: uses
- Trading terminal UI → Candle history: loads history (evidence: `daily-funded-terminal/src/main.jsx`)
- Trading terminal UI → Position event helpers: uses events (evidence: `daily-funded-terminal/src/main.jsx`)
- Supplied terminal → Terminal data normalization: normalizes data (evidence: `daily-funded-terminal/src/supplied-terminal.js`)
- Market tick consumer → Tick normalization: normalizes ticks (evidence: `server-market-consumer/src/index.js`)
- Market tick consumer → Tick dispatcher: dispatches ticks (evidence: `server-market-consumer/src/index.js`)
- Tick dispatcher → Tick normalization: checks timestamps (evidence: `server-market-consumer/src/tickDispatcher.js`)
- Market tick consumer → Biquote feed: subscribes (evidence: `server-market-consumer/src/index.js`)
- Market tick consumer → Trading worker: posts ticks (evidence: `server-market-consumer/src/index.js`)
- Trading worker → Position protection: evaluates triggers (evidence: `DailyFundedTradingEngine/throbbing-bonus-6fed/src/index.flexible.js`)
- Trading worker → SignalR feed client: negotiates feed (evidence: `DailyFundedTradingEngine/throbbing-bonus-6fed/src/index.flexible.js`)
- Trading worker → Worker persistence: persists candles
- Platform API → Coupon configuration: imports config (evidence: `backend/app.py`)
- Platform API → Firestore: reads and writes
- Platform API → R2 object storage: uploads proof
- Platform API → NOWPayments: creates invoices
