diff --git a/schwab/client/asynchronous.py b/schwab/client/asynchronous.py index fffd77b..2cbc34c 100644 --- a/schwab/client/asynchronous.py +++ b/schwab/client/asynchronous.py @@ -49,18 +49,6 @@ async def _put_request(self, path, data): register_redactions_from_response(resp) return resp - async def _patch_request(self, path, data): - dest = 'https://api.schwabapi.com' + path - - req_num = self._req_num() - self.logger.debug('Req %s: PATCH to %s, json=%s', - req_num, dest, LazyLog(lambda: json.dumps(data, indent=4))) - - resp = await self.session.patch(dest, json=data) - self._log_response(resp, req_num) - register_redactions_from_response(resp) - return resp - async def _delete_request(self, path): dest = 'https://api.schwabapi.com' + path diff --git a/schwab/client/synchronous.py b/schwab/client/synchronous.py index 7014148..c584b3b 100644 --- a/schwab/client/synchronous.py +++ b/schwab/client/synchronous.py @@ -45,18 +45,6 @@ def _put_request(self, path, data): register_redactions_from_response(resp) return resp - def _patch_request(self, path, data): - dest = 'https://api.schwabapi.com' + path - - req_num = self._req_num() - self.logger.debug('Req %s: PATCH to %s, json=%s', - req_num, dest, LazyLog(lambda: json.dumps(data, indent=4))) - - resp = self.session.patch(dest, json=data) - self._log_response(resp, req_num) - register_redactions_from_response(resp) - return resp - def _delete_request(self, path): dest = 'https://api.schwabapi.com' + path diff --git a/tests/client_test.py b/tests/client_test.py index 7aff57d..c205838 100644 --- a/tests/client_test.py +++ b/tests/client_test.py @@ -457,6 +457,26 @@ def test_replace_order_str(self): json=order_spec) + # preview_order + + + def test_preview_order(self): + order_spec = {'order': 'spec'} + self.client.preview_order(ACCOUNT_HASH, order_spec) + self.mock_session.post.assert_called_once_with( + self.make_url('/trader/v1/accounts/{accountHash}/previewOrder'), + json=order_spec) + + + def test_preview_order_order_builder(self): + order_spec = OrderBuilder(enforce_enums=False).set_order_type('LIMIT') + expected_spec = {'orderType': 'LIMIT'} + self.client.preview_order(ACCOUNT_HASH, order_spec) + self.mock_session.post.assert_called_once_with( + self.make_url('/trader/v1/accounts/{accountHash}/previewOrder'), + json=expected_spec) + + # get_transactions