./charting_library 图表库
./charting_library/static/view.css 图表库样式位置
./js/app.js 启动相关
./js/datafeeds.js 封装的数据源接口对象(UDF-JS-API)
./js/socket.js 封装的websocket对象
运行需要本地启动web server
例: cd trading-view-example && python3 -m http.server
startChart(baseUrl?: string , symbol?: string , language?: string , resolution?: string , theme? : string, chartType?: string):void;
例: startChart("192.168.21.135:8081", 'BTC_USDT', 'en', '5', 'light', '1')
initChart()
setTheme(theme: 'dark' | 'light');
setSymbol(trading_pair: string);
setLanguage(language: string);
setResolution(resolution: string): boolean;
间隔对照表,传左侧的数字字符串的值;
例: setResolution('240')
'1': '1m',
'5': '5m',
'15': '15m',
'30': '30m',
'60': '1h',
'240': '4h',
'1440': '1D',
'10080': '7D',
'43200': '1M',
setChartType(type: string); "3"为分时 "1"为正常;
createStudy(name, forceOverlay, lock, inputs, callback, overrides, options): string | boolean;
例: createStudy('Money Flow');
removeStudy(id): boolean;
创建指标时会返回指标的唯一标识(string);
getAllStudies(): [];
返回示例: [
{id: "QKqW9B", name: "Volume"},
{id: "bzJSHX", name: "MACD"},
]
createStudyAuto(studyName, type)
type: 主指标: 'first' 副指标: 'second';
studyName 传 空字符串("")时, 将影藏所有 指定类型(主或副)的指标;
例1: createStudyAuto('Relative Strength Index', 'second');
例2: createStudyAuto('', 'first') //隐藏所有主指标;
reset()
重置表单K线位置,大小至初始状态;