chart-0714
Version:
Professional trading chart library with advanced customization for trading journal apps
106 lines (105 loc) • 2.87 kB
TypeScript
import { Chart } from '../core/Chart';
import { Timeframe } from './timeframeDetector';
export interface TimeframeMAConfig {
type: 'SMA' | 'EMA';
period: number;
color: string;
lineWidth?: number;
source?: 'open' | 'high' | 'low' | 'close';
}
export interface CustomResamplingConfig {
id: string;
name: string;
sourceTimeframe: string;
sourceCount: number;
targetMinutes: number;
enabled: boolean;
indicators?: TimeframeMAConfig[];
}
export interface TradingJournalChartSettings {
timeframeMASettings: {
[timeframe: string]: {
enabled: boolean;
indicators: TimeframeMAConfig[];
};
};
customResampling: CustomResamplingConfig[];
defaultChartSettings?: {
theme?: string;
chartType?: 'candle' | 'bar' | 'hollow';
volumeEnabled?: boolean;
};
}
/**
* 매매일지와 연동되는 차트 설정 관리자
*/
export declare class TradingJournalSettingsManager {
private chart;
private settings;
private currentResampling;
private appliedIndicatorIds;
private apiEndpoint;
private userId;
constructor(chart: Chart, apiEndpoint: string, userId: string);
/**
* API에서 설정 로드
*/
loadSettingsFromAPI(): Promise<void>;
/**
* 타임프레임별 이동평균선 설정 업데이트 및 저장
*/
updateTimeframeMASettings(timeframe: string, indicators: TimeframeMAConfig[]): Promise<void>;
/**
* 커스텀 리샘플링 추가
*/
addCustomResampling(config: Omit<CustomResamplingConfig, 'id'>): Promise<void>;
/**
* 현재 데이터에 맞는 설정 자동 적용
*/
autoApplySettings(): void;
/**
* 타임프레임별 이동평균선 적용
*/
applyTimeframeIndicators(timeframe: Timeframe): void;
/**
* 커스텀 리샘플링 적용 (예: 65분봉)
*/
applyCustomResampling(resamplingId: string): void;
/**
* 65분봉 빠른 적용
*/
apply65MinChart(): void;
/**
* 원본으로 복원
*/
restoreOriginal(): void;
/**
* 적용된 인디케이터 제거
*/
private clearAppliedIndicators;
/**
* 로컬 스토리지에 저장
*/
private saveToLocalStorage;
/**
* 로컬 스토리지에서 로드
*/
private loadFromLocalStorage;
/**
* 인증 토큰 가져오기 (실제 구현 필요)
*/
private getAuthToken;
/**
* 현재 설정 상태 조회
*/
getCurrentState(): {
settings: TradingJournalChartSettings;
isResampled: boolean;
currentResampling: CustomResamplingConfig | null;
appliedIndicators: string[];
};
/**
* 사용 가능한 리샘플링 프리셋 목록
*/
getAvailableResamplings(): CustomResamplingConfig[];
}