def forcebuy(payload: ForceBuyPayload, rpc: RPC = Depends(get_rpc)): trade = rpc._rpc_forcebuy(payload.pair, payload.price) if trade: return ForceBuyResponse.parse_obj(trade.to_json()) else: return ForceBuyResponse.parse_obj({"status": f"Error buying pair {payload.pair}."})
def forcebuy(payload: ForceBuyPayload, rpc: RPC = Depends(get_rpc)): ordertype = payload.ordertype.value if payload.ordertype else None stake_amount = payload.stakeamount if payload.stakeamount else None trade = rpc._rpc_forcebuy(payload.pair, payload.price, ordertype, stake_amount) if trade: return ForceBuyResponse.parse_obj(trade.to_json()) else: return ForceBuyResponse.parse_obj( {"status": f"Error buying pair {payload.pair}."})