Update bundle backtests

This commit is contained in:
2025-10-12 15:42:38 +07:00
parent 5acc77650f
commit 32ac342a20
7 changed files with 40 additions and 48 deletions

View File

@@ -4399,7 +4399,6 @@ export interface RunBundleBacktestRequest {
}
export interface BundleBacktestUniversalConfig {
accountName: string;
timeframe: Timeframe;
isForWatchingOnly: boolean;
botTradingBalance: number;

View File

@@ -1,6 +1,5 @@
import React, {useEffect, useRef, useState} from 'react';
import {
AccountClient,
BacktestClient,
BundleBacktestRequest,
BundleBacktestUniversalConfig,
@@ -47,7 +46,6 @@ const BundleRequestModal: React.FC<BundleRequestModalProps> = ({
// Form state for creating new bundle requests
const [strategyName, setStrategyName] = useState<string>('');
const [selectedAccount, setSelectedAccount] = useState<string>('');
const [selectedTimeframe, setSelectedTimeframe] = useState<Timeframe>(Timeframe.FifteenMinutes);
const [selectedTickers, setSelectedTickers] = useState<Ticker[]>([]);
const [startingCapital, setStartingCapital] = useState<number>(10000);
@@ -70,15 +68,9 @@ const BundleRequestModal: React.FC<BundleRequestModalProps> = ({
// API clients
const backtestClient = new BacktestClient({} as any, apiUrl);
const accountClient = new AccountClient({} as any, apiUrl);
const dataClient = new DataClient({} as any, apiUrl);
// Fetch data
const { data: accounts } = useQuery({
queryFn: () => accountClient.account_GetAccounts(),
queryKey: ['accounts'],
});
const { data: tickers } = useQuery({
queryFn: () => dataClient.data_GetTickers(selectedTimeframe),
queryKey: ['tickers', selectedTimeframe],
@@ -210,7 +202,7 @@ const BundleRequestModal: React.FC<BundleRequestModalProps> = ({
// Create bundle backtest request
const handleCreateBundle = async () => {
if (!strategyName || !selectedAccount || selectedTickers.length === 0) {
if (!strategyName || selectedTickers.length === 0) {
new Toast('Please fill in all required fields', false);
return;
}
@@ -221,7 +213,6 @@ const BundleRequestModal: React.FC<BundleRequestModalProps> = ({
}
const universalConfig: BundleBacktestUniversalConfig = {
accountName: selectedAccount,
timeframe: selectedTimeframe,
isForWatchingOnly: false,
botTradingBalance: startingCapital,
@@ -439,21 +430,6 @@ const BundleRequestModal: React.FC<BundleRequestModalProps> = ({
/>
</FormInput>
{/* Account Selection */}
<FormInput label="Select Account" htmlFor="account">
<select
className="select select-bordered w-full"
value={selectedAccount}
onChange={(e) => setSelectedAccount(e.target.value)}
>
<option value="" disabled>Select an account</option>
{accounts?.map((account) => (
<option key={account.name} value={account.name}>
{account.name}
</option>
))}
</select>
</FormInput>
{/* Scenario Builder */}
<div>
@@ -834,7 +810,7 @@ const BundleRequestModal: React.FC<BundleRequestModalProps> = ({
<button
className="btn btn-primary w-full mb-4"
onClick={handleCreateBundle}
disabled={!strategyName || !selectedAccount || selectedTickers.length === 0 || !scenario}
disabled={!strategyName || selectedTickers.length === 0 || !scenario}
>
Run Backtest
</button>