The Strategy Application is a React-based financial planning tool that provides cryptocurrency trading strategy analysis and calculation capabilities. It implements a ladder-based dollar-cost averaging (DCA) strategy calculator that helps users plan their cryptocurrency investments by modeling worst-case scenarios and calculating key financial metrics.
The application is designed as a multi-step wizard interface that guides users through price input, investment parameters configuration, and comprehensive report generation. For general information about frontend applications, see Frontend Applications. For wallet management and order tracking functionality, see Wallet Application.
The Strategy Application follows a wizard-based architecture built with React and Material-UI components, utilizing the react-declarative
framework for form management and navigation.
The application defines three main wizard steps with corresponding routes:
Step ID | Label | Component | Purpose |
---|---|---|---|
price |
Цена | PriceView |
Cryptocurrency price input |
amount |
Шаг | AmountView |
Investment parameters |
report |
Отчет | ReportView |
Strategy analysis report |
The application implements a three-step wizard interface that guides users through the strategy calculation process:
The PriceView
component handles cryptocurrency selection and price configuration. It supports five major cryptocurrencies with pre-configured default values and descriptions:
The component dynamically displays relevant fields based on the selected cryptocurrency symbol and validates user input for price and investment amount.
The core calculation logic is implemented in the generateReport
function, which performs ladder-based dollar-cost averaging calculations with commission consideration.
Parameter | Type | Description | Default |
---|---|---|---|
fiatAmount |
number | Total investment amount in USDT | - |
lastClosePrice |
number | Current cryptocurrency price | - |
ladderPercent |
number | Price decrease percentage per step | - |
orderPrice |
number | Amount invested per step | - |
priceGrowthRate |
number | Expected daily price growth | 1.5% |
commissionRate |
number | Trading commission rate | 0.2% |
The calculation engine implements comprehensive input validation:
// Validation conditions from generateReport.ts:13-24
- fiatAmount > 0
- lastClosePrice > 0
- 0 < ladderPercent < 100
- 0 < orderPrice <= fiatAmount
- priceGrowthRate > 0
- commissionRate >= 0
The generateReport
function produces comprehensive markdown reports with detailed financial analysis and projections.
The generated report includes the following sections:
Cryptocurrency Information (# Монета
)
Key Metrics (# Метрики
)
Worst-Case Scenario Table (# Наихудший сценарий
)
Profitability Analysis (# Доходность в наихудшем сценарии
)
The report generation implements several key financial calculations:
// Key formulas from generateReport.ts
const breakEvenPrice = totalSpent / totalCoins;
const stopPrice = steps[steps.length - 1].price;
const targetProfit = fiatAmount * 0.2; // 20% profit target
const profitPrice = (totalSpent + targetProfit) / totalCoins;
const daysToProfit = Math.ceil(
Math.log(profitPrice / stopPrice) / Math.log(dailyGrowthMultiplier)
);
The Strategy Application integrates with the backend API to fetch real-time cryptocurrency prices and supports report downloading functionality.
The application uses the /price/close_price
endpoint to fetch current cryptocurrency prices, which are then used as default values in the price input form.
The ReportView
component implements markdown report downloading through the downloadSubject
subscription mechanism, allowing users to save their strategy analysis reports locally.