2020-12-27 08:02:35 +00:00
|
|
|
from datetime import date, datetime
|
2024-11-07 20:37:33 +00:00
|
|
|
from typing import Any
|
2020-12-27 08:02:35 +00:00
|
|
|
|
2024-03-30 13:29:58 +00:00
|
|
|
from pydantic import AwareDatetime, BaseModel, RootModel, SerializeAsAny
|
2020-12-25 12:08:25 +00:00
|
|
|
|
2023-11-12 18:32:17 +00:00
|
|
|
from freqtrade.constants import IntOrInf
|
2023-06-04 11:25:39 +00:00
|
|
|
from freqtrade.enums import MarginMode, OrderTypeValues, SignalDirection, TradingMode
|
2024-09-04 04:44:48 +00:00
|
|
|
from freqtrade.ft_types import ValidExchangesType
|
2020-12-27 08:02:35 +00:00
|
|
|
|
2020-12-25 12:08:25 +00:00
|
|
|
|
2023-06-03 04:57:25 +00:00
|
|
|
class ExchangeModePayloadMixin(BaseModel):
|
2024-11-07 20:37:33 +00:00
|
|
|
trading_mode: TradingMode | None = None
|
|
|
|
margin_mode: MarginMode | None = None
|
|
|
|
exchange: str | None = None
|
2023-06-03 04:57:25 +00:00
|
|
|
|
|
|
|
|
2020-12-25 12:08:25 +00:00
|
|
|
class Ping(BaseModel):
|
|
|
|
status: str
|
|
|
|
|
2020-12-25 12:11:01 +00:00
|
|
|
|
2020-12-25 14:50:19 +00:00
|
|
|
class AccessToken(BaseModel):
|
|
|
|
access_token: str
|
|
|
|
|
|
|
|
|
|
|
|
class AccessAndRefreshToken(AccessToken):
|
|
|
|
refresh_token: str
|
|
|
|
|
|
|
|
|
2020-12-25 12:11:01 +00:00
|
|
|
class Version(BaseModel):
|
|
|
|
version: str
|
2020-12-25 12:08:25 +00:00
|
|
|
|
|
|
|
|
2020-12-25 19:07:12 +00:00
|
|
|
class StatusMsg(BaseModel):
|
|
|
|
status: str
|
|
|
|
|
|
|
|
|
2023-05-31 05:00:20 +00:00
|
|
|
class BgJobStarted(StatusMsg):
|
|
|
|
job_id: str
|
|
|
|
|
|
|
|
|
|
|
|
class BackgroundTaskStatus(BaseModel):
|
2023-05-31 05:08:27 +00:00
|
|
|
job_id: str
|
|
|
|
job_category: str
|
2023-05-31 05:00:20 +00:00
|
|
|
status: str
|
|
|
|
running: bool
|
2024-11-07 20:37:33 +00:00
|
|
|
progress: float | None = None
|
|
|
|
error: str | None = None
|
2023-05-31 05:00:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
class BackgroundTaskResult(BaseModel):
|
2024-11-07 20:37:33 +00:00
|
|
|
error: str | None = None
|
2023-05-31 05:00:20 +00:00
|
|
|
status: str
|
|
|
|
|
|
|
|
|
2020-12-26 16:33:27 +00:00
|
|
|
class ResultMsg(BaseModel):
|
|
|
|
result: str
|
|
|
|
|
|
|
|
|
2020-12-25 12:08:25 +00:00
|
|
|
class Balance(BaseModel):
|
|
|
|
currency: str
|
|
|
|
free: float
|
|
|
|
balance: float
|
|
|
|
used: float
|
2024-11-07 20:37:33 +00:00
|
|
|
bot_owned: float | None = None
|
2020-12-25 12:08:25 +00:00
|
|
|
est_stake: float
|
2024-11-07 20:37:33 +00:00
|
|
|
est_stake_bot: float | None = None
|
2020-12-25 12:08:25 +00:00
|
|
|
stake: str
|
2022-02-19 15:28:51 +00:00
|
|
|
# Starting with 2.x
|
|
|
|
side: str
|
|
|
|
is_position: bool
|
|
|
|
position: float
|
2023-04-22 12:57:13 +00:00
|
|
|
is_bot_managed: bool
|
2020-12-25 12:08:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Balances(BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
currencies: list[Balance]
|
2020-12-25 12:08:25 +00:00
|
|
|
total: float
|
2023-04-22 14:13:27 +00:00
|
|
|
total_bot: float
|
2020-12-25 12:08:25 +00:00
|
|
|
symbol: str
|
|
|
|
value: float
|
2023-04-22 14:13:27 +00:00
|
|
|
value_bot: float
|
2020-12-25 12:08:25 +00:00
|
|
|
stake: str
|
|
|
|
note: str
|
2021-09-19 11:16:30 +00:00
|
|
|
starting_capital: float
|
|
|
|
starting_capital_ratio: float
|
|
|
|
starting_capital_pct: float
|
|
|
|
starting_capital_fiat: float
|
|
|
|
starting_capital_fiat_ratio: float
|
|
|
|
starting_capital_fiat_pct: float
|
|
|
|
|
2020-12-26 14:54:22 +00:00
|
|
|
|
|
|
|
class Count(BaseModel):
|
|
|
|
current: int
|
|
|
|
max: int
|
|
|
|
total_stake: float
|
2020-12-26 15:43:15 +00:00
|
|
|
|
|
|
|
|
2023-11-11 16:16:31 +00:00
|
|
|
class __BaseStatsModel(BaseModel):
|
2023-11-11 13:43:24 +00:00
|
|
|
profit_ratio: float
|
|
|
|
profit_pct: float
|
|
|
|
profit_abs: float
|
|
|
|
count: int
|
|
|
|
|
|
|
|
|
2023-11-11 16:16:31 +00:00
|
|
|
class Entry(__BaseStatsModel):
|
|
|
|
enter_tag: str
|
|
|
|
|
|
|
|
|
|
|
|
class Exit(__BaseStatsModel):
|
2023-11-11 13:43:24 +00:00
|
|
|
exit_reason: str
|
|
|
|
|
|
|
|
|
2023-11-11 16:16:31 +00:00
|
|
|
class MixTag(__BaseStatsModel):
|
2023-11-11 13:43:24 +00:00
|
|
|
mix_tag: str
|
|
|
|
|
|
|
|
|
2023-11-11 16:16:31 +00:00
|
|
|
class PerformanceEntry(__BaseStatsModel):
|
2020-12-26 15:43:15 +00:00
|
|
|
pair: str
|
|
|
|
profit: float
|
|
|
|
|
|
|
|
|
|
|
|
class Profit(BaseModel):
|
|
|
|
profit_closed_coin: float
|
|
|
|
profit_closed_percent_mean: float
|
|
|
|
profit_closed_ratio_mean: float
|
|
|
|
profit_closed_percent_sum: float
|
|
|
|
profit_closed_ratio_sum: float
|
2021-07-14 18:55:11 +00:00
|
|
|
profit_closed_percent: float
|
|
|
|
profit_closed_ratio: float
|
2020-12-26 15:43:15 +00:00
|
|
|
profit_closed_fiat: float
|
|
|
|
profit_all_coin: float
|
|
|
|
profit_all_percent_mean: float
|
|
|
|
profit_all_ratio_mean: float
|
|
|
|
profit_all_percent_sum: float
|
|
|
|
profit_all_ratio_sum: float
|
2021-07-14 18:55:11 +00:00
|
|
|
profit_all_percent: float
|
|
|
|
profit_all_ratio: float
|
2020-12-26 15:43:15 +00:00
|
|
|
profit_all_fiat: float
|
|
|
|
trade_count: int
|
|
|
|
closed_trade_count: int
|
|
|
|
first_trade_date: str
|
2023-05-15 16:06:17 +00:00
|
|
|
first_trade_humanized: str
|
2020-12-26 15:43:15 +00:00
|
|
|
first_trade_timestamp: int
|
|
|
|
latest_trade_date: str
|
2023-05-15 16:06:17 +00:00
|
|
|
latest_trade_humanized: str
|
2020-12-26 15:43:15 +00:00
|
|
|
latest_trade_timestamp: int
|
|
|
|
avg_duration: str
|
|
|
|
best_pair: str
|
|
|
|
best_rate: float
|
2021-11-11 11:58:38 +00:00
|
|
|
best_pair_profit_ratio: float
|
2020-12-26 15:43:15 +00:00
|
|
|
winning_trades: int
|
|
|
|
losing_trades: int
|
2022-06-18 09:14:28 +00:00
|
|
|
profit_factor: float
|
2023-07-15 15:27:58 +00:00
|
|
|
winrate: float
|
|
|
|
expectancy: float
|
2023-07-17 13:16:22 +00:00
|
|
|
expectancy_ratio: float
|
2022-06-18 09:14:28 +00:00
|
|
|
max_drawdown: float
|
|
|
|
max_drawdown_abs: float
|
2023-09-04 16:27:45 +00:00
|
|
|
max_drawdown_start: str
|
|
|
|
max_drawdown_start_timestamp: int
|
|
|
|
max_drawdown_end: str
|
|
|
|
max_drawdown_end_timestamp: int
|
2024-11-07 20:37:33 +00:00
|
|
|
trading_volume: float | None = None
|
2023-04-08 14:40:22 +00:00
|
|
|
bot_start_timestamp: int
|
|
|
|
bot_start_date: str
|
2020-12-26 15:43:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SellReason(BaseModel):
|
|
|
|
wins: int
|
|
|
|
losses: int
|
|
|
|
draws: int
|
|
|
|
|
|
|
|
|
|
|
|
class Stats(BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
exit_reasons: dict[str, SellReason]
|
2024-11-07 20:37:33 +00:00
|
|
|
durations: dict[str, float | None]
|
2020-12-26 16:00:30 +00:00
|
|
|
|
|
|
|
|
2023-09-02 15:06:23 +00:00
|
|
|
class DailyWeeklyMonthlyRecord(BaseModel):
|
2020-12-26 16:33:27 +00:00
|
|
|
date: date
|
|
|
|
abs_profit: float
|
2022-06-11 09:28:45 +00:00
|
|
|
rel_profit: float
|
|
|
|
starting_balance: float
|
2020-12-26 16:33:27 +00:00
|
|
|
fiat_value: float
|
|
|
|
trade_count: int
|
|
|
|
|
|
|
|
|
2023-09-02 15:06:23 +00:00
|
|
|
class DailyWeeklyMonthly(BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
data: list[DailyWeeklyMonthlyRecord]
|
2020-12-26 16:33:27 +00:00
|
|
|
fiat_display_currency: str
|
|
|
|
stake_currency: str
|
|
|
|
|
|
|
|
|
2021-11-06 15:12:25 +00:00
|
|
|
class UnfilledTimeout(BaseModel):
|
2024-11-07 20:37:33 +00:00
|
|
|
entry: int | None = None
|
|
|
|
exit: int | None = None
|
|
|
|
unit: str | None = None
|
|
|
|
exit_timeout_count: int | None = None
|
2021-11-06 15:12:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
class OrderTypes(BaseModel):
|
2022-03-07 19:32:16 +00:00
|
|
|
entry: OrderTypeValues
|
|
|
|
exit: OrderTypeValues
|
2024-11-07 20:37:33 +00:00
|
|
|
emergency_exit: OrderTypeValues | None = None
|
|
|
|
force_exit: OrderTypeValues | None = None
|
|
|
|
force_entry: OrderTypeValues | None = None
|
2021-11-24 19:11:04 +00:00
|
|
|
stoploss: OrderTypeValues
|
2021-11-06 15:12:25 +00:00
|
|
|
stoploss_on_exchange: bool
|
2024-11-07 20:37:33 +00:00
|
|
|
stoploss_on_exchange_interval: int | None = None
|
2021-11-06 15:12:25 +00:00
|
|
|
|
|
|
|
|
2021-01-02 14:48:33 +00:00
|
|
|
class ShowConfig(BaseModel):
|
2021-11-06 15:12:25 +00:00
|
|
|
version: str
|
2024-11-07 20:37:33 +00:00
|
|
|
strategy_version: str | None = None
|
2021-11-23 06:06:53 +00:00
|
|
|
api_version: float
|
2021-02-20 18:17:10 +00:00
|
|
|
dry_run: bool
|
2021-11-20 19:09:37 +00:00
|
|
|
trading_mode: str
|
|
|
|
short_allowed: bool
|
2021-01-02 14:48:33 +00:00
|
|
|
stake_currency: str
|
2022-02-15 19:01:35 +00:00
|
|
|
stake_amount: str
|
2024-11-07 20:37:33 +00:00
|
|
|
available_capital: float | None = None
|
2021-06-26 18:46:54 +00:00
|
|
|
stake_currency_decimals: int
|
2023-01-15 10:44:10 +00:00
|
|
|
max_open_trades: IntOrInf
|
2024-10-04 05:06:27 +00:00
|
|
|
minimal_roi: dict[str, Any]
|
2024-11-07 20:37:33 +00:00
|
|
|
stoploss: float | None = None
|
2023-02-08 06:06:03 +00:00
|
|
|
stoploss_on_exchange: bool
|
2024-11-07 20:37:33 +00:00
|
|
|
trailing_stop: bool | None = None
|
|
|
|
trailing_stop_positive: float | None = None
|
|
|
|
trailing_stop_positive_offset: float | None = None
|
|
|
|
trailing_only_offset_is_reached: bool | None = None
|
|
|
|
unfilledtimeout: UnfilledTimeout | None = None # Empty in webserver mode
|
|
|
|
order_types: OrderTypes | None = None
|
|
|
|
use_custom_stoploss: bool | None = None
|
|
|
|
timeframe: str | None = None
|
2021-01-02 14:48:33 +00:00
|
|
|
timeframe_ms: int
|
|
|
|
timeframe_min: int
|
|
|
|
exchange: str
|
2024-11-07 20:37:33 +00:00
|
|
|
strategy: str | None = None
|
2022-04-08 11:39:41 +00:00
|
|
|
force_entry_enable: bool
|
2024-10-04 05:06:27 +00:00
|
|
|
exit_pricing: dict[str, Any]
|
|
|
|
entry_pricing: dict[str, Any]
|
2021-01-16 15:19:49 +00:00
|
|
|
bot_name: str
|
2021-01-02 14:48:33 +00:00
|
|
|
state: str
|
|
|
|
runmode: str
|
2022-01-21 00:35:22 +00:00
|
|
|
position_adjustment_enable: bool
|
2022-01-27 15:57:50 +00:00
|
|
|
max_entry_position_adjustment: int
|
2021-01-02 14:48:33 +00:00
|
|
|
|
|
|
|
|
2022-02-26 15:10:54 +00:00
|
|
|
class OrderSchema(BaseModel):
|
|
|
|
pair: str
|
|
|
|
order_id: str
|
|
|
|
status: str
|
2024-11-07 20:37:33 +00:00
|
|
|
remaining: float | None = None
|
2022-02-26 15:10:54 +00:00
|
|
|
amount: float
|
|
|
|
safe_price: float
|
|
|
|
cost: float
|
2024-11-07 20:37:33 +00:00
|
|
|
filled: float | None = None
|
2022-02-26 15:10:54 +00:00
|
|
|
ft_order_side: str
|
|
|
|
order_type: str
|
|
|
|
is_open: bool
|
2024-11-07 20:37:33 +00:00
|
|
|
order_timestamp: int | None = None
|
|
|
|
order_filled_timestamp: int | None = None
|
|
|
|
ft_fee_base: float | None = None
|
|
|
|
ft_order_tag: str | None = None
|
2022-02-26 15:10:54 +00:00
|
|
|
|
|
|
|
|
2021-01-01 18:36:03 +00:00
|
|
|
class TradeSchema(BaseModel):
|
2021-01-01 18:38:28 +00:00
|
|
|
trade_id: int
|
2021-01-01 18:36:03 +00:00
|
|
|
pair: str
|
2022-04-09 14:42:18 +00:00
|
|
|
base_currency: str
|
|
|
|
quote_currency: str
|
2021-01-01 18:36:03 +00:00
|
|
|
is_open: bool
|
2021-11-14 08:51:03 +00:00
|
|
|
is_short: bool
|
2021-01-01 18:36:03 +00:00
|
|
|
exchange: str
|
|
|
|
amount: float
|
|
|
|
amount_requested: float
|
|
|
|
stake_amount: float
|
2024-11-07 20:37:33 +00:00
|
|
|
max_stake_amount: float | None = None
|
2021-01-01 18:36:03 +00:00
|
|
|
strategy: str
|
2024-11-07 20:37:33 +00:00
|
|
|
enter_tag: str | None = None
|
2021-01-01 18:38:28 +00:00
|
|
|
timeframe: int
|
2024-11-07 20:37:33 +00:00
|
|
|
fee_open: float | None = None
|
|
|
|
fee_open_cost: float | None = None
|
|
|
|
fee_open_currency: str | None = None
|
|
|
|
fee_close: float | None = None
|
|
|
|
fee_close_cost: float | None = None
|
|
|
|
fee_close_currency: str | None = None
|
2023-02-28 17:09:52 +00:00
|
|
|
|
2021-01-01 18:36:03 +00:00
|
|
|
open_date: str
|
|
|
|
open_timestamp: int
|
2024-11-07 20:37:33 +00:00
|
|
|
open_fill_date: str | None
|
|
|
|
open_fill_timestamp: int | None
|
2021-01-01 18:36:03 +00:00
|
|
|
open_rate: float
|
2024-11-07 20:37:33 +00:00
|
|
|
open_rate_requested: float | None = None
|
2021-01-01 18:36:03 +00:00
|
|
|
open_trade_value: float
|
2023-02-28 17:09:52 +00:00
|
|
|
|
2024-11-07 20:37:33 +00:00
|
|
|
close_date: str | None = None
|
|
|
|
close_timestamp: int | None = None
|
|
|
|
close_rate: float | None = None
|
|
|
|
close_rate_requested: float | None = None
|
2023-02-28 17:09:52 +00:00
|
|
|
|
2024-11-07 20:37:33 +00:00
|
|
|
close_profit: float | None = None
|
|
|
|
close_profit_pct: float | None = None
|
|
|
|
close_profit_abs: float | None = None
|
2023-02-28 17:09:52 +00:00
|
|
|
|
2024-11-07 20:37:33 +00:00
|
|
|
profit_ratio: float | None = None
|
|
|
|
profit_pct: float | None = None
|
|
|
|
profit_abs: float | None = None
|
|
|
|
profit_fiat: float | None = None
|
2023-02-28 17:09:52 +00:00
|
|
|
|
2023-02-27 19:31:02 +00:00
|
|
|
realized_profit: float
|
2024-11-07 20:37:33 +00:00
|
|
|
realized_profit_ratio: float | None = None
|
|
|
|
|
|
|
|
exit_reason: str | None = None
|
|
|
|
exit_order_status: str | None = None
|
|
|
|
|
|
|
|
stop_loss_abs: float | None = None
|
|
|
|
stop_loss_ratio: float | None = None
|
|
|
|
stop_loss_pct: float | None = None
|
|
|
|
stoploss_last_update: str | None = None
|
|
|
|
stoploss_last_update_timestamp: int | None = None
|
|
|
|
initial_stop_loss_abs: float | None = None
|
|
|
|
initial_stop_loss_ratio: float | None = None
|
|
|
|
initial_stop_loss_pct: float | None = None
|
|
|
|
|
|
|
|
min_rate: float | None = None
|
|
|
|
max_rate: float | None = None
|
2023-09-09 07:23:25 +00:00
|
|
|
has_open_orders: bool
|
2024-10-04 05:06:27 +00:00
|
|
|
orders: list[OrderSchema]
|
2021-01-01 18:36:03 +00:00
|
|
|
|
2024-11-07 20:37:33 +00:00
|
|
|
leverage: float | None = None
|
|
|
|
interest_rate: float | None = None
|
|
|
|
liquidation_price: float | None = None
|
|
|
|
funding_fees: float | None = None
|
|
|
|
trading_mode: TradingMode | None = None
|
2022-02-01 06:08:43 +00:00
|
|
|
|
2024-11-07 20:37:33 +00:00
|
|
|
amount_precision: float | None = None
|
|
|
|
price_precision: float | None = None
|
|
|
|
precision_mode: int | None = None
|
2023-03-25 10:55:47 +00:00
|
|
|
|
2021-01-01 18:36:03 +00:00
|
|
|
|
2021-01-01 18:38:28 +00:00
|
|
|
class OpenTradeSchema(TradeSchema):
|
2024-11-07 20:37:33 +00:00
|
|
|
stoploss_current_dist: float | None = None
|
|
|
|
stoploss_current_dist_pct: float | None = None
|
|
|
|
stoploss_current_dist_ratio: float | None = None
|
|
|
|
stoploss_entry_dist: float | None = None
|
|
|
|
stoploss_entry_dist_ratio: float | None = None
|
2021-01-01 18:38:28 +00:00
|
|
|
current_rate: float
|
2023-02-28 19:31:02 +00:00
|
|
|
total_profit_abs: float
|
2024-11-07 20:37:33 +00:00
|
|
|
total_profit_fiat: float | None = None
|
|
|
|
total_profit_ratio: float | None = None
|
2023-02-28 19:31:02 +00:00
|
|
|
|
2021-01-01 18:38:28 +00:00
|
|
|
|
2021-01-01 18:36:03 +00:00
|
|
|
class TradeResponse(BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
trades: list[TradeSchema]
|
2021-01-01 18:36:03 +00:00
|
|
|
trades_count: int
|
2022-06-18 15:44:15 +00:00
|
|
|
offset: int
|
2021-04-18 14:05:28 +00:00
|
|
|
total_trades: int
|
2021-01-01 18:36:03 +00:00
|
|
|
|
|
|
|
|
2024-11-07 20:37:33 +00:00
|
|
|
ForceEnterResponse = RootModel[TradeSchema | StatusMsg]
|
2021-01-02 14:11:40 +00:00
|
|
|
|
|
|
|
|
2020-12-26 16:33:27 +00:00
|
|
|
class LockModel(BaseModel):
|
2021-03-01 18:50:39 +00:00
|
|
|
id: int
|
2020-12-26 16:33:27 +00:00
|
|
|
active: bool
|
|
|
|
lock_end_time: str
|
|
|
|
lock_end_timestamp: int
|
|
|
|
lock_time: str
|
|
|
|
lock_timestamp: int
|
|
|
|
pair: str
|
2022-04-24 09:51:33 +00:00
|
|
|
side: str
|
2024-11-07 20:37:33 +00:00
|
|
|
reason: str | None = None
|
2020-12-26 16:33:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Locks(BaseModel):
|
|
|
|
lock_count: int
|
2024-10-04 05:06:27 +00:00
|
|
|
locks: list[LockModel]
|
2020-12-26 16:33:27 +00:00
|
|
|
|
|
|
|
|
2024-03-30 13:29:58 +00:00
|
|
|
class LocksPayload(BaseModel):
|
|
|
|
pair: str
|
2024-05-12 14:51:11 +00:00
|
|
|
side: str = "*" # Default to both sides
|
2024-03-30 13:29:58 +00:00
|
|
|
until: AwareDatetime
|
2024-11-07 20:37:33 +00:00
|
|
|
reason: str | None = None
|
2024-03-30 13:29:58 +00:00
|
|
|
|
|
|
|
|
2021-03-01 18:50:39 +00:00
|
|
|
class DeleteLockRequest(BaseModel):
|
2024-11-07 20:37:33 +00:00
|
|
|
pair: str | None = None
|
|
|
|
lockid: int | None = None
|
2021-03-01 18:50:39 +00:00
|
|
|
|
|
|
|
|
2020-12-26 16:33:27 +00:00
|
|
|
class Logs(BaseModel):
|
|
|
|
log_count: int
|
2024-10-04 05:06:27 +00:00
|
|
|
logs: list[list]
|
2020-12-26 16:33:27 +00:00
|
|
|
|
|
|
|
|
2022-01-26 06:10:38 +00:00
|
|
|
class ForceEnterPayload(BaseModel):
|
2020-12-26 16:00:30 +00:00
|
|
|
pair: str
|
2022-01-26 06:10:38 +00:00
|
|
|
side: SignalDirection = SignalDirection.LONG
|
2024-11-07 20:37:33 +00:00
|
|
|
price: float | None = None
|
|
|
|
ordertype: OrderTypeValues | None = None
|
|
|
|
stakeamount: float | None = None
|
|
|
|
entry_tag: str | None = None
|
|
|
|
leverage: float | None = None
|
2020-12-26 16:00:30 +00:00
|
|
|
|
|
|
|
|
2022-04-06 01:35:43 +00:00
|
|
|
class ForceExitPayload(BaseModel):
|
2024-11-07 20:37:33 +00:00
|
|
|
tradeid: str | int
|
|
|
|
ordertype: OrderTypeValues | None = None
|
|
|
|
amount: float | None = None
|
2020-12-26 16:33:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
class BlacklistPayload(BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
blacklist: list[str]
|
2020-12-26 16:33:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
class BlacklistResponse(BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
blacklist: list[str]
|
|
|
|
blacklist_expanded: list[str]
|
|
|
|
errors: dict
|
2020-12-26 16:33:27 +00:00
|
|
|
length: int
|
2024-10-04 05:06:27 +00:00
|
|
|
method: list[str]
|
2020-12-26 16:33:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
class WhitelistResponse(BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
whitelist: list[str]
|
2020-12-26 16:33:27 +00:00
|
|
|
length: int
|
2024-10-04 05:06:27 +00:00
|
|
|
method: list[str]
|
2020-12-26 16:33:27 +00:00
|
|
|
|
|
|
|
|
2023-05-31 05:00:20 +00:00
|
|
|
class WhitelistEvaluateResponse(BackgroundTaskResult):
|
2024-11-07 20:37:33 +00:00
|
|
|
result: WhitelistResponse | None = None
|
2023-05-24 19:01:39 +00:00
|
|
|
|
|
|
|
|
2020-12-26 16:33:27 +00:00
|
|
|
class DeleteTrade(BaseModel):
|
|
|
|
cancel_order_count: int
|
|
|
|
result: str
|
|
|
|
result_msg: str
|
|
|
|
trade_id: int
|
2020-12-26 19:05:27 +00:00
|
|
|
|
|
|
|
|
2021-01-02 14:11:40 +00:00
|
|
|
class PlotConfig_(BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
main_plot: dict[str, Any]
|
|
|
|
subplots: dict[str, Any]
|
2020-12-26 19:05:27 +00:00
|
|
|
|
|
|
|
|
2024-11-07 20:37:33 +00:00
|
|
|
PlotConfig = RootModel[PlotConfig_ | dict]
|
2021-01-02 14:11:40 +00:00
|
|
|
|
|
|
|
|
2020-12-26 19:05:27 +00:00
|
|
|
class StrategyListResponse(BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
strategies: list[str]
|
2020-12-26 19:05:27 +00:00
|
|
|
|
|
|
|
|
2023-06-03 07:20:01 +00:00
|
|
|
class ExchangeListResponse(BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
exchanges: list[ValidExchangesType]
|
2023-06-03 07:20:01 +00:00
|
|
|
|
|
|
|
|
2024-10-22 04:36:21 +00:00
|
|
|
class HyperoptLoss(BaseModel):
|
|
|
|
name: str
|
|
|
|
description: str
|
|
|
|
|
|
|
|
|
|
|
|
class HyperoptLossListResponse(BaseModel):
|
|
|
|
loss_functions: list[HyperoptLoss]
|
|
|
|
|
|
|
|
|
2023-04-19 16:35:52 +00:00
|
|
|
class PairListResponse(BaseModel):
|
2023-04-20 16:15:31 +00:00
|
|
|
name: str
|
2023-05-28 16:21:23 +00:00
|
|
|
description: str
|
2023-04-20 16:15:31 +00:00
|
|
|
is_pairlist_generator: bool
|
2024-10-04 05:06:27 +00:00
|
|
|
params: dict[str, Any]
|
2023-04-20 16:15:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
class PairListsResponse(BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
pairlists: list[PairListResponse]
|
2023-04-19 16:35:52 +00:00
|
|
|
|
|
|
|
|
2023-06-03 04:57:25 +00:00
|
|
|
class PairListsPayload(ExchangeModePayloadMixin, BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
pairlists: list[dict[str, Any]]
|
|
|
|
blacklist: list[str]
|
2023-04-27 18:35:24 +00:00
|
|
|
stake_currency: str
|
|
|
|
|
|
|
|
|
2022-12-20 06:21:52 +00:00
|
|
|
class FreqAIModelListResponse(BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
freqaimodels: list[str]
|
2022-12-20 06:21:52 +00:00
|
|
|
|
|
|
|
|
2020-12-26 19:05:27 +00:00
|
|
|
class StrategyResponse(BaseModel):
|
|
|
|
strategy: str
|
|
|
|
code: str
|
2024-11-07 20:37:33 +00:00
|
|
|
timeframe: str | None
|
2020-12-26 19:05:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
class AvailablePairs(BaseModel):
|
|
|
|
length: int
|
2024-10-04 05:06:27 +00:00
|
|
|
pairs: list[str]
|
|
|
|
pair_interval: list[list[str]]
|
2020-12-27 08:02:35 +00:00
|
|
|
|
|
|
|
|
2024-04-28 09:33:45 +00:00
|
|
|
class PairCandlesRequest(BaseModel):
|
2024-04-28 08:30:27 +00:00
|
|
|
pair: str
|
|
|
|
timeframe: str
|
2024-11-07 20:37:33 +00:00
|
|
|
limit: int | None = None
|
|
|
|
columns: list[str] | None = None
|
2024-04-28 08:30:27 +00:00
|
|
|
|
|
|
|
|
2024-04-28 09:44:21 +00:00
|
|
|
class PairHistoryRequest(PairCandlesRequest):
|
|
|
|
timerange: str
|
|
|
|
strategy: str
|
2024-11-07 20:37:33 +00:00
|
|
|
freqaimodel: str | None = None
|
2024-04-28 09:44:21 +00:00
|
|
|
|
|
|
|
|
2020-12-27 08:02:35 +00:00
|
|
|
class PairHistory(BaseModel):
|
|
|
|
strategy: str
|
|
|
|
pair: str
|
|
|
|
timeframe: str
|
|
|
|
timeframe_ms: int
|
2024-10-04 05:06:27 +00:00
|
|
|
columns: list[str]
|
|
|
|
all_columns: list[str] = []
|
|
|
|
data: SerializeAsAny[list[Any]]
|
2020-12-27 08:02:35 +00:00
|
|
|
length: int
|
|
|
|
buy_signals: int
|
|
|
|
sell_signals: int
|
2021-11-20 19:09:37 +00:00
|
|
|
enter_long_signals: int
|
|
|
|
exit_long_signals: int
|
|
|
|
enter_short_signals: int
|
|
|
|
exit_short_signals: int
|
2020-12-27 08:02:35 +00:00
|
|
|
last_analyzed: datetime
|
|
|
|
last_analyzed_ts: int
|
|
|
|
data_start_ts: int
|
|
|
|
data_start: str
|
|
|
|
data_stop: str
|
|
|
|
data_stop_ts: int
|
2021-01-02 14:13:32 +00:00
|
|
|
|
|
|
|
|
2022-12-20 18:44:01 +00:00
|
|
|
class BacktestFreqAIInputs(BaseModel):
|
|
|
|
identifier: str
|
|
|
|
|
|
|
|
|
2021-01-02 14:13:32 +00:00
|
|
|
class BacktestRequest(BaseModel):
|
|
|
|
strategy: str
|
2024-11-07 20:37:33 +00:00
|
|
|
timeframe: str | None = None
|
|
|
|
timeframe_detail: str | None = None
|
|
|
|
timerange: str | None = None
|
|
|
|
max_open_trades: IntOrInf | None = None
|
|
|
|
stake_amount: str | float | None = None
|
2021-01-06 14:05:54 +00:00
|
|
|
enable_protections: bool
|
2024-11-07 20:37:33 +00:00
|
|
|
dry_run_wallet: float | None = None
|
|
|
|
backtest_cache: str | None = None
|
|
|
|
freqaimodel: str | None = None
|
|
|
|
freqai: BacktestFreqAIInputs | None = None
|
2021-01-02 14:13:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
class BacktestResponse(BaseModel):
|
|
|
|
status: str
|
|
|
|
running: bool
|
|
|
|
status_msg: str
|
2021-03-11 18:16:18 +00:00
|
|
|
step: str
|
|
|
|
progress: float
|
2024-11-07 20:37:33 +00:00
|
|
|
trade_count: float | None = None
|
2021-01-02 14:13:32 +00:00
|
|
|
# TODO: Properly type backtestresult...
|
2024-11-07 20:37:33 +00:00
|
|
|
backtest_result: dict[str, Any] | None = None
|
2021-10-04 23:10:39 +00:00
|
|
|
|
2021-10-06 17:36:28 +00:00
|
|
|
|
2023-07-31 18:26:21 +00:00
|
|
|
# TODO: This is a copy of BacktestHistoryEntryType
|
2022-04-11 17:44:47 +00:00
|
|
|
class BacktestHistoryEntry(BaseModel):
|
|
|
|
filename: str
|
|
|
|
strategy: str
|
|
|
|
run_id: str
|
|
|
|
backtest_start_time: int
|
2024-11-07 20:37:33 +00:00
|
|
|
notes: str | None = ""
|
|
|
|
backtest_start_ts: int | None = None
|
|
|
|
backtest_end_ts: int | None = None
|
|
|
|
timeframe: str | None = None
|
|
|
|
timeframe_detail: str | None = None
|
2022-04-11 17:44:47 +00:00
|
|
|
|
|
|
|
|
2023-07-31 19:16:25 +00:00
|
|
|
class BacktestMetadataUpdate(BaseModel):
|
|
|
|
strategy: str
|
2024-05-12 14:51:11 +00:00
|
|
|
notes: str = ""
|
2022-04-11 17:44:47 +00:00
|
|
|
|
|
|
|
|
2024-04-16 17:27:55 +00:00
|
|
|
class BacktestMarketChange(BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
columns: list[str]
|
2024-04-16 17:27:55 +00:00
|
|
|
length: int
|
2024-10-04 05:06:27 +00:00
|
|
|
data: list[list[Any]]
|
2024-04-16 17:27:55 +00:00
|
|
|
|
|
|
|
|
2021-10-04 23:10:39 +00:00
|
|
|
class SysInfo(BaseModel):
|
2024-10-04 05:06:27 +00:00
|
|
|
cpu_pct: list[float]
|
2021-10-04 23:10:39 +00:00
|
|
|
ram_pct: float
|
2022-01-23 19:58:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Health(BaseModel):
|
2024-11-07 20:37:33 +00:00
|
|
|
last_process: datetime | None = None
|
|
|
|
last_process_ts: int | None = None
|
|
|
|
bot_start: datetime | None = None
|
|
|
|
bot_start_ts: int | None = None
|
|
|
|
bot_startup: datetime | None = None
|
|
|
|
bot_startup_ts: int | None = None
|