# rajkishore08/forex-trading-agent architecture

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

- Interactive diagram: https://gitdiagram.com/rajkishore08/forex-trading-agent
- Repository: https://github.com/rajkishore08/forex-trading-agent

## Overview

This repository combines a React trading dashboard and wallet setup with standalone Python/Node trading integrations. The visible frontend workflow is app entry → dashboard composition → market chart and wallet connection; the chart computes a prediction locally, while wallet connection can trigger Safe creation. README describes a broader analysis, execution, logging, and monitoring workflow, but the sampled code does not show those services wired into the frontend. Dashed links mark README-described or otherwise unverified integrations.

Main entry points: [`server.js`](https://github.com/rajkishore08/forex-trading-agent/blob/main/server.js) (Trade execution and logging), [`forex_trading_ai.py`](https://github.com/rajkishore08/forex-trading-agent/blob/main/forex_trading_ai.py) (Forex AI strategies), [`src/App.tsx`](https://github.com/rajkishore08/forex-trading-agent/blob/main/src/App.tsx) (Dashboard shell), [`src/components/TradingView.tsx`](https://github.com/rajkishore08/forex-trading-agent/blob/main/src/components/TradingView.tsx) (Trading view)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Dashboard"]
  node_entry["Frontend entry<br/>[main.tsx]"]
  node_app["Dashboard shell<br/>[App.tsx]"]
  node_trading["Trading view<br/>[TradingView.tsx]"]
  node_dashboard["Trade dashboard<br/>[Dashboard.js]"]
  node_tradingtypes["Trading types<br/>[trading.ts]"]
end

subgraph group_wallet["Wallet and execution"]
  node_walletconnect["Wallet connection UI<br/>[WalletConnect.tsx]"]
  node_celowallet["Celo wallet state<br/>[useCeloWallet.ts]"]
  node_safewallet["Safe wallet setup<br/>[useSafeWallet.ts]"]
  node_server["Trade execution and logging<br/>[server.js]"]
  node_contract["Trade contract<br/>[contracts.sol]"]
end

subgraph group_analysis["Market analysis"]
  node_prediction["Price prediction"]
  node_forexanalysis["Forex analysis"]
  node_forexai["Forex AI strategies"]
end

subgraph group_integrations["Trading integrations"]
  node_duckai["DuckAI insights"]
  node_mech["Mech strategy agent<br/>[mech_agent.py]"]
end

node_user(("Trader"))
node_celo{{"Celo network"}}
node_safe{{"Safe account"}}
node_forexservice{{"Forex rates API"}}
node_marketplace{{"Mech Marketplace"}}
node_ipfs[("Fileverse IPFS")]

node_user -->|"opens"| node_entry
node_entry -->|"renders"| node_app
node_app -->|"renders"| node_trading
node_app -->|"renders"| node_walletconnect
node_trading -->|"requests prediction"| node_prediction
node_trading -->|"uses types"| node_tradingtypes
node_walletconnect -->|"uses hook"| node_celowallet
node_walletconnect -->|"uses hook"| node_safewallet
node_celowallet -->|"uses state type"| node_tradingtypes
node_celowallet -->|"reads account balance"| node_celo
node_safewallet -->|"deploys account"| node_safe
node_forexanalysis -->|"fetches rates"| node_forexservice
node_server -->|"executes transaction"| node_safe
node_server -->|"stores trade log"| node_ipfs
node_mech -->|"registers and executes"| node_marketplace
node_forexanalysis -.->|"supplies analysis workflow"| node_forexai
node_forexai -.->|"informs trading insights"| node_duckai
node_forexai -.->|"drives trade execution"| node_server
node_server -.->|"uses trade contract"| node_contract
node_dashboard -.->|"shows trade history"| node_server
node_forexai -.->|"submits strategies"| node_mech

click node_entry "https://github.com/rajkishore08/forex-trading-agent/blob/main/src/main.tsx"
click node_app "https://github.com/rajkishore08/forex-trading-agent/blob/main/src/App.tsx"
click node_trading "https://github.com/rajkishore08/forex-trading-agent/blob/main/src/components/TradingView.tsx"
click node_dashboard "https://github.com/rajkishore08/forex-trading-agent/blob/main/src/components/Dashboard.js"
click node_prediction "https://github.com/rajkishore08/forex-trading-agent/blob/main/src/hooks/useAIPredictions.ts"
click node_tradingtypes "https://github.com/rajkishore08/forex-trading-agent/blob/main/src/types/trading.ts"
click node_walletconnect "https://github.com/rajkishore08/forex-trading-agent/blob/main/src/components/WalletConnect.tsx"
click node_celowallet "https://github.com/rajkishore08/forex-trading-agent/blob/main/src/hooks/useCeloWallet.ts"
click node_safewallet "https://github.com/rajkishore08/forex-trading-agent/blob/main/src/hooks/useSafeWallet.ts"
click node_server "https://github.com/rajkishore08/forex-trading-agent/blob/main/server.js"
click node_contract "https://github.com/rajkishore08/forex-trading-agent/blob/main/contracts.sol"
click node_forexanalysis "https://github.com/rajkishore08/forex-trading-agent/blob/main/src/ai_forex_analysis.py"
click node_forexai "https://github.com/rajkishore08/forex-trading-agent/blob/main/forex_trading_ai.py"
click node_duckai "https://github.com/rajkishore08/forex-trading-agent/blob/main/duckai_integration.py"
click node_mech "https://github.com/rajkishore08/forex-trading-agent/blob/main/mech_agent.py"

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_entry,node_app,node_trading,node_dashboard,node_tradingtypes toneBlue
class node_walletconnect,node_celowallet,node_safewallet,node_server,node_contract,node_ipfs toneAmber
class node_prediction,node_forexanalysis,node_forexai,node_forexservice toneMint
class node_duckai,node_mech toneRose
class node_user,node_celo,node_safe,node_marketplace toneIndigo
```

## Components

### Dashboard

- [Frontend entry](https://github.com/rajkishore08/forex-trading-agent/blob/main/src/main.tsx): `src/main.tsx`
- [Dashboard shell](https://github.com/rajkishore08/forex-trading-agent/blob/main/src/App.tsx): `src/App.tsx`
- [Trading view](https://github.com/rajkishore08/forex-trading-agent/blob/main/src/components/TradingView.tsx): `src/components/TradingView.tsx`
- [Trade dashboard](https://github.com/rajkishore08/forex-trading-agent/blob/main/src/components/Dashboard.js): `src/components/Dashboard.js`
- [Trading types](https://github.com/rajkishore08/forex-trading-agent/blob/main/src/types/trading.ts): `src/types/trading.ts`

### Wallet and execution

- [Wallet connection UI](https://github.com/rajkishore08/forex-trading-agent/blob/main/src/components/WalletConnect.tsx): `src/components/WalletConnect.tsx`
- [Celo wallet state](https://github.com/rajkishore08/forex-trading-agent/blob/main/src/hooks/useCeloWallet.ts): `src/hooks/useCeloWallet.ts`
- [Safe wallet setup](https://github.com/rajkishore08/forex-trading-agent/blob/main/src/hooks/useSafeWallet.ts): `src/hooks/useSafeWallet.ts`
- [Trade execution and logging](https://github.com/rajkishore08/forex-trading-agent/blob/main/server.js): `server.js`
- [Trade contract](https://github.com/rajkishore08/forex-trading-agent/blob/main/contracts.sol): `contracts.sol`

### Market analysis

- [Price prediction](https://github.com/rajkishore08/forex-trading-agent/blob/main/src/hooks/useAIPredictions.ts): `src/hooks/useAIPredictions.ts`
- [Forex analysis](https://github.com/rajkishore08/forex-trading-agent/blob/main/src/ai_forex_analysis.py): `src/ai_forex_analysis.py`
- [Forex AI strategies](https://github.com/rajkishore08/forex-trading-agent/blob/main/forex_trading_ai.py): `forex_trading_ai.py`

### Trading integrations

- [DuckAI insights](https://github.com/rajkishore08/forex-trading-agent/blob/main/duckai_integration.py): `duckai_integration.py`
- [Mech strategy agent](https://github.com/rajkishore08/forex-trading-agent/blob/main/mech_agent.py): `mech_agent.py`

### Other components

- **Trader**
- **Celo network**
- **Safe account**
- **Forex rates API**
- **Mech Marketplace**
- **Fileverse IPFS**

## Connections

- Trader → Frontend entry: opens (evidence: `src/main.tsx`)
- Frontend entry → Dashboard shell: renders (evidence: `src/main.tsx`)
- Dashboard shell → Trading view: renders (evidence: `src/App.tsx`)
- Dashboard shell → Wallet connection UI: renders (evidence: `src/App.tsx`)
- Trading view → Price prediction: requests prediction (evidence: `src/components/TradingView.tsx`)
- Trading view → Trading types: uses types (evidence: `src/components/TradingView.tsx`)
- Wallet connection UI → Celo wallet state: uses hook (evidence: `src/components/WalletConnect.tsx`)
- Wallet connection UI → Safe wallet setup: uses hook (evidence: `src/components/WalletConnect.tsx`)
- Celo wallet state → Trading types: uses state type (evidence: `src/hooks/useCeloWallet.ts`)
- Celo wallet state → Celo network: reads account balance (evidence: `src/hooks/useCeloWallet.ts`)
- Safe wallet setup → Safe account: deploys account (evidence: `src/hooks/useSafeWallet.ts`)
- Forex analysis → Forex rates API: fetches rates (evidence: `src/ai_forex_analysis.py`)
- Trade execution and logging → Safe account: executes transaction (evidence: `server.js`)
- Trade execution and logging → Fileverse IPFS: stores trade log (evidence: `server.js`)
- Mech strategy agent → Mech Marketplace: registers and executes (evidence: `mech_agent.py`)
- Forex analysis → Forex AI strategies: supplies analysis workflow
- Forex AI strategies → DuckAI insights: informs trading insights
- Forex AI strategies → Trade execution and logging: drives trade execution (evidence: `README.md`)
- Trade execution and logging → Trade contract: uses trade contract (evidence: `README.md`)
- Trade dashboard → Trade execution and logging: shows trade history (evidence: `README.md`)
- Forex AI strategies → Mech strategy agent: submits strategies (evidence: `README.md`)
