|
43 | 43 | Ping, |
44 | 44 | PlotConfig, |
45 | 45 | Profit, |
| 46 | + ProfitAll, |
46 | 47 | ResultMsg, |
47 | 48 | ShowConfig, |
48 | 49 | Stats, |
|
89 | 90 | # 2.40: Add hyperopt-loss endpoint |
90 | 91 | # 2.41: Add download-data endpoint |
91 | 92 | # 2.42: Add /pair_history endpoint with live data |
92 | | -API_VERSION = 2.42 |
| 93 | +# 2.43: Add /profit_all endpoint |
| 94 | +API_VERSION = 2.43 |
93 | 95 |
|
94 | 96 | # Public API, requires no auth. |
95 | 97 | router_public = APIRouter() |
@@ -148,6 +150,24 @@ def profit(rpc: RPC = Depends(get_rpc), config=Depends(get_config)): |
148 | 150 | return rpc._rpc_trade_statistics(config["stake_currency"], config.get("fiat_display_currency")) |
149 | 151 |
|
150 | 152 |
|
| 153 | +@router.get("/profit_all", response_model=ProfitAll, tags=["info"]) |
| 154 | +def profit_all(rpc: RPC = Depends(get_rpc), config=Depends(get_config)): |
| 155 | + response = { |
| 156 | + "all": rpc._rpc_trade_statistics( |
| 157 | + config["stake_currency"], config.get("fiat_display_currency") |
| 158 | + ), |
| 159 | + } |
| 160 | + if config.get("trading_mode", TradingMode.SPOT) != TradingMode.SPOT: |
| 161 | + response["long"] = rpc._rpc_trade_statistics( |
| 162 | + config["stake_currency"], config.get("fiat_display_currency"), direction="long" |
| 163 | + ) |
| 164 | + response["short"] = rpc._rpc_trade_statistics( |
| 165 | + config["stake_currency"], config.get("fiat_display_currency"), direction="short" |
| 166 | + ) |
| 167 | + |
| 168 | + return response |
| 169 | + |
| 170 | + |
151 | 171 | @router.get("/stats", response_model=Stats, tags=["info"]) |
152 | 172 | def stats(rpc: RPC = Depends(get_rpc)): |
153 | 173 | return rpc._rpc_stats() |
|
0 commit comments