자산 현황 및 자동매매 페이지 제거:
Some checks failed
Build Push and Restart Compose / deploy (push) Failing after 11m20s
Some checks failed
Build Push and Restart Compose / deploy (push) Failing after 11m20s
- `/templates/pages/asset.html`, `/templates/pages/autotrade.html` HTML 템플릿 삭제. - `/static/js/asset.js`, `/static/js/autotrade.js` 클라이언트 스크립트 제거. - 관련 함수 및 초기화 로직 삭제 (자산 조회 및 자동매매 기능 비활성화).
This commit is contained in:
@@ -36,6 +36,10 @@ export const autotradeApi = {
|
||||
getPositions: () =>
|
||||
apiFetch<AutoTradePosition[]>('/api/autotrade/positions'),
|
||||
|
||||
// 거래 내역 (종료된 포지션)
|
||||
getTrades: () =>
|
||||
apiFetch<AutoTradePosition[]>('/api/autotrade/trades'),
|
||||
|
||||
// 이벤트 로그
|
||||
getLogs: () =>
|
||||
apiFetch<AutoTradeLog[]>('/api/autotrade/logs'),
|
||||
|
||||
@@ -137,9 +137,9 @@ export interface AutoTradeLog {
|
||||
|
||||
export interface AutoTradeStatus {
|
||||
running: boolean
|
||||
positions: number
|
||||
todayTrades: number
|
||||
todayProfit: number
|
||||
activePositions: number
|
||||
tradeCount: number
|
||||
totalPL: number
|
||||
}
|
||||
|
||||
export interface WatchlistItem {
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
let rules = $state<AutoTradeRule[]>([])
|
||||
let positions = $state<AutoTradePosition[]>([])
|
||||
let logs = $state<AutoTradeLog[]>([])
|
||||
let activeTab = $state<'rules' | 'positions' | 'logs'>('rules')
|
||||
let activeTab = $state<'rules' | 'positions' | 'trades' | 'logs'>('rules')
|
||||
let trades = $state<AutoTradePosition[]>([])
|
||||
let showRuleModal = $state(false)
|
||||
let editingRule = $state<Partial<AutoTradeRule> | null>(null)
|
||||
let loading = $state(true)
|
||||
@@ -55,10 +56,11 @@
|
||||
|
||||
async function loadAll() {
|
||||
try {
|
||||
const [s, r, p, l, ws, themes] = await Promise.all([
|
||||
const [s, r, p, t, l, ws, themes] = await Promise.all([
|
||||
autotradeApi.getStatus(),
|
||||
autotradeApi.getRules(),
|
||||
autotradeApi.getPositions(),
|
||||
autotradeApi.getTrades(),
|
||||
autotradeApi.getLogs(),
|
||||
autotradeApi.getWatchSource(),
|
||||
stockApi.getThemes(),
|
||||
@@ -66,6 +68,7 @@
|
||||
status = s
|
||||
rules = r
|
||||
positions = p
|
||||
trades = t ?? []
|
||||
logs = l
|
||||
watchSource = ws
|
||||
allThemes = themes
|
||||
@@ -239,13 +242,11 @@
|
||||
<span class="w-2 h-2 rounded-full {status.running ? 'bg-green-400 animate-pulse' : 'bg-gray-600'}"></span>
|
||||
{status.running ? '실행 중' : '중지됨'}
|
||||
</span>
|
||||
<span class="text-sm text-gray-400">포지션 {status.positions}개</span>
|
||||
<span class="text-sm text-gray-400">오늘 {status.todayTrades}건</span>
|
||||
{#if status.todayProfit !== 0}
|
||||
<span class="text-sm {priceClass(status.todayProfit)}">
|
||||
오늘 손익 {status.todayProfit >= 0 ? '+' : ''}{formatPrice(status.todayProfit)}
|
||||
</span>
|
||||
{/if}
|
||||
<span class="text-sm text-gray-400">포지션 {status.activePositions}개</span>
|
||||
<span class="text-sm text-gray-400">오늘 {status.tradeCount}건</span>
|
||||
<span class="text-sm {status.totalPL !== 0 ? priceClass(status.totalPL) : 'text-gray-400'}">
|
||||
오늘 손익 {status.totalPL >= 0 ? '+' : ''}{formatPrice(status.totalPL)}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -339,7 +340,7 @@
|
||||
|
||||
<!-- 탭 -->
|
||||
<div class="flex gap-1 mb-4 border-b border-gray-700 pb-1">
|
||||
{#each [['rules', `규칙 (${rules.length})`], ['positions', `포지션 (${positions.length})`], ['logs', '로그']] as [tab, label]}
|
||||
{#each [['rules', `규칙 (${rules.length})`], ['positions', `포지션 (${positions.length})`], ['trades', `거래 (${trades.length})`], ['logs', '로그']] as [tab, label]}
|
||||
<button
|
||||
onclick={() => { activeTab = tab as typeof activeTab }}
|
||||
class="px-4 py-2 text-sm transition-colors {activeTab === tab ? 'text-blue-400 border-b-2 border-blue-400' : 'text-gray-400 hover:text-white'}"
|
||||
@@ -457,6 +458,62 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- 거래 탭 -->
|
||||
{:else if activeTab === 'trades'}
|
||||
{#if trades.length === 0}
|
||||
<div class="bg-gray-800 rounded-xl p-8 text-center text-gray-500">거래 내역 없음</div>
|
||||
{:else}
|
||||
<div class="bg-gray-800 rounded-xl overflow-hidden">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-400">종목</th>
|
||||
<th class="px-3 py-3 text-center text-xs font-medium text-gray-400">구분</th>
|
||||
<th class="px-3 py-3 text-right text-xs font-medium text-gray-400">수량</th>
|
||||
<th class="px-3 py-3 text-right text-xs font-medium text-gray-400">매수가</th>
|
||||
<th class="px-3 py-3 text-right text-xs font-medium text-gray-400">매도가</th>
|
||||
<th class="px-3 py-3 text-right text-xs font-medium text-gray-400">손익</th>
|
||||
<th class="px-3 py-3 text-right text-xs font-medium text-gray-400">수익률</th>
|
||||
<th class="px-3 py-3 text-center text-xs font-medium text-gray-400">사유</th>
|
||||
<th class="px-3 py-3 text-right text-xs font-medium text-gray-400">청산시각</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-700">
|
||||
{#each trades as trade (trade.orderNo + (trade.exitTime ?? ''))}
|
||||
{@const pl = ((trade.exitPrice ?? 0) - trade.buyPrice) * trade.qty}
|
||||
{@const plRate = trade.buyPrice > 0 ? ((trade.exitPrice ?? 0) - trade.buyPrice) / trade.buyPrice * 100 : 0}
|
||||
<tr class="hover:bg-gray-700">
|
||||
<td class="px-4 py-3">
|
||||
<div class="text-sm font-medium text-white">{trade.name}</div>
|
||||
<div class="text-xs text-gray-500">{trade.code}</div>
|
||||
</td>
|
||||
<td class="px-3 py-3 text-center">
|
||||
<span class="text-xs px-2 py-0.5 rounded bg-blue-900/50 text-blue-300">매도</span>
|
||||
</td>
|
||||
<td class="px-3 py-3 text-right text-sm text-gray-300">{trade.qty}</td>
|
||||
<td class="px-3 py-3 text-right text-sm font-mono text-gray-300">{formatPrice(trade.buyPrice)}</td>
|
||||
<td class="px-3 py-3 text-right text-sm font-mono {priceClass(pl)}">{formatPrice(trade.exitPrice ?? 0)}</td>
|
||||
<td class="px-3 py-3 text-right text-sm font-mono {priceClass(pl)}">
|
||||
{pl >= 0 ? '+' : ''}{formatPrice(pl)}
|
||||
</td>
|
||||
<td class="px-3 py-3 text-right text-sm {priceClass(plRate)}">
|
||||
{plRate >= 0 ? '+' : ''}{plRate.toFixed(2)}%
|
||||
</td>
|
||||
<td class="px-3 py-3 text-center">
|
||||
<span class="text-xs px-2 py-0.5 rounded {
|
||||
trade.exitReason === '익절' ? 'bg-red-900/50 text-red-300' :
|
||||
trade.exitReason === '손절' ? 'bg-blue-900/50 text-blue-300' :
|
||||
'bg-gray-700 text-gray-400'
|
||||
}">{trade.exitReason ?? '-'}</span>
|
||||
</td>
|
||||
<td class="px-3 py-3 text-right text-xs text-gray-400">{formatTime(trade.exitTime ?? '')}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- 로그 탭 -->
|
||||
{:else if activeTab === 'logs'}
|
||||
<div class="bg-gray-800 rounded-xl p-4 font-mono text-xs space-y-1 max-h-[60vh] overflow-auto">
|
||||
|
||||
Reference in New Issue
Block a user