Add files via upload
Browse files- app.cpython-313.pyc +0 -0
- backend_wallet_api.py +137 -0
- backtest_lstm.py +93 -0
- intraday_model.cpython-313.pyc +0 -0
- model.cpython-313.pyc +0 -0
- sentiment.cpython-313.pyc +0 -0
- stock_data.cpython-313.pyc +0 -0
- trader.cpython-313.pyc +0 -0
- wallet-styles.css +363 -0
- wallet.html +90 -0
app.cpython-313.pyc
ADDED
|
Binary file (27.5 kB). View file
|
|
|
backend_wallet_api.py
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Add these endpoints to your FastAPI backend (main.py or similar)
|
| 2 |
+
|
| 3 |
+
from fastapi import FastAPI, HTTPException
|
| 4 |
+
from pydantic import BaseModel
|
| 5 |
+
from typing import Optional
|
| 6 |
+
import time
|
| 7 |
+
|
| 8 |
+
app = FastAPI()
|
| 9 |
+
|
| 10 |
+
# In-memory wallet balance (replace with database in production)
|
| 11 |
+
wallet_data = {
|
| 12 |
+
"balance": 10000.00,
|
| 13 |
+
"transactions": []
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
class AddMoneyRequest(BaseModel):
|
| 17 |
+
payment_id: str
|
| 18 |
+
amount: float
|
| 19 |
+
|
| 20 |
+
class WithdrawRequest(BaseModel):
|
| 21 |
+
amount: float
|
| 22 |
+
|
| 23 |
+
@app.get("/api/wallet/balance")
|
| 24 |
+
async def get_wallet_balance():
|
| 25 |
+
"""Get current wallet balance"""
|
| 26 |
+
return {
|
| 27 |
+
"balance": wallet_data["balance"],
|
| 28 |
+
"status": "success"
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
@app.post("/api/wallet/add")
|
| 32 |
+
async def add_money(request: AddMoneyRequest):
|
| 33 |
+
"""
|
| 34 |
+
Add money to wallet after successful Razorpay payment
|
| 35 |
+
|
| 36 |
+
In production, you should:
|
| 37 |
+
1. Verify the payment with Razorpay API using payment_id
|
| 38 |
+
2. Check payment status and amount
|
| 39 |
+
3. Store transaction in database
|
| 40 |
+
"""
|
| 41 |
+
|
| 42 |
+
# TODO: Verify payment with Razorpay
|
| 43 |
+
# For now, we'll trust the frontend (NOT recommended for production)
|
| 44 |
+
|
| 45 |
+
if request.amount <= 0:
|
| 46 |
+
raise HTTPException(status_code=400, detail="Invalid amount")
|
| 47 |
+
|
| 48 |
+
# Add money to wallet
|
| 49 |
+
wallet_data["balance"] += request.amount
|
| 50 |
+
|
| 51 |
+
# Store transaction
|
| 52 |
+
transaction = {
|
| 53 |
+
"type": "credit",
|
| 54 |
+
"amount": request.amount,
|
| 55 |
+
"payment_id": request.payment_id,
|
| 56 |
+
"timestamp": time.time(),
|
| 57 |
+
"status": "success"
|
| 58 |
+
}
|
| 59 |
+
wallet_data["transactions"].append(transaction)
|
| 60 |
+
|
| 61 |
+
return {
|
| 62 |
+
"status": "success",
|
| 63 |
+
"message": f"₹{request.amount} added successfully",
|
| 64 |
+
"new_balance": wallet_data["balance"],
|
| 65 |
+
"transaction": transaction
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
@app.post("/api/wallet/withdraw")
|
| 69 |
+
async def withdraw_money(request: WithdrawRequest):
|
| 70 |
+
"""
|
| 71 |
+
Withdraw money from wallet
|
| 72 |
+
|
| 73 |
+
In production, you should:
|
| 74 |
+
1. Verify user authentication
|
| 75 |
+
2. Check withdrawal limits
|
| 76 |
+
3. Process actual bank transfer
|
| 77 |
+
4. Store transaction in database
|
| 78 |
+
"""
|
| 79 |
+
|
| 80 |
+
if request.amount <= 0:
|
| 81 |
+
raise HTTPException(status_code=400, detail="Invalid amount")
|
| 82 |
+
|
| 83 |
+
# Check sufficient balance
|
| 84 |
+
if wallet_data["balance"] < request.amount:
|
| 85 |
+
raise HTTPException(status_code=400, detail="Insufficient balance")
|
| 86 |
+
|
| 87 |
+
# Deduct money from wallet
|
| 88 |
+
wallet_data["balance"] -= request.amount
|
| 89 |
+
|
| 90 |
+
# Store transaction
|
| 91 |
+
transaction = {
|
| 92 |
+
"type": "debit",
|
| 93 |
+
"amount": request.amount,
|
| 94 |
+
"timestamp": time.time(),
|
| 95 |
+
"status": "success"
|
| 96 |
+
}
|
| 97 |
+
wallet_data["transactions"].append(transaction)
|
| 98 |
+
|
| 99 |
+
return {
|
| 100 |
+
"status": "success",
|
| 101 |
+
"message": f"₹{request.amount} withdrawn successfully",
|
| 102 |
+
"new_balance": wallet_data["balance"],
|
| 103 |
+
"transaction": transaction
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
@app.get("/api/wallet/transactions")
|
| 107 |
+
async def get_transactions():
|
| 108 |
+
"""Get all wallet transactions"""
|
| 109 |
+
return {
|
| 110 |
+
"transactions": wallet_data["transactions"],
|
| 111 |
+
"status": "success"
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
# Example of how to verify Razorpay payment (add this to your add_money endpoint)
|
| 115 |
+
"""
|
| 116 |
+
import razorpay
|
| 117 |
+
|
| 118 |
+
razorpay_client = razorpay.Client(auth=("YOUR_KEY_ID", "YOUR_KEY_SECRET"))
|
| 119 |
+
|
| 120 |
+
def verify_razorpay_payment(payment_id: str, amount: float):
|
| 121 |
+
try:
|
| 122 |
+
# Fetch payment details
|
| 123 |
+
payment = razorpay_client.payment.fetch(payment_id)
|
| 124 |
+
|
| 125 |
+
# Verify payment status
|
| 126 |
+
if payment['status'] != 'captured':
|
| 127 |
+
return False
|
| 128 |
+
|
| 129 |
+
# Verify amount (Razorpay stores in paise)
|
| 130 |
+
if payment['amount'] != int(amount * 100):
|
| 131 |
+
return False
|
| 132 |
+
|
| 133 |
+
return True
|
| 134 |
+
except Exception as e:
|
| 135 |
+
print(f"Payment verification failed: {e}")
|
| 136 |
+
return False
|
| 137 |
+
"""
|
backtest_lstm.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import os
|
| 3 |
+
import sys
|
| 4 |
+
import pandas as pd
|
| 5 |
+
import numpy as np
|
| 6 |
+
import random
|
| 7 |
+
from datetime import datetime, timedelta
|
| 8 |
+
# Add backend directory to sys.path for imports
|
| 9 |
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 10 |
+
from stock_data import fetch_stock_data, add_technical_indicators
|
| 11 |
+
from model import train_and_predict
|
| 12 |
+
|
| 13 |
+
def evaluate_prediction_accuracy(ticker, start_date, end_date, lookahead_days=5):
|
| 14 |
+
"""
|
| 15 |
+
For a given ticker and date range, run the LSTM model as if in the past, then compare its 5-day forecast to actual closes.
|
| 16 |
+
Returns a DataFrame with prediction, actual, and error for each window.
|
| 17 |
+
"""
|
| 18 |
+
df = fetch_stock_data(ticker)
|
| 19 |
+
df = add_technical_indicators(df)
|
| 20 |
+
df = df[(df['Date'] >= start_date) & (df['Date'] <= end_date)].reset_index(drop=True)
|
| 21 |
+
results = []
|
| 22 |
+
for i in range(len(df) - 60 - lookahead_days):
|
| 23 |
+
window = df.iloc[i:i+60+lookahead_days]
|
| 24 |
+
hist = window.iloc[:60]
|
| 25 |
+
future = window.iloc[60:60+lookahead_days]
|
| 26 |
+
# Skip if not enough future data or if hist is too short after dropna
|
| 27 |
+
if len(future) < lookahead_days or len(hist.dropna()) < 60:
|
| 28 |
+
continue
|
| 29 |
+
try:
|
| 30 |
+
pred = train_and_predict(hist)
|
| 31 |
+
pred_prices = pred['predicted_prices']
|
| 32 |
+
actual_prices = future['Close'].values.tolist()
|
| 33 |
+
errors = [abs(p - a) for p, a in zip(pred_prices, actual_prices)]
|
| 34 |
+
results.append({
|
| 35 |
+
'date': hist.iloc[-1]['Date'],
|
| 36 |
+
'predicted': pred_prices,
|
| 37 |
+
'actual': actual_prices,
|
| 38 |
+
'mae': np.mean(errors),
|
| 39 |
+
'mse': np.mean([(p-a)**2 for p,a in zip(pred_prices, actual_prices)]),
|
| 40 |
+
})
|
| 41 |
+
except Exception as e:
|
| 42 |
+
print(f"Skipping window at {hist.iloc[-1]['Date']} due to error: {e}")
|
| 43 |
+
continue
|
| 44 |
+
return pd.DataFrame(results)
|
| 45 |
+
|
| 46 |
+
if __name__ == "__main__":
|
| 47 |
+
ticker = input("Enter IPO stock ticker (e.g. RELIANCE.NS): ").strip()
|
| 48 |
+
# Fetch all available data for the ticker (max 2 years)
|
| 49 |
+
df_all = fetch_stock_data(ticker, period="2y", interval="1d")
|
| 50 |
+
df_all = add_technical_indicators(df_all)
|
| 51 |
+
if len(df_all) < 70:
|
| 52 |
+
print("Not enough data for backtest (need at least 70 days). Exiting.")
|
| 53 |
+
sys.exit(1)
|
| 54 |
+
# Find all valid window start indices (where 60-row history and 5-row future have no NaNs)
|
| 55 |
+
valid_starts = []
|
| 56 |
+
for i in range(len(df_all) - 65):
|
| 57 |
+
hist = df_all.iloc[i:i+60]
|
| 58 |
+
future = df_all.iloc[i+60:i+65]
|
| 59 |
+
if len(hist.dropna()) == 60 and len(future.dropna()) == 5:
|
| 60 |
+
valid_starts.append(i)
|
| 61 |
+
if not valid_starts:
|
| 62 |
+
print("No valid windows found in the last 2 years for this stock.")
|
| 63 |
+
sys.exit(1)
|
| 64 |
+
# Pick a random valid window
|
| 65 |
+
start_idx = random.choice(valid_starts)
|
| 66 |
+
# Pick a random end index at least 65 days ahead, but not more than 120 days or end of data
|
| 67 |
+
max_end = min(start_idx + 120, len(df_all) - 1)
|
| 68 |
+
end_idx = random.randint(start_idx + 65, max_end)
|
| 69 |
+
start_date = str(df_all.iloc[start_idx]['Date'])[:10]
|
| 70 |
+
end_date = str(df_all.iloc[end_idx]['Date'])[:10]
|
| 71 |
+
print(f"Randomly selected date range: {start_date} to {end_date}")
|
| 72 |
+
df = evaluate_prediction_accuracy(ticker, start_date, end_date)
|
| 73 |
+
if df.empty:
|
| 74 |
+
print("No valid prediction windows found in this range.")
|
| 75 |
+
# Try to print the last available predicted and actual price if possible
|
| 76 |
+
# Use the last 60 rows for prediction and next 5 for actual
|
| 77 |
+
hist = df_all.iloc[start_idx:start_idx+60]
|
| 78 |
+
future = df_all.iloc[start_idx+60:start_idx+65]
|
| 79 |
+
if len(hist.dropna()) == 60 and len(future.dropna()) == 5:
|
| 80 |
+
try:
|
| 81 |
+
pred = train_and_predict(hist)
|
| 82 |
+
pred_prices = pred['predicted_prices']
|
| 83 |
+
actual_prices = future['Close'].values.tolist()
|
| 84 |
+
print(f"Predicted 5-day prices: {pred_prices}")
|
| 85 |
+
print(f"Actual 5-day prices: {actual_prices}")
|
| 86 |
+
except Exception as e:
|
| 87 |
+
print(f"Could not compute prediction for last window: {e}")
|
| 88 |
+
else:
|
| 89 |
+
print(df[['date', 'mae', 'mse']])
|
| 90 |
+
print("Average MAE:", df['mae'].mean())
|
| 91 |
+
print("Average MSE:", df['mse'].mean())
|
| 92 |
+
df.to_csv(f"trained_models/{ticker}_backtest_results.csv", index=False)
|
| 93 |
+
print(f"Results saved to trained_models/{ticker}_backtest_results.csv")
|
intraday_model.cpython-313.pyc
ADDED
|
Binary file (15.8 kB). View file
|
|
|
model.cpython-313.pyc
ADDED
|
Binary file (10.6 kB). View file
|
|
|
sentiment.cpython-313.pyc
ADDED
|
Binary file (4.91 kB). View file
|
|
|
stock_data.cpython-313.pyc
ADDED
|
Binary file (16.6 kB). View file
|
|
|
trader.cpython-313.pyc
ADDED
|
Binary file (23.9 kB). View file
|
|
|
wallet-styles.css
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* ============================================================================
|
| 2 |
+
WALLET MESSAGE STYLES
|
| 3 |
+
============================================================================ */
|
| 4 |
+
|
| 5 |
+
.wallet-message {
|
| 6 |
+
margin-top: 1.5rem;
|
| 7 |
+
padding: 1.1rem 1.3rem;
|
| 8 |
+
border-radius: 10px;
|
| 9 |
+
font-size: 0.9rem;
|
| 10 |
+
font-weight: 600;
|
| 11 |
+
text-align: center;
|
| 12 |
+
animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
| 13 |
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
|
| 14 |
+
position: relative;
|
| 15 |
+
overflow: hidden;
|
| 16 |
+
letter-spacing: 0.02em;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
.wallet-message::before {
|
| 20 |
+
content: '';
|
| 21 |
+
position: absolute;
|
| 22 |
+
left: 0;
|
| 23 |
+
top: 0;
|
| 24 |
+
bottom: 0;
|
| 25 |
+
width: 4px;
|
| 26 |
+
animation: progressBar 5s linear forwards;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
.wallet-message.success {
|
| 30 |
+
background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(34, 197, 94, 0.08) 100%);
|
| 31 |
+
color: #22c55e;
|
| 32 |
+
border: 1.5px solid rgba(34, 197, 94, 0.35);
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
.wallet-message.success::before {
|
| 36 |
+
background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
.wallet-message.error {
|
| 40 |
+
background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(239, 68, 68, 0.08) 100%);
|
| 41 |
+
color: #ef4444;
|
| 42 |
+
border: 1.5px solid rgba(239, 68, 68, 0.35);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.wallet-message.error::before {
|
| 46 |
+
background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
.wallet-message.hidden {
|
| 50 |
+
display: none;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
@keyframes messageSlideIn {
|
| 54 |
+
from {
|
| 55 |
+
opacity: 0;
|
| 56 |
+
transform: translateY(-15px) scale(0.95);
|
| 57 |
+
}
|
| 58 |
+
to {
|
| 59 |
+
opacity: 1;
|
| 60 |
+
transform: translateY(0) scale(1);
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
@keyframes progressBar {
|
| 65 |
+
from {
|
| 66 |
+
height: 100%;
|
| 67 |
+
}
|
| 68 |
+
to {
|
| 69 |
+
height: 0%;
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
/* ============================================================================
|
| 75 |
+
WALLET FORM STYLES
|
| 76 |
+
============================================================================ */
|
| 77 |
+
|
| 78 |
+
.wallet-form {
|
| 79 |
+
margin-top: 1.2rem;
|
| 80 |
+
display: flex;
|
| 81 |
+
flex-direction: column;
|
| 82 |
+
gap: 1.1rem;
|
| 83 |
+
background: #202534;
|
| 84 |
+
border-radius: 10px;
|
| 85 |
+
padding: 1.3rem 1.2rem 1.5rem 1.2rem;
|
| 86 |
+
box-shadow: 0 2px 12px rgba(59, 130, 246, 0.04);
|
| 87 |
+
border: 1px solid #242a38;
|
| 88 |
+
animation: formFadeIn 0.3s ease-out;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
@keyframes formFadeIn {
|
| 92 |
+
from {
|
| 93 |
+
opacity: 0;
|
| 94 |
+
transform: translateY(-8px);
|
| 95 |
+
}
|
| 96 |
+
to {
|
| 97 |
+
opacity: 1;
|
| 98 |
+
transform: translateY(0);
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
.wallet-form h3 {
|
| 103 |
+
margin-bottom: 0.5rem;
|
| 104 |
+
color: #06b6d4;
|
| 105 |
+
font-size: 1.1rem;
|
| 106 |
+
font-weight: 700;
|
| 107 |
+
letter-spacing: 0.02em;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.wallet-form input {
|
| 111 |
+
padding: 0.9rem 1.1rem;
|
| 112 |
+
border-radius: 7px;
|
| 113 |
+
border: 1.5px solid #242a38;
|
| 114 |
+
background: #23283a;
|
| 115 |
+
color: #fff;
|
| 116 |
+
margin-bottom: 0.7rem;
|
| 117 |
+
width: 100%;
|
| 118 |
+
font-size: 1.05rem;
|
| 119 |
+
font-family: inherit;
|
| 120 |
+
font-weight: 600;
|
| 121 |
+
letter-spacing: 0.01em;
|
| 122 |
+
transition: all 0.2s ease;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
.wallet-form input:focus {
|
| 126 |
+
outline: none;
|
| 127 |
+
border-color: #3b82f6;
|
| 128 |
+
background: #1a1f2e;
|
| 129 |
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
.wallet-form input:hover {
|
| 133 |
+
border-color: #2a3040;
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
.wallet-form input::placeholder {
|
| 137 |
+
color: #6b7280;
|
| 138 |
+
font-weight: 500;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
.wallet-form button {
|
| 142 |
+
background: linear-gradient(90deg, #3b82f6 80%, #a5b4fc 100%);
|
| 143 |
+
color: #fff;
|
| 144 |
+
border: none;
|
| 145 |
+
border-radius: 7px;
|
| 146 |
+
padding: 1rem 0;
|
| 147 |
+
font-size: 1.08rem;
|
| 148 |
+
font-weight: 700;
|
| 149 |
+
cursor: pointer;
|
| 150 |
+
box-shadow: 0 2px 12px rgba(59, 130, 246, 0.08);
|
| 151 |
+
transition: all 0.2s ease;
|
| 152 |
+
font-family: inherit;
|
| 153 |
+
letter-spacing: 0.02em;
|
| 154 |
+
position: relative;
|
| 155 |
+
overflow: hidden;
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
.wallet-form button::before {
|
| 159 |
+
content: '';
|
| 160 |
+
position: absolute;
|
| 161 |
+
top: 50%;
|
| 162 |
+
left: 50%;
|
| 163 |
+
width: 0;
|
| 164 |
+
height: 0;
|
| 165 |
+
border-radius: 50%;
|
| 166 |
+
background: rgba(255, 255, 255, 0.2);
|
| 167 |
+
transform: translate(-50%, -50%);
|
| 168 |
+
transition: width 0.6s, height 0.6s;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
.wallet-form button:hover::before {
|
| 172 |
+
width: 300px;
|
| 173 |
+
height: 300px;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
.wallet-form button:hover {
|
| 177 |
+
background: linear-gradient(90deg, #2563eb 80%, #818cf8 100%);
|
| 178 |
+
box-shadow: 0 4px 18px rgba(59, 130, 246, 0.2);
|
| 179 |
+
transform: translateY(-1px);
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
.wallet-form button:active {
|
| 183 |
+
transform: translateY(0) scale(0.98);
|
| 184 |
+
box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
.wallet-form button:disabled {
|
| 188 |
+
opacity: 0.5;
|
| 189 |
+
cursor: not-allowed;
|
| 190 |
+
transform: none;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
/* ============================================================================
|
| 195 |
+
WALLET PANEL ENHANCEMENTS
|
| 196 |
+
============================================================================ */
|
| 197 |
+
|
| 198 |
+
.wallet-panel h2 {
|
| 199 |
+
font-size: 1.6rem;
|
| 200 |
+
color: #fff;
|
| 201 |
+
font-weight: 700;
|
| 202 |
+
margin-bottom: 1.5rem;
|
| 203 |
+
letter-spacing: 0.02em;
|
| 204 |
+
background: linear-gradient(135deg, #fff 0%, #d1d5db 100%);
|
| 205 |
+
-webkit-background-clip: text;
|
| 206 |
+
-webkit-text-fill-color: transparent;
|
| 207 |
+
background-clip: text;
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
.wallet-balance {
|
| 211 |
+
position: relative;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
.wallet-balance::after {
|
| 215 |
+
content: '';
|
| 216 |
+
position: absolute;
|
| 217 |
+
bottom: -5px;
|
| 218 |
+
left: 0;
|
| 219 |
+
right: 0;
|
| 220 |
+
height: 2px;
|
| 221 |
+
background: linear-gradient(90deg, transparent 0%, #22c55e 50%, transparent 100%);
|
| 222 |
+
opacity: 0.3;
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
/* ============================================================================
|
| 227 |
+
LOADING SPINNER FOR FORM SUBMISSIONS
|
| 228 |
+
============================================================================ */
|
| 229 |
+
|
| 230 |
+
.wallet-form button.loading {
|
| 231 |
+
pointer-events: none;
|
| 232 |
+
opacity: 0.8;
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
.wallet-form button.loading::after {
|
| 236 |
+
content: '';
|
| 237 |
+
position: absolute;
|
| 238 |
+
width: 16px;
|
| 239 |
+
height: 16px;
|
| 240 |
+
top: 50%;
|
| 241 |
+
left: 50%;
|
| 242 |
+
margin-left: -8px;
|
| 243 |
+
margin-top: -8px;
|
| 244 |
+
border: 2px solid #ffffff;
|
| 245 |
+
border-radius: 50%;
|
| 246 |
+
border-top-color: transparent;
|
| 247 |
+
animation: spinner 0.6s linear infinite;
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
@keyframes spinner {
|
| 251 |
+
to {
|
| 252 |
+
transform: rotate(360deg);
|
| 253 |
+
}
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
/* ============================================================================
|
| 258 |
+
RESPONSIVE ADJUSTMENTS
|
| 259 |
+
============================================================================ */
|
| 260 |
+
|
| 261 |
+
@media (max-width: 500px) {
|
| 262 |
+
.wallet-panel {
|
| 263 |
+
width: 100%;
|
| 264 |
+
border-radius: 0;
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
.wallet-panel-content {
|
| 268 |
+
padding: 2rem 1.5rem;
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
.wallet-form {
|
| 272 |
+
padding: 1rem;
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
.wallet-message {
|
| 276 |
+
font-size: 0.85rem;
|
| 277 |
+
padding: 0.9rem 1rem;
|
| 278 |
+
}
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
|
| 282 |
+
/* ============================================================================
|
| 283 |
+
TRANSACTION HISTORY (OPTIONAL ENHANCEMENT)
|
| 284 |
+
============================================================================ */
|
| 285 |
+
|
| 286 |
+
.wallet-transactions {
|
| 287 |
+
margin-top: 1.5rem;
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
.wallet-transactions h4 {
|
| 291 |
+
color: #06b6d4;
|
| 292 |
+
font-size: 0.9rem;
|
| 293 |
+
font-weight: 700;
|
| 294 |
+
margin-bottom: 0.8rem;
|
| 295 |
+
text-transform: uppercase;
|
| 296 |
+
letter-spacing: 0.05em;
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
.transaction-item {
|
| 300 |
+
display: flex;
|
| 301 |
+
justify-content: space-between;
|
| 302 |
+
align-items: center;
|
| 303 |
+
padding: 0.8rem 1rem;
|
| 304 |
+
background: #1a1f2e;
|
| 305 |
+
border: 1px solid #242a38;
|
| 306 |
+
border-radius: 6px;
|
| 307 |
+
margin-bottom: 0.5rem;
|
| 308 |
+
transition: all 0.2s ease;
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
.transaction-item:hover {
|
| 312 |
+
background: #202534;
|
| 313 |
+
border-color: #2a3040;
|
| 314 |
+
transform: translateX(4px);
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
.transaction-type {
|
| 318 |
+
font-size: 0.75rem;
|
| 319 |
+
font-weight: 700;
|
| 320 |
+
text-transform: uppercase;
|
| 321 |
+
letter-spacing: 0.05em;
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
.transaction-type.credit {
|
| 325 |
+
color: #22c55e;
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
.transaction-type.debit {
|
| 329 |
+
color: #ef4444;
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
.transaction-amount {
|
| 333 |
+
font-weight: 700;
|
| 334 |
+
font-size: 0.95rem;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
.transaction-date {
|
| 338 |
+
font-size: 0.7rem;
|
| 339 |
+
color: #6b7280;
|
| 340 |
+
margin-top: 0.2rem;
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
|
| 344 |
+
/* ============================================================================
|
| 345 |
+
EMPTY STATE
|
| 346 |
+
============================================================================ */
|
| 347 |
+
|
| 348 |
+
.wallet-empty {
|
| 349 |
+
text-align: center;
|
| 350 |
+
padding: 2rem 1rem;
|
| 351 |
+
color: #6b7280;
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
.wallet-empty-icon {
|
| 355 |
+
font-size: 3rem;
|
| 356 |
+
margin-bottom: 1rem;
|
| 357 |
+
opacity: 0.4;
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
.wallet-empty p {
|
| 361 |
+
font-size: 0.85rem;
|
| 362 |
+
line-height: 1.5;
|
| 363 |
+
}
|
wallet.html
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!-- wallet.html: Simple wallet modal for add/withdraw money -->
|
| 2 |
+
<div id="walletModal" class="wallet-modal hidden">
|
| 3 |
+
<div class="wallet-modal-content">
|
| 4 |
+
<span class="wallet-close" onclick="closeWallet()">×</span>
|
| 5 |
+
<h2>Wallet</h2>
|
| 6 |
+
<div class="wallet-balance">
|
| 7 |
+
<span>Balance:</span>
|
| 8 |
+
<span id="walletBalance">₹0.00</span>
|
| 9 |
+
</div>
|
| 10 |
+
<div class="wallet-actions">
|
| 11 |
+
<button onclick="showAddMoney()">Add Money</button>
|
| 12 |
+
<button onclick="showWithdrawMoney()">Withdraw</button>
|
| 13 |
+
</div>
|
| 14 |
+
<div id="walletActionArea"></div>
|
| 15 |
+
</div>
|
| 16 |
+
</div>
|
| 17 |
+
|
| 18 |
+
<!-- Add Money Form (hidden by default) -->
|
| 19 |
+
<div id="addMoneyForm" class="wallet-form hidden">
|
| 20 |
+
<h3>Add Money</h3>
|
| 21 |
+
<input type="number" id="addAmount" placeholder="Enter amount" min="1" />
|
| 22 |
+
<button onclick="startRazorpayPayment()">Add via Razorpay</button>
|
| 23 |
+
</div>
|
| 24 |
+
|
| 25 |
+
<!-- Withdraw Money Form (hidden by default) -->
|
| 26 |
+
<div id="withdrawMoneyForm" class="wallet-form hidden">
|
| 27 |
+
<h3>Withdraw Money</h3>
|
| 28 |
+
<input type="number" id="withdrawAmount" placeholder="Enter amount" min="1" />
|
| 29 |
+
<button onclick="startWithdraw()">Withdraw</button>
|
| 30 |
+
</div>
|
| 31 |
+
|
| 32 |
+
<style>
|
| 33 |
+
.wallet-modal {
|
| 34 |
+
position: fixed;
|
| 35 |
+
top: 0; left: 0; right: 0; bottom: 0;
|
| 36 |
+
background: rgba(0,0,0,0.5);
|
| 37 |
+
display: flex;
|
| 38 |
+
align-items: center;
|
| 39 |
+
justify-content: center;
|
| 40 |
+
z-index: 9999;
|
| 41 |
+
}
|
| 42 |
+
.wallet-modal-content {
|
| 43 |
+
background: #181c24;
|
| 44 |
+
padding: 2rem 2.5rem;
|
| 45 |
+
border-radius: 12px;
|
| 46 |
+
min-width: 340px;
|
| 47 |
+
box-shadow: 0 8px 32px rgba(0,0,0,0.25);
|
| 48 |
+
position: relative;
|
| 49 |
+
}
|
| 50 |
+
.wallet-close {
|
| 51 |
+
position: absolute;
|
| 52 |
+
right: 1rem;
|
| 53 |
+
top: 1rem;
|
| 54 |
+
font-size: 1.5rem;
|
| 55 |
+
color: #aaa;
|
| 56 |
+
cursor: pointer;
|
| 57 |
+
}
|
| 58 |
+
.wallet-balance {
|
| 59 |
+
font-size: 1.2rem;
|
| 60 |
+
margin-bottom: 1.2rem;
|
| 61 |
+
display: flex;
|
| 62 |
+
justify-content: space-between;
|
| 63 |
+
}
|
| 64 |
+
.wallet-actions {
|
| 65 |
+
display: flex;
|
| 66 |
+
gap: 1rem;
|
| 67 |
+
margin-bottom: 1.2rem;
|
| 68 |
+
}
|
| 69 |
+
.wallet-form {
|
| 70 |
+
margin-top: 1rem;
|
| 71 |
+
}
|
| 72 |
+
.wallet-form input {
|
| 73 |
+
padding: 0.5rem 1rem;
|
| 74 |
+
border-radius: 6px;
|
| 75 |
+
border: 1px solid #242a38;
|
| 76 |
+
background: #23283a;
|
| 77 |
+
color: #fff;
|
| 78 |
+
margin-bottom: 0.7rem;
|
| 79 |
+
width: 100%;
|
| 80 |
+
}
|
| 81 |
+
.wallet-form button {
|
| 82 |
+
background: var(--green);
|
| 83 |
+
color: #000;
|
| 84 |
+
border: none;
|
| 85 |
+
border-radius: 6px;
|
| 86 |
+
padding: 0.5rem 1.2rem;
|
| 87 |
+
font-weight: 700;
|
| 88 |
+
cursor: pointer;
|
| 89 |
+
}
|
| 90 |
+
</style>
|