{
let url_ = this.baseUrl + "/Scenario/strategy?";
if (strategyType === null)
throw new Error("The parameter 'strategyType' cannot be null.");
else if (strategyType !== undefined)
url_ += "strategyType=" + encodeURIComponent("" + strategyType) + "&";
- if (timeframe === null)
- throw new Error("The parameter 'timeframe' cannot be null.");
- else if (timeframe !== undefined)
- url_ += "timeframe=" + encodeURIComponent("" + timeframe) + "&";
if (name !== undefined && name !== null)
url_ += "name=" + encodeURIComponent("" + name) + "&";
if (period !== undefined && period !== null)
@@ -1583,7 +1581,7 @@ export class TradingClient extends AuthorizedApiBase {
let options_: RequestInit = {
body: content_,
- method: "GET",
+ method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
@@ -2206,11 +2204,11 @@ export interface Spotlight {
export interface Scenario {
name?: string | null;
strategies?: Strategy[] | null;
+ loopbackPeriod?: number | null;
}
export interface Strategy {
name?: string | null;
- timeframe?: Timeframe;
type?: StrategyType;
signalType?: SignalType;
minimumHistory?: number;
diff --git a/src/Managing.WebApp/src/global/type.tsx b/src/Managing.WebApp/src/global/type.tsx
index fb60a7e..f63569d 100644
--- a/src/Managing.WebApp/src/global/type.tsx
+++ b/src/Managing.WebApp/src/global/type.tsx
@@ -1,13 +1,30 @@
-import type {
- TableInstance,
- UsePaginationInstanceProps,
- UsePaginationState,
- UseSortByInstanceProps,
-} from 'react-table'
-import type { Edge, Node } from 'reactflow'
+import type {TableInstance, UsePaginationInstanceProps, UsePaginationState, UseSortByInstanceProps,} from 'react-table'
+import type {Edge, Node} from 'reactflow'
+
+import type {
+ Account,
+ AccountType,
+ Backtest,
+ Balance,
+ BotType,
+ Candle,
+ FlowOutput,
+ FlowType,
+ IFlow,
+ KeyValuePairOfDateTimeAndDecimal,
+ MoneyManagement,
+ Position,
+ RiskLevel,
+ Scenario,
+ Signal,
+ Ticker,
+ Timeframe,
+ TradeDirection,
+ TradingBot,
+ TradingExchanges
+} from '../generated/ManagingApi'
+import {FC, ReactNode} from 'react'
-import type { Account, AccountType, Backtest, Balance, BotType, Candle, FlowOutput, FlowType, IFlow, KeyValuePairOfDateTimeAndDecimal, MoneyManagement, Position, RiskLevel, Scenario, Signal, Ticker, Timeframe, TradeDirection, TradingBot, TradingExchanges } from '../generated/ManagingApi'
-import { ReactNode, FC } from 'react'
export type TabsType = {
label: string
index: number
@@ -156,6 +173,7 @@ export type IBotList = {
export type IScenarioFormInput = {
name: string
strategies: string[]
+ loopbackPeriod: number | undefined
}
export type IScenarioList = {
list: Scenario[]
diff --git a/src/Managing.WebApp/src/pages/scenarioPage/scenarioList.tsx b/src/Managing.WebApp/src/pages/scenarioPage/scenarioList.tsx
index 436a9bf..3bc8ef0 100644
--- a/src/Managing.WebApp/src/pages/scenarioPage/scenarioList.tsx
+++ b/src/Managing.WebApp/src/pages/scenarioPage/scenarioList.tsx
@@ -1,13 +1,13 @@
-import React, { useEffect, useState } from 'react'
-import type { SubmitHandler } from 'react-hook-form'
-import { useForm } from 'react-hook-form'
+import React, {useEffect, useState} from 'react'
+import type {SubmitHandler} from 'react-hook-form'
+import {useForm} from 'react-hook-form'
import 'react-toastify/dist/ReactToastify.css'
import useApiUrlStore from '../../app/store/apiStore'
-import { Modal, Toast } from '../../components/mollecules'
-import type { Scenario, Strategy } from '../../generated/ManagingApi'
-import { ScenarioClient } from '../../generated/ManagingApi'
-import type { IScenarioFormInput } from '../../global/type'
+import {Modal, Toast} from '../../components/mollecules'
+import type {Scenario, Strategy} from '../../generated/ManagingApi'
+import {ScenarioClient} from '../../generated/ManagingApi'
+import type {IScenarioFormInput} from '../../global/type'
import ScenarioTable from './scenarioTable'
@@ -22,7 +22,7 @@ const ScenarioList: React.FC = () => {
async function createScenario(form: IScenarioFormInput) {
const t = new Toast('Creating scenario')
await client
- .scenario_CreateScenario(form.name, form.strategies)
+ .scenario_CreateScenario(form.name, form.loopbackPeriod, form.strategies)
.then((data: Scenario) => {
t.update('success', 'Scenario created')
setScenarios((arr) => [...arr, data])
@@ -97,6 +97,17 @@ const ScenarioList: React.FC = () => {
+
+
+
+
+
+