mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 08:15:15 +00:00
Merge pull request #628 from c9s/feature/optimizer
fix: fix summary report intervals
This commit is contained in:
commit
f38d165960
|
@ -235,7 +235,7 @@ const ReportDetails = (props: ReportDetailsProps) => {
|
|||
{
|
||||
reportSummary.symbols.map((symbol: string, i: number) => {
|
||||
return <TradingViewChart key={i} basePath={props.basePath} runID={props.runID} reportSummary={reportSummary}
|
||||
symbol={symbol} intervals={["1m", "5m", "1h"]}/>
|
||||
symbol={symbol}/>
|
||||
})
|
||||
}
|
||||
</div>
|
||||
|
|
|
@ -329,10 +329,8 @@ const TradingViewChart = (props) => {
|
|||
const chartContainerRef = useRef();
|
||||
const chart = useRef();
|
||||
const resizeObserver = useRef();
|
||||
const [data, setData] = useState(null);
|
||||
const [currentInterval, setCurrentInterval] = useState('5m');
|
||||
|
||||
const intervals = props.intervals || [];
|
||||
const intervals = props.reportSummary.intervals || [];
|
||||
|
||||
useEffect(() => {
|
||||
if (!chartContainerRef.current || chartContainerRef.current.children.length > 0) {
|
||||
|
|
|
@ -28,6 +28,7 @@ export interface ReportSummary {
|
|||
endTime: Date;
|
||||
sessions: string[];
|
||||
symbols: string[];
|
||||
intervals: string[];
|
||||
initialTotalBalances: BalanceMap;
|
||||
finalTotalBalances: BalanceMap;
|
||||
symbolReports: SymbolReport[];
|
||||
|
|
|
@ -372,7 +372,6 @@ var BacktestCmd = &cobra.Command{
|
|||
defer func() { _ = ordersTsv.Close() }()
|
||||
_ = ordersTsv.Write(types.Order{}.CsvHeader())
|
||||
|
||||
defer ordersTsv.Flush()
|
||||
for _, exSource := range exchangeSources {
|
||||
exSource.Session.UserDataStream.OnOrderUpdate(func(order types.Order) {
|
||||
if order.Status == types.OrderStatusFilled {
|
||||
|
@ -463,14 +462,17 @@ var BacktestCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
allKLineIntervals := map[types.Interval]struct{}{}
|
||||
for _, interval := range backTestIntervals {
|
||||
allKLineIntervals[interval] = struct{}{}
|
||||
}
|
||||
|
||||
for _, session := range environ.Sessions() {
|
||||
for _, sub := range session.Subscriptions {
|
||||
if sub.Channel == types.KLineChannel {
|
||||
allKLineIntervals[types.Interval(sub.Options.Interval)] = struct{}{}
|
||||
allKLineIntervals[sub.Options.Interval] = struct{}{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for interval := range allKLineIntervals {
|
||||
summaryReport.Intervals = append(summaryReport.Intervals, interval)
|
||||
}
|
||||
|
@ -584,7 +586,7 @@ func createSymbolReport(userConfig *bbgo.Config, session *bbgo.ExchangeSession,
|
|||
sessionKLineIntervals := map[types.Interval]struct{}{}
|
||||
for _, sub := range session.Subscriptions {
|
||||
if sub.Channel == types.KLineChannel {
|
||||
sessionKLineIntervals[types.Interval(sub.Options.Interval)] = struct{}{}
|
||||
sessionKLineIntervals[sub.Options.Interval] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user