자동매매 - 주식 시세

자동매매

{#if status} {status.running ? '실행 중' : '중지됨'} 포지션 {status.activePositions}개 오늘 {status.tradeCount}건 오늘 손익 {status.totalPL >= 0 ? '+' : ''}{formatPrice(status.totalPL)} {/if}

감시 소스

감시 테마
{ showThemeDropdown = true }} onblur={() => { setTimeout(() => { showThemeDropdown = false }, 200) }} placeholder="테마 검색..." class="w-full bg-gray-700 border border-gray-600 rounded px-3 py-1.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-blue-500" /> {#if showThemeDropdown && filteredThemes.length > 0}
{#each filteredThemes as theme (theme.code)} {/each}
{/if}
{#if watchSource.selectedThemes.length > 0}
{#each watchSource.selectedThemes as theme (theme.code)} {theme.name} {/each}
{:else}
선택된 테마 없음
{/if}
{#each [['rules', `규칙 (${rules.length})`], ['positions', `포지션 (${positions.length})`], ['trades', `거래 (${trades.length})`], ['logs', '로그']] as [tab, label]} {/each}
{#if activeTab === 'rules'}
{#if rules.length === 0}
규칙을 추가해보세요
{:else}
{#each rules as rule (rule.id)}
{rule.name} {rule.enabled ? '활성' : '비활성'}
진입점수 {rule.minRiseScore}↑ 체결강도 {rule.minCntrStr}↑ 주문금액 {formatPrice(rule.orderAmount)} 최대 {rule.maxPositions}종목 익절 +{rule.takeProfitPct}% 손절 {rule.stopLossPct}% {#if rule.maxHoldMinutes > 0} 최대 {rule.maxHoldMinutes}분 {/if}
{/each}
{/if} {:else if activeTab === 'positions'} {#if positions.length === 0}
보유 포지션 없음
{:else}
{#each positions as pos (pos.code + pos.orderNo)} {/each}
종목 수량 매수가 손절가 익절가 상태 진입시각
{pos.name}
{pos.code}
{pos.qty} {formatPrice(pos.buyPrice)} {formatPrice(pos.stopLoss)} {formatPrice(pos.takeProfit)} {pos.status} {formatTime(pos.entryTime)} {#if pos.status === 'open' || pos.status === 'pending'} {:else if pos.exitReason} {pos.exitReason} {/if}
{/if} {:else if activeTab === 'trades'} {#if trades.length === 0}
거래 내역 없음
{:else}
{#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} {/each}
종목 구분 수량 매수가 매도가 손익 수익률 사유 청산시각
{trade.name}
{trade.code}
매도 {trade.qty} {formatPrice(trade.buyPrice)} {formatPrice(trade.exitPrice ?? 0)} {pl >= 0 ? '+' : ''}{formatPrice(pl)} {plRate >= 0 ? '+' : ''}{plRate.toFixed(2)}% {trade.exitReason ?? '-'} {formatTime(trade.exitTime ?? '')}
{/if} {:else if activeTab === 'logs'}
{#if logs.length === 0}
로그 없음
{/if} {#each logs as log}
{formatTime(log.at)} [{log.level}] {#if log.code} {log.code} {/if} {log.message}
{/each}
{/if} { showRuleModal = false }}> {#if editingRule}
{/if}