Skip to content

Commit 7a61561

Browse files
authored
Merge pull request #72 from quiknode-labs/con-239-guideapp-idea-analyzing-wallet-trade-performance-and
2 parents 62ed005 + a7b1437 commit 7a61561

27 files changed

+1006
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_QUICKNODE_ENDPOINT = "YOUR_QUICKNODE_ETHEREUM_ENDPOINT_URL"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
.env
15+
16+
# Editor directories and files
17+
.vscode/*
18+
!.vscode/extensions.json
19+
.idea
20+
.DS_Store
21+
*.suo
22+
*.ntvs*
23+
*.njsproj
24+
*.sln
25+
*.sw?
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# DEX Trade Performance Analyzer
2+
3+
## Introduction
4+
5+
This application is designed to analyze the trading performance of a crypto wallet, leveraging the capabilities of Syve's [DEX Price Data & Wallet Tracking APIs](https://marketplace.quicknode.com/add-on/syve-dex-price-data-and-wallet-tracking-api). The primary focus of this application is to provide users with detailed insights into wallet trading activities, including profit and loss metrics for each traded token.
6+
7+
For an in-depth guide on how to fetch data and develop further functionalities, refer to [our comprehensive guide on QuickNode](https://www.quicknode.com/guides/quicknode-products/marketplace/how-to-track-dex-wallet-trading-performance).
8+
9+
### Tech Stack
10+
11+
- Frontend Framework/Library: React
12+
- Language: TypeScript
13+
- Build Tool/Development Server: Vite
14+
- Styling: Tailwind CSS
15+
16+
## Features
17+
18+
- **Overall Wallet Performance**: Displays total profit and loss, win rate, and other key metrics using Syve's Wallet Tracking API.
19+
- **Token-Specific Performance**: Provides detailed trading metrics for each token held in the wallet.
20+
21+
## Getting Started
22+
23+
### Prerequisites
24+
25+
Before you begin, ensure you have the following:
26+
27+
- [Node.js](https://nodejs.org/en/) installed on your system.
28+
- A QuickNode account with the [DEX Price Data & Wallet Tracking APIs](https://marketplace.quicknode.com/add-on/syve-dex-price-data-and-wallet-tracking-api) enabled.
29+
- A code editor or an IDE (e.g., [VS Code](https://code.visualstudio.com/))
30+
- [TypeScript](https://www.typescriptlang.org/) and [ts-node](https://typestrong.org/ts-node/)
31+
32+
> You can run the commands below to install TypeScript and ts-node globally to have TypeScript available across all projects.
33+
34+
```bash
35+
npm install -g typescript ts-node
36+
```
37+
38+
### Installation Dependencies
39+
40+
1. Clone the repository to your local machine:
41+
42+
```bash
43+
git clone https://github.com/quiknode-labs/qn-guide-examples.git
44+
```
45+
46+
2. Navigate to the project directory:
47+
48+
```bash
49+
cd sample-dapps/ethereum-dex-trade-performance-analyzer
50+
```
51+
52+
3. Install the necessary dependencies:
53+
54+
```bash
55+
npm install
56+
```
57+
58+
### Setting Environment Variables
59+
60+
Rename `.env.example` to `.env` and replace the `YOUR_QUICKNODE_ENDPOINT_URL` placeholder with your QuickNode Ethereum Node Endpoint. Make sure that the [DEX Price Data & Wallet Tracking APIs](https://marketplace.quicknode.com/add-on/syve-dex-price-data-and-wallet-tracking-api) are enabled.
61+
62+
```env
63+
VITE_QUICKNODE_ENDPOINT="YOUR_QUICKNODE_ENDPOINT_URL"
64+
```
65+
66+
> Please note that while we utilize `dotenv` for environment variable management, sensitive information like endpoints can still be visible on the frontend. This configuration is not recommended for production environments as-is.
67+
68+
### Running the Application
69+
70+
Run the development server:
71+
72+
```bash
73+
npm run dev
74+
```
75+
76+
Open [http://localhost:5173/](http://localhost:5173/) with your browser to see the application.
77+
78+
## Using the App
79+
80+
1. Input a wallet address.
81+
2. Press **Analyze Wallet**.
82+
3. View the overall and token-specific trading performance.
83+
84+
The **Wallet Performance Analyzer** will fetch the data using Syve's Wallet Tracking APIs, and display the results.
85+
86+
Overall Performance | Token Specific Performance
87+
:-------------------------:|:-------------------------:
88+
![App Overall Performance](public/app-overview.png) | ![App Token Specific Performance](public/app-token-details.png)
89+
90+
## Conclusion
91+
92+
Syve's [DEX Price Data & Wallet Tracking APIs](https://marketplace.quicknode.com/add-on/syve-dex-price-data-and-wallet-tracking-api) provide developers with powerful tools for analyzing wallet trading activities. By leveraging these APIs, developers can create applications that deliver valuable insights into crypto trading performance.
93+
94+
[QuickNode](https://quicknode.com/) offers many different marketplace add-ons, providing developers with the resources needed to create robust and feature-rich crypto applications. To learn more about how these APIs and other QuickNode add-ons can benefit your projects, please [contact us](https://www.quicknode.com/contact-us); we're eager to assist you!
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import reactHooks from 'eslint-plugin-react-hooks'
4+
import reactRefresh from 'eslint-plugin-react-refresh'
5+
import tseslint from 'typescript-eslint'
6+
7+
export default tseslint.config({
8+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
9+
files: ['**/*.{ts,tsx}'],
10+
ignores: ['dist'],
11+
languageOptions: {
12+
ecmaVersion: 2020,
13+
globals: globals.browser,
14+
},
15+
plugins: {
16+
'react-hooks': reactHooks,
17+
'react-refresh': reactRefresh,
18+
},
19+
rules: {
20+
...reactHooks.configs.recommended.rules,
21+
'react-refresh/only-export-components': [
22+
'warn',
23+
{ allowConstantExport: true },
24+
],
25+
},
26+
})
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>DEX Trade Performance Analyzer</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "dex-trade-analyzer",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc -b && vite build",
9+
"lint": "eslint .",
10+
"preview": "vite preview"
11+
},
12+
"dependencies": {
13+
"@quicknode/sdk": "^2.3.0",
14+
"dotenv": "^16.4.5",
15+
"react": "^18.3.1",
16+
"react-dom": "^18.3.1"
17+
},
18+
"devDependencies": {
19+
"@eslint/js": "^9.8.0",
20+
"@types/react": "^18.3.3",
21+
"@types/react-dom": "^18.3.0",
22+
"@vitejs/plugin-react": "^4.3.1",
23+
"autoprefixer": "^10.4.20",
24+
"axios": "^1.7.3",
25+
"eslint": "^9.8.0",
26+
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
27+
"eslint-plugin-react-refresh": "^0.4.9",
28+
"npm": "^10.8.2",
29+
"postcss": "^8.4.41",
30+
"tailwindcss": "^3.4.9",
31+
"typescript": "^5.5.3",
32+
"typescript-eslint": "^8.0.0",
33+
"vite": "^5.4.0"
34+
}
35+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}
Loading
Loading
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)