This project is a secure charting interface that displays live updating prices of various assets using the Binance API. It includes Google authentication for logging in and features a responsive, interactive chart built with Highcharts, smooth price updates, and additional functionalities such as a watchlist and a paper trading interface.
- Secure authentication with Google.
- Real-time updating prices using Binance WebSocket API.
- Historical data fetched from Binance Historical API.
- Interactive line chart with smooth transitions.
- Customizable chart options (symbols, intervals).
- Watchlist management.
- Paper trading interface with buy/sell functionality.
- Responsive and visually appealing UI.
You can view a live demo of the application here.
- Frontend:
- Next.js
- TypeScript
- Highcharts
- TailwindCSS
- Backend:
- Next.js API Routes (preferred)
- Node.js in TypeScript
- Authentication:
- NextAuth.js with Google OAuth
- Deployment:
- Vercel
To set up the project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/Ayushsunny/chart.git cd your-repo-name
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env.local
file in the root directory and add the following environment variables:GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret
-
Run the development server:
npm run dev
The application will be available at
http://localhost:3000
.
Make sure to set up your Google OAuth credentials by creating a project on the Google Developer Console and obtaining the GOOGLE_CLIENT_ID
and GOOGLE_CLIENT_SECRET
. Add these to your .env.local
file.
-
Login: Open the application in your browser and log in using your Google account.
-
View Charts: Once logged in, you can view live updating price charts for different assets. Use the dropdown menus to change the asset symbol and time interval.
-
Manage Watchlist: Add or remove assets from your watchlist using the provided buttons.
-
Paper Trading: Use the paper trading interface to simulate buying and selling assets. Check your balance and holdings in the trading card.
src/
├── app/
│ ├── api/
│ │ └── auth/
│ │ └── [...nextauth]/
│ │ └── route.ts
│ ├── page.tsx
├── components/
│ ├── Chart/
│ │ └── chart.tsx
│ ├── Login/
│ │ └── login.tsx
│ ├── Logout/
│ │ └── logout.tsx
├── lib/
│ └── auth.ts
src/app/api/auth/[...nextauth]/route.ts
: Configures NextAuth for authentication.src/app/page.tsx
: The main page component handling login and chart display.src/components/Chart/chart.tsx
: The chart component with Highcharts and WebSocket integration.src/components/Login/login.tsx
: The login button component.src/components/Logout/logout.tsx
: The logout button component.src/lib/auth.ts
: Contains authentication options and configurations for NextAuth.