Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ dist/
downloads/
eggs/
.eggs/
lib/
lib64/
/lib/
/lib64/
parts/
sdist/
var/
Expand Down Expand Up @@ -57,11 +57,14 @@ Desktop.ini

# Logs
*.log
*.pid
logs/
webui/prediction_results/

# Environment
.env
.venv
.tools/
env/
venv/
ENV/
Expand Down
1,001 changes: 1,001 additions & 0 deletions data/BTCUSDT_5m_binance.csv

Large diffs are not rendered by default.

93,913 changes: 93,913 additions & 0 deletions data/HK_ali_09988_kline_5min_all.csv

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions start_MAC/start_kronos.command
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$ROOT_DIR"

chmod +x "$SCRIPT_DIR/start_kronos.sh"
"$SCRIPT_DIR/start_kronos.sh"

echo ""
echo "Press any key to close this window..."
read -r -n 1
127 changes: 127 additions & 0 deletions start_MAC/start_kronos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
BACKEND_DIR="$ROOT_DIR/webui"
FRONTEND_DIR="$ROOT_DIR/webui-next"
LOCAL_PYTHON="$ROOT_DIR/.venv/bin/python"
LOCAL_NODE_DIR="$ROOT_DIR/.tools/node/bin"
BACKEND_LOG="$BACKEND_DIR/server.log"
BACKEND_ERR="$BACKEND_DIR/server.err.log"
FRONTEND_LOG="$FRONTEND_DIR/next-server.log"
FRONTEND_ERR="$FRONTEND_DIR/next-server.err.log"

command_exists() {
command -v "$1" >/dev/null 2>&1
}

port_in_use() {
local port="$1"

if command_exists lsof; then
lsof -iTCP:"$port" -sTCP:LISTEN -t >/dev/null 2>&1
elif command_exists nc; then
nc -z 127.0.0.1 "$port" >/dev/null 2>&1
else
return 1
fi
}

open_url() {
local url="$1"

if command_exists open; then
open "$url" >/dev/null 2>&1 || true
elif command_exists xdg-open; then
xdg-open "$url" >/dev/null 2>&1 || true
fi
}

echo "Starting Kronos..."
echo "=================="

if [ -x "$LOCAL_PYTHON" ]; then
PYTHON_BIN="$LOCAL_PYTHON"
elif command_exists python3; then
PYTHON_BIN="python3"
elif command_exists python; then
PYTHON_BIN="python"
else
echo "Python was not found. Install Python first."
exit 1
fi

if [ -x "$LOCAL_NODE_DIR/node" ]; then
NODE_BIN="$LOCAL_NODE_DIR/node"
NPM_BIN="$LOCAL_NODE_DIR/npm"
elif command_exists node; then
NODE_BIN="node"
NPM_BIN="npm"
else
NODE_BIN=""
NPM_BIN=""
fi

if [ -z "$NODE_BIN" ]; then
echo "Node.js was not found. Install Node.js/npm first."
exit 1
fi

if [ ! -d "$BACKEND_DIR" ]; then
echo "Backend directory not found: $BACKEND_DIR"
exit 1
fi

if [ ! -d "$FRONTEND_DIR" ]; then
echo "Frontend directory not found: $FRONTEND_DIR"
exit 1
fi

if port_in_use 7070; then
echo "Backend API is already running on http://localhost:7070"
else
echo "Starting Kronos backend API on http://localhost:7070 ..."
(
cd "$BACKEND_DIR"
nohup "$PYTHON_BIN" app.py >>"$BACKEND_LOG" 2>>"$BACKEND_ERR" </dev/null &
echo "$!" > "$BACKEND_DIR/server.pid"
)
echo "Backend PID: $(cat "$BACKEND_DIR/server.pid")"
fi

sleep 4

if port_in_use 3000; then
echo "Web UI is already running on http://localhost:3000"
else
echo "Starting Kronos web UI on http://localhost:3000 ..."
(
cd "$FRONTEND_DIR"
if [ -x "$NPM_BIN" ] || command_exists "$NPM_BIN"; then
nohup env PATH="$LOCAL_NODE_DIR:$PATH" "$NPM_BIN" run dev -- --hostname 0.0.0.0 --port 3000 >>"$FRONTEND_LOG" 2>>"$FRONTEND_ERR" </dev/null &
elif [ -f "$FRONTEND_DIR/node_modules/next/dist/bin/next" ]; then
nohup "$NODE_BIN" "$FRONTEND_DIR/node_modules/next/dist/bin/next" dev --hostname 0.0.0.0 --port 3000 >>"$FRONTEND_LOG" 2>>"$FRONTEND_ERR" </dev/null &
else
echo "npm was not found and frontend dependencies are missing. Install Node.js/npm, then run npm install in $FRONTEND_DIR." >>"$FRONTEND_ERR"
exit 1
fi
echo "$!" > "$FRONTEND_DIR/server.pid"
)
echo "Frontend PID: $(cat "$FRONTEND_DIR/server.pid")"
fi

