fix trading view chart intervals

This commit is contained in:
c9s 2022-05-20 00:48:15 +08:00
parent 590748b71d
commit ec2f0cd0b1
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
3 changed files with 3 additions and 4 deletions

View File

@ -235,7 +235,7 @@ const ReportDetails = (props: ReportDetailsProps) => {
{ {
reportSummary.symbols.map((symbol: string, i: number) => { reportSummary.symbols.map((symbol: string, i: number) => {
return <TradingViewChart key={i} basePath={props.basePath} runID={props.runID} reportSummary={reportSummary} return <TradingViewChart key={i} basePath={props.basePath} runID={props.runID} reportSummary={reportSummary}
symbol={symbol} intervals={["1m", "5m", "1h"]}/> symbol={symbol}/>
}) })
} }
</div> </div>

View File

@ -329,10 +329,8 @@ const TradingViewChart = (props) => {
const chartContainerRef = useRef(); const chartContainerRef = useRef();
const chart = useRef(); const chart = useRef();
const resizeObserver = useRef(); const resizeObserver = useRef();
const [data, setData] = useState(null);
const [currentInterval, setCurrentInterval] = useState('5m'); const [currentInterval, setCurrentInterval] = useState('5m');
const intervals = props.reportSummary.intervals || [];
const intervals = props.intervals || [];
useEffect(() => { useEffect(() => {
if (!chartContainerRef.current || chartContainerRef.current.children.length > 0) { if (!chartContainerRef.current || chartContainerRef.current.children.length > 0) {

View File

@ -28,6 +28,7 @@ export interface ReportSummary {
endTime: Date; endTime: Date;
sessions: string[]; sessions: string[];
symbols: string[]; symbols: string[];
intervals: string[];
initialTotalBalances: BalanceMap; initialTotalBalances: BalanceMap;
finalTotalBalances: BalanceMap; finalTotalBalances: BalanceMap;
symbolReports: SymbolReport[]; symbolReports: SymbolReport[];