From 2a4d3bd4aa02817a45e9b28345b039cb05a43dfe Mon Sep 17 00:00:00 2001 From: Chris Allen Date: Sun, 18 Aug 2019 18:11:00 -0400 Subject: [PATCH 1/2] Added fees endpoint to authenticated_client --- cbpro/authenticated_client.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cbpro/authenticated_client.py b/cbpro/authenticated_client.py index 0c2dc32..464399a 100644 --- a/cbpro/authenticated_client.py +++ b/cbpro/authenticated_client.py @@ -995,3 +995,20 @@ def get_trailing_volume(self): """ return self._send_message('get', '/users/self/trailing-volume') + + def get_fees(self): + """ Get current fees. + + This request will return your current maker & taker fee rates, as well as your 30-day trailing volume. + + Returns: + dict: Current fees. Example:: + { + "maker_fee_rate": "0.0000", + "taker_fee_rate: "0.0030", + "usd_colume": "20591.77" + } + + """ + return self._send_message('get', '/fees') + \ No newline at end of file From 2b372c74aa82fbadbc44c46c339fb957345bcc49 Mon Sep 17 00:00:00 2001 From: Chris Allen Date: Sun, 18 Aug 2019 20:19:58 -0400 Subject: [PATCH 2/2] Added conversion endpoint --- cbpro/authenticated_client.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/cbpro/authenticated_client.py b/cbpro/authenticated_client.py index 464399a..44a04f4 100644 --- a/cbpro/authenticated_client.py +++ b/cbpro/authenticated_client.py @@ -1011,4 +1011,29 @@ def get_fees(self): """ return self._send_message('get', '/fees') - \ No newline at end of file + + def create_conversion(self, from_id, to_id, amount): + """ Create a stablecoin conversion. + + Args: + from_id (str): A valid currency ID to convert 'from'. + to_id (str): A valid currency ID to convert 'to'. + amount (Decimal): Amount of 'from' to convert 'to'. + + Returns: + dict: Information about the conversion. Example:: + { + "id": "8942caee-f9d5-4600-a894-4811268545db", + "amount": "10000.00", + "from_account_id": "7849cc79-8b01-4793-9345-bc6b5f08acce", + "to_account_id": "105c3e58-0898-4106-8283-dc5781cda07b", + "from": "USD", + "to": "USDC" + } + + """ + params = {'from': from_id, + 'to': to_id, + 'amount': amount} + return self._send_message('post', '/conversions', + data=json.dumps(params))