sleep 6
open_url "http://localhost:3000"

echo ""
echo "Kronos is starting."
echo "Backend API: http://localhost:7070"
echo "Web UI: http://localhost:3000"
echo ""
echo "Logs:"
echo " Backend: $BACKEND_LOG"
echo " Frontend: $FRONTEND_LOG"
echo ""
echo "To stop both services later, run:"
echo " lsof -ti :7070,:3000 | xargs kill"
2 changes: 2 additions & 0 deletions start_WINDOW/start_kronos.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0start_kronos.ps1"
73 changes: 73 additions & 0 deletions start_WINDOW/start_kronos.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
$ErrorActionPreference = "Stop"

$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$root = Split-Path -Parent $scriptDir
$backend = Join-Path $root "webui"
$frontend = Join-Path $root "webui-next"

function Test-Command($name) {
$null -ne (Get-Command $name -ErrorAction SilentlyContinue)
}

function Test-PortInUse($port) {
$connection = Get-NetTCPConnection -LocalPort $port -State Listen -ErrorAction SilentlyContinue
$null -ne $connection
}

if (-not (Test-Command "python")) {
Write-Host "Python was not found on PATH. Install Python or add it to PATH first." -ForegroundColor Red
pause
exit 1
}

if (-not (Test-Command "npm")) {
Write-Host "npm was not found on PATH. Install Node.js or add npm to PATH first." -ForegroundColor Red
pause
exit 1
}

if (-not (Test-Path -LiteralPath $backend)) {
Write-Host "Backend directory was not found: $backend" -ForegroundColor Red
pause
exit 1
}

if (-not (Test-Path -LiteralPath $frontend)) {
Write-Host "Frontend directory was not found: $frontend" -ForegroundColor Red
pause
exit 1
}

if (Test-PortInUse 7070) {
Write-Host "Backend API is already running on http://localhost:7070"
} else {
Write-Host "Starting Kronos backend API on http://localhost:7070 ..."
Start-Process powershell -ArgumentList @(
"-NoExit",
"-Command",
"Set-Location -LiteralPath '$backend'; python app.py"
) -WindowStyle Normal
}

Start-Sleep -Seconds 4

if (Test-PortInUse 3000) {
Write-Host "Web UI is already running on http://localhost:3000"
} else {
Write-Host "Starting Kronos web UI on http://localhost:3000 ..."
Start-Process powershell -ArgumentList @(
"-NoExit",
"-Command",
"Set-Location -LiteralPath '$frontend'; npm run dev -- --hostname 0.0.0.0 --port 3000"
) -WindowStyle Normal
}

Start-Sleep -Seconds 6
Start-Process "http://localhost:3000"

Write-Host ""
Write-Host "Kronos is starting." -ForegroundColor Green
Write-Host "Keep the two PowerShell windows open while you use the app."
Write-Host "Close those two windows when you want to stop it."
Write-Host ""
pause
41 changes: 41 additions & 0 deletions webui-next/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
5 changes: 5 additions & 0 deletions webui-next/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- BEGIN:nextjs-agent-rules -->
# This is NOT the Next.js you know

This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` before writing any code. Heed deprecation notices.
<!-- END:nextjs-agent-rules -->
1 change: 1 addition & 0 deletions webui-next/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md
36 changes: 36 additions & 0 deletions webui-next/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
25 changes: 25 additions & 0 deletions webui-next/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "radix-nova",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "",
"css": "src/app/globals.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"iconLibrary": "lucide",
"rtl": false,
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"menuColor": "default",
"menuAccent": "subtle",
"registries": {}
}
18 changes: 18 additions & 0 deletions webui-next/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";

const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
// Override default ignores of eslint-config-next.
globalIgnores([
// Default ignores of eslint-config-next:
".next/**",
"out/**",
"build/**",
"next-env.d.ts",
]),
]);

export default eslintConfig;
21 changes: 21 additions & 0 deletions webui-next/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { NextConfig } from "next";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";

const projectRoot = dirname(fileURLToPath(import.meta.url));

const nextConfig: NextConfig = {
turbopack: {
root: projectRoot,
},
async rewrites() {
return [
{
source: "/api/:path*",
destination: "http://127.0.0.1:7070/api/:path*",
},
];
},
};

export default nextConfig;
Loading