Initial commit with 2026 World Cup Quant Platform core modules and CI/CD
This commit is contained in:
25
platform/web/app/api/analytics/backtest/route.ts
Normal file
25
platform/web/app/api/analytics/backtest/route.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const body = await req.text();
|
||||
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/backtest`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const message = await response.text();
|
||||
return NextResponse.json({ message }, { status: response.status });
|
||||
}
|
||||
|
||||
const data = (await response.json()) as Record<string, unknown>;
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : '回測服務暫時無法連線';
|
||||
return NextResponse.json({ message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
21
platform/web/app/api/analytics/daily-card/[date]/route.ts
Normal file
21
platform/web/app/api/analytics/daily-card/[date]/route.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
export async function GET(_: Request, { params }: { params: Promise<{ date: string }> }) {
|
||||
try {
|
||||
const { date } = await params;
|
||||
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/daily-card/${date}`, { method: 'GET' });
|
||||
|
||||
if (!response.ok) {
|
||||
const message = await response.text();
|
||||
return NextResponse.json({ message }, { status: response.status });
|
||||
}
|
||||
|
||||
const data = (await response.json()) as Record<string, unknown>;
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : '每日操盤卡服務暫時無法連線';
|
||||
return NextResponse.json({ message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
25
platform/web/app/api/analytics/hedging/route.ts
Normal file
25
platform/web/app/api/analytics/hedging/route.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const body = await req.text();
|
||||
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/hedging`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const message = await response.text();
|
||||
return NextResponse.json({ message }, { status: response.status });
|
||||
}
|
||||
|
||||
const data = (await response.json()) as Record<string, unknown>;
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : '對沖計算服務暫時無法連線';
|
||||
return NextResponse.json({ message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
25
platform/web/app/api/analytics/kelly/route.ts
Normal file
25
platform/web/app/api/analytics/kelly/route.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const body = await req.text();
|
||||
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/kelly`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const message = await response.text();
|
||||
return NextResponse.json({ message }, { status: response.status });
|
||||
}
|
||||
|
||||
const data = (await response.json()) as Record<string, unknown>;
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : '凱利計算服務暫時無法連線';
|
||||
return NextResponse.json({ message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
25
platform/web/app/api/analytics/match-conditions/route.ts
Normal file
25
platform/web/app/api/analytics/match-conditions/route.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const body = await req.text();
|
||||
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/match-conditions`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const message = await response.text();
|
||||
return NextResponse.json({ message }, { status: response.status });
|
||||
}
|
||||
|
||||
const data = (await response.json()) as Record<string, unknown>;
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : '比賽條件分析服務暫時無法連線';
|
||||
return NextResponse.json({ message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
26
platform/web/app/api/analytics/matches/[matchId]/route.ts
Normal file
26
platform/web/app/api/analytics/matches/[matchId]/route.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
export async function GET(_: Request, { params }: { params: Promise<{ matchId: string }> }) {
|
||||
try {
|
||||
const { matchId } = await params;
|
||||
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/matches/${matchId}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const message = await response.text();
|
||||
return NextResponse.json({ message }, { status: response.status });
|
||||
}
|
||||
|
||||
const data = (await response.json()) as Record<string, unknown>;
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : '賽事預測服務暫時無法連線';
|
||||
return NextResponse.json({ message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
25
platform/web/app/api/analytics/matches/route.ts
Normal file
25
platform/web/app/api/analytics/matches/route.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/matches`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const message = await response.text();
|
||||
return NextResponse.json({ message }, { status: response.status });
|
||||
}
|
||||
|
||||
const data = (await response.json()) as Record<string, unknown>;
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : '賽事列表服務暫時無法連線';
|
||||
return NextResponse.json({ message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
26
platform/web/app/api/analytics/ml-edge/route.ts
Normal file
26
platform/web/app/api/analytics/ml-edge/route.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const body = await req.text();
|
||||
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/ml-edge`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const message = await response.text();
|
||||
return NextResponse.json({ message }, { status: response.status });
|
||||
}
|
||||
|
||||
const data = (await response.json()) as Record<string, unknown>;
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : 'ML Edge 服務暫時無法連線';
|
||||
return NextResponse.json({ message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
|
||||
25
platform/web/app/api/analytics/ml-edge/train/route.ts
Normal file
25
platform/web/app/api/analytics/ml-edge/train/route.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const body = await req.text();
|
||||
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/ml-edge/train`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const message = await response.text();
|
||||
return NextResponse.json({ message }, { status: response.status });
|
||||
}
|
||||
|
||||
const data = (await response.json()) as Record<string, unknown>;
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : 'ML Edge 訓練服務暫時無法連線';
|
||||
return NextResponse.json({ message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
25
platform/web/app/api/analytics/player-props/route.ts
Normal file
25
platform/web/app/api/analytics/player-props/route.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const body = await req.text();
|
||||
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/player-props`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const message = await response.text();
|
||||
return NextResponse.json({ message }, { status: response.status });
|
||||
}
|
||||
|
||||
const data = (await response.json()) as Record<string, unknown>;
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : '玩家道具盤分析服務暫時無法連線';
|
||||
return NextResponse.json({ message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
25
platform/web/app/api/analytics/portfolio/leaks/route.ts
Normal file
25
platform/web/app/api/analytics/portfolio/leaks/route.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const body = await req.text();
|
||||
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/portfolio/leaks`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const message = await response.text();
|
||||
return NextResponse.json({ message }, { status: response.status });
|
||||
}
|
||||
|
||||
const data = (await response.json()) as Record<string, unknown>;
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : '投注漏財分析服務暫時無法連線';
|
||||
return NextResponse.json({ message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
try {
|
||||
const limit = req.nextUrl.searchParams.get('limit') || '200';
|
||||
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/proof-of-yield/ledger?limit=${limit}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const message = await response.text();
|
||||
return NextResponse.json({ message }, { status: response.status });
|
||||
}
|
||||
|
||||
const data = (await response.json()) as Record<string, unknown>;
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : '公開帳本服務暫時無法連線';
|
||||
return NextResponse.json({ message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
5
platform/web/app/api/analytics/proof-of-yield/route.ts
Normal file
5
platform/web/app/api/analytics/proof-of-yield/route.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
export async function GET() {
|
||||
return NextResponse.json({ message: '請使用 /api/analytics/proof-of-yield/ledger 或 /api/analytics/proof-of-yield/settle' }, { status: 404 });
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const body = await req.text();
|
||||
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/proof-of-yield/settle`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const message = await response.text();
|
||||
return NextResponse.json({ message }, { status: response.status });
|
||||
}
|
||||
|
||||
const data = (await response.json()) as Record<string, unknown>;
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : '結算服務暫時無法連線';
|
||||
return NextResponse.json({ message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
25
platform/web/app/api/analytics/rlm/route.ts
Normal file
25
platform/web/app/api/analytics/rlm/route.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const body = await req.text();
|
||||
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/rlm`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const message = await response.text();
|
||||
return NextResponse.json({ message }, { status: response.status });
|
||||
}
|
||||
|
||||
const data = (await response.json()) as Record<string, unknown>;
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : 'RLM 服務暫時無法連線';
|
||||
return NextResponse.json({ message }, { status: 502 });
|
||||
}
|
||||
}
|
||||
4
platform/web/app/api/auth/[...nextauth]/route.ts
Normal file
4
platform/web/app/api/auth/[...nextauth]/route.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { handlers } from '@/lib/auth';
|
||||
|
||||
export const { GET, POST } = handlers;
|
||||
|
||||
Reference in New Issue
Block a user