def test_delete_raise_status(): uri = "https://google.com/" with requests_mock.Mocker() as m: m.register_uri("DELETE", uri, status_code=400) with pytest.raises(requests.exceptions.HTTPError): res = HttpClient.delete(uri) assert res.status_code == 400
def cancel_all(cls) -> Dict: """Delete all outstanding orders associated with your MPID (the whole organization) https://docs.ledgerx.com/reference#cancel-all Returns: Dict: [description] """ include_api_key = True url = gen_legacy_url("/orders") res = HttpClient.delete(url, {}, include_api_key) return res.json()
def cancel_single(cls, mid: str, contract_id: int) -> Dict: """Cancel a single resting limit order https://docs.ledgerx.com/reference#cancel-single Args: mid (str): [description] Returns: Dict: [description] """ include_api_key = True url = gen_legacy_url(f"/orders/{mid}") qps = dict(contract_id=contract_id) res = HttpClient.delete(url, qps, include_api_key) return res.json()