goldenChat base source add
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
/** 캔들차트 상단(tv-legend) 항목별 표시 여부 */
|
||||
export interface ChartLegendVisibility {
|
||||
/** 종목 코드 + 방향 점 */
|
||||
symbol: boolean;
|
||||
/** 타임프레임 (5m, 1D 등) */
|
||||
timeframe: boolean;
|
||||
/** 업비트 실시간 연결 상태 배지 */
|
||||
liveStatus: boolean;
|
||||
/** 매매(그리기) 모드 배지 */
|
||||
tradingBadge: boolean;
|
||||
open: boolean;
|
||||
high: boolean;
|
||||
low: boolean;
|
||||
close: boolean;
|
||||
/** 전봉 대비 변동 금액·% */
|
||||
change: boolean;
|
||||
/** 보조지표 이름 뱃지 */
|
||||
indicators: boolean;
|
||||
/** 보조지표 현재 값 */
|
||||
indicatorValues: boolean;
|
||||
}
|
||||
|
||||
export const DEFAULT_CHART_LEGEND_VISIBILITY: ChartLegendVisibility = {
|
||||
symbol: true,
|
||||
timeframe: true,
|
||||
liveStatus: true,
|
||||
tradingBadge: true,
|
||||
open: true,
|
||||
high: true,
|
||||
low: true,
|
||||
close: true,
|
||||
change: true,
|
||||
indicators: true,
|
||||
indicatorValues: true,
|
||||
};
|
||||
|
||||
export function resolveChartLegendOptions(
|
||||
raw?: Partial<ChartLegendVisibility> | null,
|
||||
): ChartLegendVisibility {
|
||||
if (!raw || typeof raw !== 'object') return { ...DEFAULT_CHART_LEGEND_VISIBILITY };
|
||||
const out = { ...DEFAULT_CHART_LEGEND_VISIBILITY };
|
||||
for (const key of Object.keys(DEFAULT_CHART_LEGEND_VISIBILITY) as (keyof ChartLegendVisibility)[]) {
|
||||
if (typeof raw[key] === 'boolean') out[key] = raw[key]!;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** 설정 화면 토글 라벨 */
|
||||
export const CHART_LEGEND_SETTING_ITEMS: {
|
||||
key: keyof ChartLegendVisibility;
|
||||
label: string;
|
||||
desc: string;
|
||||
}[] = [
|
||||
{ key: 'symbol', label: '종목', desc: '차트 상단에 거래 종목 코드를 표시합니다.' },
|
||||
{ key: 'timeframe', label: '타임프레임', desc: '현재 차트 주기(5m, 1D 등)를 표시합니다.' },
|
||||
{ key: 'liveStatus', label: '실시간 상태', desc: '업비트 WebSocket 연결 상태(실시간·재연결 등)를 표시합니다.' },
|
||||
{ key: 'tradingBadge', label: '매매 모드', desc: '매매(그리기) 모드일 때 편집 배지를 표시합니다.' },
|
||||
{ key: 'open', label: '시가 (O)', desc: '현재(또는 크로스헤어) 봉의 시가를 표시합니다.' },
|
||||
{ key: 'high', label: '고가 (H)', desc: '현재(또는 크로스헤어) 봉의 고가를 표시합니다.' },
|
||||
{ key: 'low', label: '저가 (L)', desc: '현재(또는 크로스헤어) 봉의 저가를 표시합니다.' },
|
||||
{ key: 'close', label: '종가 (C)', desc: '현재(또는 크로스헤어) 봉의 종가를 표시합니다.' },
|
||||
{ key: 'change', label: '변동', desc: '전봉 대비 변동 금액과 비율을 표시합니다.' },
|
||||
{ key: 'indicators', label: '보조지표 이름', desc: '차트에 적용된 보조지표 이름 뱃지를 표시합니다.' },
|
||||
{ key: 'indicatorValues', label: '보조지표 값', desc: '보조지표 이름 옆에 현재 수치를 표시합니다.' },
|
||||
];
|
||||
@@ -0,0 +1,171 @@
|
||||
export type Timeframe = '1m' | '3m' | '5m' | '15m' | '30m' | '1h' | '4h' | '1D' | '1W' | '1M';
|
||||
export type ChartType = 'candlestick' | 'bar' | 'line' | 'area' | 'baseline';
|
||||
export type Theme = 'dark' | 'light' | 'blue';
|
||||
export type ChartMode = 'chart' | 'trading'; // 차트뷰 / 트레이딩뷰
|
||||
|
||||
export interface OHLCVBar {
|
||||
time: number;
|
||||
open: number;
|
||||
high: number;
|
||||
low: number;
|
||||
close: number;
|
||||
volume: number;
|
||||
}
|
||||
|
||||
export interface IndicatorParam {
|
||||
name: string;
|
||||
type: 'number' | 'string' | 'boolean';
|
||||
default: number | string | boolean;
|
||||
min?: number;
|
||||
max?: number;
|
||||
}
|
||||
|
||||
export interface HlinesBackground {
|
||||
/** 배경 표시 여부 */
|
||||
visible: boolean;
|
||||
/** 과열선~침체선 사이 배경 색상 (HEX + AA) */
|
||||
color: string;
|
||||
}
|
||||
|
||||
export interface IndicatorConfig {
|
||||
id: string;
|
||||
type: string;
|
||||
params: Record<string, number | string | boolean>;
|
||||
plots?: import('../utils/indicatorRegistry').PlotDef[];
|
||||
hlines?: import('../utils/indicatorRegistry').HLineDef[];
|
||||
/** true 이면 차트에서 숨김 (시리즈를 추가하지 않음) */
|
||||
hidden?: boolean;
|
||||
/** plot ID → false 이면 해당 플롯 선 숨김 */
|
||||
plotVisibility?: Record<string, boolean>;
|
||||
/** 일목균형표 구름 영역 색상 (상승/하락) */
|
||||
cloudColors?: import('../utils/ichimokuConfig').IchimokuCloudColors;
|
||||
/** 과열선~침체선 사이 배경 음영 설정 (기본: visible=true, 반투명 회색) */
|
||||
hlinesBackground?: HlinesBackground;
|
||||
/** 볼린저밴드 어퍼~로우어 사이 배경 (업비트 백그라운드 그리기) */
|
||||
bandBackground?: HlinesBackground;
|
||||
/** 가격 스케일 라벨(우측 축) 표시 여부 (기본 true) */
|
||||
lastValueVisible?: boolean;
|
||||
/** 타임프레임별 표시 여부. undefined 이면 모든 타임프레임에서 표시 */
|
||||
timeframeVisibility?: Partial<Record<Timeframe, boolean>>;
|
||||
/** 다른 보조지표 pane 과 합침 — 대상 지표 id (호스트) */
|
||||
mergedWith?: string;
|
||||
}
|
||||
|
||||
export interface LegendData {
|
||||
time: number;
|
||||
open: number;
|
||||
high: number;
|
||||
low: number;
|
||||
close: number;
|
||||
volume: number;
|
||||
/** 크로스헤어 Y축 기준 가격 (메인 차트) */
|
||||
crosshairPrice?: number;
|
||||
/** 크로스헤어 위치의 보조지표 값 { indicatorType → 각 plot 값 배열 } */
|
||||
indicatorValues?: Record<string, number[]>;
|
||||
}
|
||||
|
||||
/** 매수·매도 패널 자동 입력 요청 */
|
||||
export interface TradeOrderFillRequest {
|
||||
market: string;
|
||||
price: number;
|
||||
side: 'buy' | 'sell';
|
||||
seq: number;
|
||||
}
|
||||
|
||||
export type DrawingToolId =
|
||||
// ─ 기본 ─
|
||||
| 'cursor'
|
||||
// ─ 선 ─
|
||||
| 'trendline' | 'extended_line' | 'ray' | 'arrow' | 'trend_angle' | 'info_line'
|
||||
| 'hline' | 'hline_ray' | 'vline' | 'cross_line'
|
||||
// ─ 채널 ─
|
||||
| 'channel' | 'parallel_channel' | 'disjoint_channel' | 'flat_top_bottom'
|
||||
// ─ 피보나치 ─
|
||||
| 'fib' | 'fib_ext' | 'fib_channel' | 'fibtz'
|
||||
| 'fib_speed_fan' | 'fib_trend_time' | 'fib_circles' | 'fib_spiral' | 'fib_speed_arc' | 'fib_wedge'
|
||||
// ─ 갠 / 피치포크 ─
|
||||
| 'pitchfork' | 'pitchfork_schiff' | 'pitchfork_inside'
|
||||
| 'gann_box' | 'gann_square' | 'gann_fan'
|
||||
// ─ 패턴 ─
|
||||
| 'xabcd' | 'cypher' | 'abcd' | 'head_shoulders' | 'wedge_pattern' | 'three_drives'
|
||||
| 'elliott_impulse' | 'elliott_correction' | 'elliott_triangle_wave' | 'elliott_double_combo'
|
||||
// ─ 프로젝션 ─
|
||||
| 'long_position' | 'short_position'
|
||||
| 'forecast' | 'bar_pattern' | 'ghost_feed' | 'projection_tool'
|
||||
| 'anchored_vwap' | 'fixed_volume_profile' | 'price_range'
|
||||
// ─ 도형 ─
|
||||
| 'rect' | 'rotated_rect' | 'circle' | 'ellipse' | 'triangle' | 'parallelogram' | 'polyline' | 'arc'
|
||||
// ─ 브러쉬 ─
|
||||
| 'pencil' | 'highlight'
|
||||
// ─ 화살표 ─
|
||||
| 'arrow_mark' | 'anchored_arrow'
|
||||
| 'arrow_mark_up' | 'arrow_mark_down' | 'arrow_mark_left' | 'arrow_mark_right'
|
||||
// ─ 텍스트 & 노트 ─
|
||||
| 'text' | 'fixed_text' | 'note_text' | 'price_note' | 'pin_mark' | 'table_tool'
|
||||
| 'callout' | 'comment_mark' | 'price_label' | 'guide_line' | 'flag_mark'
|
||||
// ─ 측정 ─
|
||||
| 'measure' | 'date_range' | 'date_price_range' | 'data_window'
|
||||
// ─ 확대/축소 ─
|
||||
| 'zoom' | 'magnifier';
|
||||
|
||||
export type DrawingStyle = 'solid' | 'dashed' | 'dotted';
|
||||
|
||||
export interface DrawingPoint { time: number; price: number; }
|
||||
|
||||
// ─── 피보나치 타임존 설정 ───────────────────────────────────────────────────
|
||||
export interface FibTZBaseline {
|
||||
color: string;
|
||||
lineWidth: number;
|
||||
style: DrawingStyle;
|
||||
}
|
||||
|
||||
export interface FibTZLevel {
|
||||
value: number;
|
||||
enabled: boolean;
|
||||
color: string;
|
||||
lineWidth: number;
|
||||
style: DrawingStyle;
|
||||
}
|
||||
|
||||
export interface FibTZSettings {
|
||||
baseline: FibTZBaseline;
|
||||
levels: FibTZLevel[];
|
||||
}
|
||||
|
||||
export const DEFAULT_FIB_TZ_SETTINGS: FibTZSettings = {
|
||||
baseline: { color: '#9E9E9E', lineWidth: 2, style: 'solid' },
|
||||
levels: [
|
||||
{ value: 1, enabled: true, color: '#2196F3', lineWidth: 1, style: 'dashed' },
|
||||
{ value: 2, enabled: true, color: '#4CAF50', lineWidth: 1, style: 'dashed' },
|
||||
{ value: 3, enabled: true, color: '#FF9800', lineWidth: 1, style: 'dashed' },
|
||||
{ value: 5, enabled: true, color: '#E91E63', lineWidth: 1, style: 'dashed' },
|
||||
{ value: 8, enabled: true, color: '#9C27B0', lineWidth: 1, style: 'dashed' },
|
||||
{ value: 13, enabled: true, color: '#00BCD4', lineWidth: 1, style: 'dashed' },
|
||||
{ value: 21, enabled: true, color: '#8BC34A', lineWidth: 1, style: 'dashed' },
|
||||
{ value: 34, enabled: true, color: '#FF5722', lineWidth: 1, style: 'dashed' },
|
||||
{ value: 55, enabled: true, color: '#607D8B', lineWidth: 1, style: 'dashed' },
|
||||
{ value: 89, enabled: true, color: '#795548', lineWidth: 1, style: 'dashed' },
|
||||
],
|
||||
};
|
||||
|
||||
/** 메인 차트(캔들) 색상 스타일 */
|
||||
export interface MainChartStyle {
|
||||
upColor: string;
|
||||
downColor: string;
|
||||
borderUpColor: string;
|
||||
borderDownColor: string;
|
||||
wickUpColor: string;
|
||||
wickDownColor: string;
|
||||
}
|
||||
|
||||
export interface Drawing {
|
||||
id: string;
|
||||
type: DrawingToolId;
|
||||
points: DrawingPoint[];
|
||||
color: string;
|
||||
lineWidth: number;
|
||||
style: DrawingStyle;
|
||||
text?: string;
|
||||
visible?: boolean; // undefined = true
|
||||
fibtzSettings?: FibTZSettings; // fibtz 전용
|
||||
}
|
||||
Reference in New Issue
Block a user