199 lines
9.8 KiB
PHP
199 lines
9.8 KiB
PHP
<?php
|
|
// Force-refresh for platform sync
|
|
require_once 'db/config.php';
|
|
require_once 'includes/finance_api.php';
|
|
|
|
// Handle Add Stock Form Submission
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['symbol'])) {
|
|
$symbol = trim(strtoupper($_POST['symbol']));
|
|
if (!empty($symbol)) {
|
|
try {
|
|
$pdo = db();
|
|
add_stock_with_details($symbol, $pdo);
|
|
} catch (PDOException $e) {
|
|
// Handle error, e.g. log it
|
|
error_log("Error adding stock: " . $e->getMessage());
|
|
}
|
|
}
|
|
// Redirect to the watchlist section to prevent form resubmission
|
|
header("Location: " . $_SERVER['PHP_SELF'] . '#watchlist');
|
|
exit;
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en" data-bs-theme="dark">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>Moonshot Tracker</title>
|
|
<meta name="description" content="AI-powered moonshots tracker for micro/small cap stocks. Built with Flatlogic Generator.">
|
|
<meta name="keywords" content="moonshot stocks, small cap, micro cap, stock scanner, investment tool, trading app, AI stock analysis, high growth stocks, market analysis, Flatlogic">
|
|
|
|
<meta property="og:title" content="Moonshot Tracker">
|
|
<meta property="og:description" content="AI-powered moonshots tracker for micro/small cap stocks.">
|
|
<meta property="og:image" content="">
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta name="twitter:image" content="">
|
|
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css">
|
|
</head>
|
|
<body>
|
|
|
|
<header class="container mt-4">
|
|
<nav class="navbar navbar-expand-lg navbar-dark">
|
|
<a class="navbar-brand fw-bold" href="#">Moonshot Tracker</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
<ul class="navbar-nav ms-auto">
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="#watchlist">Watchlist</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link active" aria-current="page" href="#scanner">Scanner</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="#">Settings</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</nav
|
|
</header>
|
|
|
|
<main class="container my-5">
|
|
<div class="hero text-center mb-5">
|
|
<h1 class="display-4 fw-bold">Discover Your Next 10x Stock</h1>
|
|
<p class="lead text-secondary">AI-powered scanning for high-upside micro and small-cap gems.</p>
|
|
</div>
|
|
|
|
<!-- Moonshot Scanner -->
|
|
<div id="scanner" class="card bg-surface mb-5">
|
|
<div class="card-header">
|
|
<h5 class="mb-0">Moonshot Scanner</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<p class="card-text text-secondary">Define criteria to discover undervalued high-growth stocks across markets.</p>
|
|
<form>
|
|
<div class="row g-3 align-items-end">
|
|
<div class="col-md-4">
|
|
<label class="form-label">Market Cap (USD)</label>
|
|
<div class="input-group">
|
|
<input type="number" class="form-control" name="min_market_cap" placeholder="Min" value="500">
|
|
<input type="number" class="form-control" name="max_market_cap" placeholder="Max" value="10000>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Stock Price</label>
|
|
<div class="input-group">
|
|
<input type="number" class="form-control" name="min_price" placeholder="Min $" value="1">
|
|
</div>
|
|
</div>
|
|
<div class="col-md-5">
|
|
<label class="form-label">Avg. Daily Volume</label>
|
|
<div class="input-group">
|
|
<input type="number" class="form-control" name="min_volume" placeholder="Min" value="100000">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-hover table-borderless mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Symbol</th>
|
|
<th scope="col">Company Name</th>
|
|
<th scope="col" class="text-end">Price</th>
|
|
<th scope="col" class="text-end">Market Cap</th>
|
|
<th scope="col" class="text-center">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td colspan="5" class="text-center text-secondary py-4">
|
|
<p class="mb-0">Scanning for moonshots...</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="watchlist" class="card bg-surface">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h5 class="mb-0">Moonshot Watchlist</h5>
|
|
<form class="d-flex" method="POST" action="index.php">
|
|
<input class="form-control me-2" type="text" name="symbol" placeholder="Add Symbol (e.g. RIVN)" required>
|
|
<button class="btn btn-primary btn-sm d-flex align-items-center" type="submit">
|
|
<i data-feather="plus" class="me-1"></i> Add
|
|
</button>
|
|
</form>
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-hover table-borderless">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Symbol</th>
|
|
<th scope="col">Company Name</th>
|
|
<th scope="col" class="text-end">Price</th>
|
|
<th scope="col" class="text-end">Change % (24h)</th>
|
|
<th scope="col" class="text-center">Conviction (soon)</th>
|
|
<th scope="col">Tags (soon)</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
require_once 'db/config.php';
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->query('SELECT symbol, company_name, price, change_pct FROM watchlist ORDER BY symbol ASC');
|
|
$watchlist = $stmt->fetchAll();
|
|
} catch (PDOException $e) {
|
|
// For now, just show an empty list on DB error.
|
|
// In a real app, you'd want to log this error.
|
|
$watchlist = [];
|
|
error_log("Database error: " . $e->getMessage());
|
|
}
|
|
|
|
foreach ($watchlist as $stock):
|
|
$changeClass = $stock['change_pct'] >= 0 ? 'text-success' : 'text-danger';
|
|
$changeIcon = $stock['change_pct'] >= 0 ? 'trending-up' : 'trending-down';
|
|
?>
|
|
<tr>
|
|
<td class="fw-bold"><?= htmlspecialchars($stock['symbol']) ?></td>
|
|
<td><?= htmlspecialchars($stock['company_name']) ?></td>
|
|
<td class="text-end">$<?= number_format($stock['price'], 2) ?></td>
|
|
<td class="text-end <?= $changeClass ?>">
|
|
<i data-feather="<?= $changeIcon ?>" class="me-1"></i> <?= number_format($stock['change_pct'], 2) ?>%
|
|
</td>
|
|
<td class="text-center fst-italic text-secondary">N/A</td>
|
|
<td><span class="badge bg-secondary bg-opacity-25 text-light">N/A</span></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<footer class="container text-center text-secondary mt-5 py-3">
|
|
<small>© <?= date('Y') ?> Moonshot Tracker. All Rights Reserved.</small>
|
|
</footer>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
|
<script src="assets/js/main.js"></script>
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Automatically trigger the scan on page load
|
|
document.querySelector('#scanner form').dispatchEvent(new Event('submit', { cancelable: true }));
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|