Don't use __root__ directly for api response
This commit is contained in:
parent
4b689f5b88
commit
bba9b9e819
@ -111,9 +111,9 @@ def forcebuy(payload: ForceBuyPayload, rpc: RPC = Depends(get_rpc)):
|
|||||||
trade = rpc._rpc_forcebuy(payload.pair, payload.price)
|
trade = rpc._rpc_forcebuy(payload.pair, payload.price)
|
||||||
|
|
||||||
if trade:
|
if trade:
|
||||||
return {'__root__': trade.to_json()}
|
return ForceBuyResponse.parse_obj(trade.to_json())
|
||||||
else:
|
else:
|
||||||
return {'__root__': {"status": f"Error buying pair {payload.pair}."}}
|
return ForceBuyResponse.parse_obj({"status": f"Error buying pair {payload.pair}."})
|
||||||
|
|
||||||
|
|
||||||
@router.post('/forcesell', response_model=ResultMsg, tags=['trading'])
|
@router.post('/forcesell', response_model=ResultMsg, tags=['trading'])
|
||||||
@ -183,7 +183,7 @@ def pair_history(pair: str, timeframe: str, timerange: str, strategy: str,
|
|||||||
|
|
||||||
@router.get('/plot_config', response_model=PlotConfig, tags=['candle data'])
|
@router.get('/plot_config', response_model=PlotConfig, tags=['candle data'])
|
||||||
def plot_config(rpc: RPC = Depends(get_rpc)):
|
def plot_config(rpc: RPC = Depends(get_rpc)):
|
||||||
return {'__root__': rpc._rpc_plot_config()}
|
return PlotConfig.parse_obj(rpc._rpc_plot_config())
|
||||||
|
|
||||||
|
|
||||||
@router.get('/strategies', response_model=StrategyListResponse, tags=['strategy'])
|
@router.get('/strategies', response_model=StrategyListResponse, tags=['strategy'])
|
||||||
|
Loading…
Reference in New Issue
Block a user