Files
fin-tracker/app/packages/api_client/doc/RebalanceApi.md
T
Dmitry baac83149f fix(api): Decimal-параметр ребалансировки ломал генерацию Dart-клиента
cash_available был bare Decimal | None в Query(...) — pydantic отдаёт для
Decimal anyOf[number, pattern-string], который openapi-generator не умеет
свернуть в один тип и вместо этого синтезирует пустой класс CashAvailable
без полей (синтаксически битый .dart, компиляция всего пакета падает).
Остальные Decimal-поля в API давно оборачиваются в Money/MoneyOpt
(api/schemas/common.py) ровно за счёт этого — anyOf[string, null] генератор
понимает. cash_available обошёл соглашение, потому что это единственный
Decimal-параметр запроса во всём API, а не тело ответа.
2026-09-19 10:56:33 +03:00

150 lines
4.6 KiB
Markdown

# fintracker_api.api.RebalanceApi
## Load the API package
```dart
import 'package:fintracker_api/api.dart';
```
All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[**rebalanceRebalance**](RebalanceApi.md#rebalancerebalance) | **GET** /api/v1/portfolios/{portfolio_id}/rebalance | Rebalance
[**rebalanceSetTargets**](RebalanceApi.md#rebalancesettargets) | **PUT** /api/v1/portfolios/{portfolio_id}/targets | Set Targets
[**rebalanceTargets**](RebalanceApi.md#rebalancetargets) | **GET** /api/v1/portfolios/{portfolio_id}/targets | Targets
# **rebalanceRebalance**
> RebalanceOut rebalanceRebalance(portfolioId, dimension, cashAvailable)
Rebalance
### Example
```dart
import 'package:fintracker_api/api.dart';
final api = FintrackerApi().getRebalanceApi();
final int portfolioId = 56; // int |
final String dimension = dimension_example; // String | asset_class | sector | country | currency
final String cashAvailable = cashAvailable_example; // String | переопределяет остаток на счетах для what-if
try {
final response = api.rebalanceRebalance(portfolioId, dimension, cashAvailable);
print(response);
} on DioException catch (e) {
print('Exception when calling RebalanceApi->rebalanceRebalance: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**portfolioId** | **int**| |
**dimension** | **String**| asset_class | sector | country | currency | [optional] [default to 'asset_class']
**cashAvailable** | **String**| переопределяет остаток на счетах для what-if | [optional]
### Return type
[**RebalanceOut**](RebalanceOut.md)
### Authorization
[HTTPBearer](../README.md#HTTPBearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/problem+json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **rebalanceSetTargets**
> TargetsOut rebalanceSetTargets(portfolioId, targetsIn)
Set Targets
Replace the whole set for one dimension. The weights must add up to 1 within `WEIGHT_TOLERANCE`; otherwise the request is refused with the actual sum in the message, so the user can see by how much the plan misses rather than being handed a silently rescaled one.
### Example
```dart
import 'package:fintracker_api/api.dart';
final api = FintrackerApi().getRebalanceApi();
final int portfolioId = 56; // int |
final TargetsIn targetsIn = ; // TargetsIn |
try {
final response = api.rebalanceSetTargets(portfolioId, targetsIn);
print(response);
} on DioException catch (e) {
print('Exception when calling RebalanceApi->rebalanceSetTargets: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**portfolioId** | **int**| |
**targetsIn** | [**TargetsIn**](TargetsIn.md)| |
### Return type
[**TargetsOut**](TargetsOut.md)
### Authorization
[HTTPBearer](../README.md#HTTPBearer)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json, application/problem+json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **rebalanceTargets**
> TargetsOut rebalanceTargets(portfolioId, dimension)
Targets
### Example
```dart
import 'package:fintracker_api/api.dart';
final api = FintrackerApi().getRebalanceApi();
final int portfolioId = 56; // int |
final String dimension = dimension_example; // String | asset_class | sector | country | currency
try {
final response = api.rebalanceTargets(portfolioId, dimension);
print(response);
} on DioException catch (e) {
print('Exception when calling RebalanceApi->rebalanceTargets: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**portfolioId** | **int**| |
**dimension** | **String**| asset_class | sector | country | currency | [optional] [default to 'asset_class']
### Return type
[**TargetsOut**](TargetsOut.md)
### Authorization
[HTTPBearer](../README.md#HTTPBearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json, application/problem+json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)