Fix mock-tests missing some fields

This commit is contained in:
Matthias
2021-01-01 19:38:28 +01:00
parent 29f4dd1dcd
commit 84ced92002
5 changed files with 32 additions and 12 deletions

View File

@@ -113,7 +113,7 @@ class Daily(BaseModel):
class TradeSchema(BaseModel):
trade_id: str
trade_id: int
pair: str
is_open: bool
exchange: str
@@ -121,7 +121,7 @@ class TradeSchema(BaseModel):
amount_requested: float
stake_amount: float
strategy: str
timeframe: str
timeframe: int
fee_open: Optional[float]
fee_open_cost: Optional[float]
fee_open_currency: Optional[str]
@@ -161,6 +161,20 @@ class TradeSchema(BaseModel):
open_order_id: Optional[str]
class OpenTradeSchema(TradeSchema):
stoploss_current_dist: Optional[float]
stoploss_current_dist_pct: Optional[float]
stoploss_current_dist_ratio: Optional[float]
stoploss_entry_dist: Optional[float]
stoploss_entry_dist_ratio: Optional[float]
base_currency: str
current_profit: float
current_profit_abs: float
current_profit_pct: float
current_rate: float
open_order: Optional[str]
class TradeResponse(BaseModel):
trades: List[TradeSchema]
trades_count: int

View File

@@ -13,9 +13,10 @@ from freqtrade.rpc import RPC
from freqtrade.rpc.api_server.api_models import (AvailablePairs, Balances, BlacklistPayload,
BlacklistResponse, Count, Daily, DeleteTrade,
ForceBuyPayload, ForceSellPayload, Locks, Logs,
PairHistory, PerformanceEntry, Ping, PlotConfig,
Profit, ResultMsg, Stats, StatusMsg,
StrategyListResponse, StrategyResponse, TradeResponse, TradeSchema, Version,
OpenTradeSchema, PairHistory, PerformanceEntry,
Ping, PlotConfig, Profit, ResultMsg, Stats,
StatusMsg, StrategyListResponse, StrategyResponse,
TradeResponse, TradeSchema, Version,
WhitelistResponse)
from freqtrade.rpc.api_server.deps import get_config, get_rpc
from freqtrade.rpc.rpc import RPCException
@@ -73,8 +74,7 @@ def daily(timescale: int = 7, rpc: RPC = Depends(get_rpc), config=Depends(get_co
config.get('fiat_display_currency', ''))
# TODO: Missing response model
@router.get('/status', response_model=List[TradeSchema], tags=['info'])
@router.get('/status', response_model=List[OpenTradeSchema], tags=['info'])
def status(rpc: RPC = Depends(get_rpc)):
try:
return rpc._rpc_trade_status()