Загрузка данных


import type { PriceScaleMode } from 'lightweight-charts';

import { DataSource } from '@core/DataSource';
import { DrawingsManagerSnapshot } from '@core/DrawingsManager';
import { ChartSeriesType, IndicatorsIds, Timeframes } from '@lib';
import { IndicatorConfig } from '@src/types/indicator';

export type PriceScaleSide = 'left' | 'right';

export interface ISerializable<T extends object> {
  getSnapshot: () => T;
}

export interface InitialSnapshot {
  timeframe: Timeframes; // todo: move to snap
  chartSeriesType: ChartSeriesType; // todo: move to snap
  symbol: string; // todo: move to snap
}

export interface MoexChartSnapshot {
  // settings: ChartSettingsSnapshot;
  charts: ChartSnapshot[];
}

export interface ChartSnapshot {
  timeframe: Timeframes;
  chartSeriesType: ChartSeriesType;
  symbol: string;
  panes: PaneSnapshot[];
}

export interface PriceScaleSnapshot {
  side: PriceScaleSide;
  mode: PriceScaleMode;
}

export interface PaneSnapshot {
  isMain: boolean;
  id: number;
  indicators: IndicatorSnapshot[];
  drawings: DrawingsManagerSnapshot;
  priceScales: PriceScaleSnapshot[];
}

export interface IndicatorSnapshot extends Partial<DOMObjectSnapshot> {
  dataSource?: DataSource;
  indicatorType: IndicatorsIds | undefined; // if indicatorType is undefined, then its compareIndicator
  config?: IndicatorConfig;
}

// todo: move DrawingsManagerSnapshot here

export interface DOMObjectSnapshot {
  id: string;
  name: string;
  zIndex: number;
  hidden: boolean;
  paneId: number;
}