Skip to content

Commit 7178ce8

Browse files
committed
chore: Add descriptions to api parameters
1 parent 26ba076 commit 7178ce8

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

freqtrade/rpc/api_server/api_v1.py

+20-4
Original file line numberDiff line numberDiff line change
@@ -154,21 +154,33 @@ def stats(rpc: RPC = Depends(get_rpc)):
154154

155155

156156
@router.get("/daily", response_model=DailyWeeklyMonthly, tags=["info"])
157-
def daily(timescale: int = 7, rpc: RPC = Depends(get_rpc), config=Depends(get_config)):
157+
def daily(
158+
timescale: int = Query(7, ge=1, description="Number of days to fetch data for"),
159+
rpc: RPC = Depends(get_rpc),
160+
config=Depends(get_config),
161+
):
158162
return rpc._rpc_timeunit_profit(
159163
timescale, config["stake_currency"], config.get("fiat_display_currency", "")
160164
)
161165

162166

163167
@router.get("/weekly", response_model=DailyWeeklyMonthly, tags=["info"])
164-
def weekly(timescale: int = 4, rpc: RPC = Depends(get_rpc), config=Depends(get_config)):
168+
def weekly(
169+
timescale: int = Query(4, ge=1, description="Number of weeks to fetch data for"),
170+
rpc: RPC = Depends(get_rpc),
171+
config=Depends(get_config),
172+
):
165173
return rpc._rpc_timeunit_profit(
166174
timescale, config["stake_currency"], config.get("fiat_display_currency", ""), "weeks"
167175
)
168176

169177

170178
@router.get("/monthly", response_model=DailyWeeklyMonthly, tags=["info"])
171-
def monthly(timescale: int = 3, rpc: RPC = Depends(get_rpc), config=Depends(get_config)):
179+
def monthly(
180+
timescale: int = Query(3, ge=1, description="Number of months to fetch data for"),
181+
rpc: RPC = Depends(get_rpc),
182+
config=Depends(get_config),
183+
):
172184
return rpc._rpc_timeunit_profit(
173185
timescale, config["stake_currency"], config.get("fiat_display_currency", ""), "months"
174186
)
@@ -185,7 +197,11 @@ def status(rpc: RPC = Depends(get_rpc)):
185197
# Using the responsemodel here will cause a ~100% increase in response time (from 1s to 2s)
186198
# on big databases. Correct response model: response_model=TradeResponse,
187199
@router.get("/trades", tags=["info", "trading"])
188-
def trades(limit: int = 500, offset: int = 0, rpc: RPC = Depends(get_rpc)):
200+
def trades(
201+
limit: int = Query(500, ge=1, description="Maximum number of different trades to return data"),
202+
offset: int = Query(0, ge=0, description="Number of trades to skip for pagination"),
203+
rpc: RPC = Depends(get_rpc),
204+
):
189205
return rpc._rpc_trade_history(limit, offset=offset, order_by_id=True)
190206

191207

0 commit comments

Comments
 (0)