@orderly.network/ui-tradingview
Version:
137 lines (129 loc) • 4 kB
text/typescript
import * as react from 'react';
import react__default from 'react';
import { LocaleCode } from '@orderly.network/i18n';
/**
* Color styling options for the loading screen (spinner)
*/
interface LoadingScreenOptions {
/** Colour of the spinner on the loading screen */
foregroundColor?: string;
/** Background color for the loading screen */
backgroundColor?: string;
}
type LanguageCode =
| 'ar'
| 'zh'
| 'ca_ES'
| 'en'
| 'fr'
| 'de'
| 'he_IL'
| 'id_ID'
| 'it'
| 'ja'
| 'ko'
| 'pl'
| 'pt'
| 'ru'
| 'es'
| 'sv'
| 'th'
| 'tr'
| 'vi'
| 'ms_MY'
| 'zh_TW';
declare enum ChartMode {
BASIC = 0,
ADVANCED = 1,
UNLIMITED = 2,
MOBILE = 3
}
interface ColorConfigInterface {
chartBG?: string;
upColor?: string;
downColor?: string;
pnlUpColor?: string;
pnlDownColor?: string;
pnlZoreColor?: string;
textColor?: string;
qtyTextColor?: string;
font?: string;
closeIcon?: string;
volumeUpColor?: string;
volumeDownColor?: string;
}
type TradingviewLocaleCode = LanguageCode;
interface TradingviewWidgetPropsInterface {
symbol?: string;
mode?: ChartMode;
scriptSRC?: string;
library_path?: string;
overrides?: Record<string, string>;
studiesOverrides?: Record<string, string>;
customCssUrl?: string;
colorConfig?: ColorConfigInterface;
libraryPath?: string;
fullscreen?: boolean;
theme?: string;
loadingScreen?: LoadingScreenOptions;
/**
* The locale of the tradingview.
* If locale does not match in TradingviewLocaleCode, it will default to "en".
* If locale is a function, you can use the current locale to return the TradingviewLocaleCode.
*/
locale?: TradingviewLocaleCode | ((localeCode: LocaleCode) => TradingviewLocaleCode);
onFullScreenChange?: (isFullScreen: boolean) => void;
classNames?: {
root?: string;
content?: string;
};
}
interface TradingviewUIPropsInterface {
tradingViewScriptSrc?: string;
chartRef: React.Ref<HTMLDivElement>;
interval?: string;
changeDisplaySetting: (setting: DisplayControlSettingInterface) => void;
displayControlState: DisplayControlSettingInterface;
changeInterval: (newInterval: string) => void;
lineType: string;
changeLineType: (newLineType: string) => void;
openChartSetting: () => void;
openChartIndicators: () => void;
symbol?: string;
onFullScreenChange: () => void;
classNames?: {
root?: string;
content?: string;
};
fullscreen?: boolean;
}
interface DisplayControlSettingInterface {
position: boolean;
buySell: boolean;
limitOrders: boolean;
stopOrders: boolean;
tpsl: boolean;
positionTpsl: boolean;
}
declare const TradingviewWidget: react.ForwardRefExoticComponent<TradingviewWidgetPropsInterface & react.RefAttributes<unknown>>;
declare const TradingviewUi: react__default.ForwardRefExoticComponent<TradingviewUIPropsInterface & react__default.RefAttributes<unknown>>;
declare function useTradingviewScript(props: TradingviewWidgetPropsInterface): {
tradingViewScriptSrc: string | undefined;
chartRef: react.RefObject<HTMLDivElement>;
changeDisplaySetting: (newSetting: DisplayControlSettingInterface) => void;
displayControlState: DisplayControlSettingInterface;
interval: string;
changeInterval: (newInterval: string) => void;
lineType: string;
changeLineType: (newLineType: string) => void;
openChartSetting: () => void;
openChartIndicators: () => void;
symbol: string | undefined;
onFullScreenChange: () => void;
classNames: {
root?: string;
content?: string;
} | undefined;
fullscreen: any;
};
export { type DisplayControlSettingInterface, type TradingviewLocaleCode, type TradingviewUIPropsInterface, TradingviewUi, TradingviewWidget, type TradingviewWidgetPropsInterface, useTradingviewScript };