From 4d5099b6c0fd00ff35231bdda8ba225c0a0068aa Mon Sep 17 00:00:00 2001 From: peshay Date: Sun, 12 Nov 2017 20:10:24 +0100 Subject: [PATCH 1/5] functional tests according to API documentation --- tests/test_btcde_func.py | 388 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 388 insertions(+) diff --git a/tests/test_btcde_func.py b/tests/test_btcde_func.py index a2f6f38..2e63410 100644 --- a/tests/test_btcde_func.py +++ b/tests/test_btcde_func.py @@ -105,3 +105,391 @@ def test_signature_delete(self, m): url = btcde.orderuri + "/" + order_id + "/" + trading_pair verified_signature = self.verifySignature(url, 'DELETE', params) self.assertEqual(request_signature, verified_signature) + + def test_show_orderbook(self, m): + '''Test the function showOrderbook.''' + params = {'type': 'buy', + 'trading_pair': 'btceur', + 'max_amount': 10, + 'price': 1337} + base_url = 'https://api.bitcoin.de/v2/orders' + url_args = '?price={}&trading_pair={}&type={}'.format(params.get('price'), params.get('trading_pair'), params.get('type')) + response = { + "orders":{ + "order_id": "A1B2D3", + "trading_pair": "btceur", + "type": "buy", + "max_amount":0.5, + "min_amount":0.1, + "price":230.55, + "max_volume":115.28, + "min_volume":23.06, + "order_requirements_fullfilled":True, + "trading_partner_information":{ + "username":"bla", + "is_kyc_full":True, + "trust_level":"gold", + "bank_name":"Sparkasse", + "bic":"HASPDEHHXXX", + "seat_of_bank":"DE", + "rating": 99, + "amount_trades": 52 + }, + "order_requirements":{ + "min_trust_level":"gold", + "only_kyc_full":True, + "seat_of_bank":[ + "DE", + "NL" + ], + "payment_option":1, + } + }, + "errors":[ + + ], + "credits":12 + } + m.get(requests_mock.ANY, json=response, status_code=200) + btcde.showOrderbook(self.conn, params.get('type'), params.get('trading_pair'), price=params.get('price')) + history = m.request_history + self.assertEqual(history[0].method, "GET") + self.assertEqual(history[0].url, base_url + url_args) + + def test_createOrder(self, m): + '''Test the function createOrder.''' + params = { 'type': 'buy', + 'trading_pair': 'btceur', + 'max_amount': 10, + 'price': 13 } + base_url = 'https://api.bitcoin.de/v2/orders' + url_args = '?max_amount={}&price={}&trading_pair={}&type={}'.format(params.get('max_amount'), params.get('price'), params.get('trading_pair'), params.get('type')) + response = { "order_id": "A1234BC", + "errors": [], + "credits": 8 } + m.post(requests_mock.ANY, json=response, status_code=201) + btcde.createOrder(self.conn, params.get('type'), params.get('trading_pair'), params.get('max_amount'), price=params.get('price')) + history = m.request_history + self.assertEqual(history[0].method, "POST") + self.assertEqual(history[0].url, base_url + url_args) + + def test_deleteOrder(self, m): + '''Test the function deleteOrder.''' + params = {'trading_pair': 'btceur', + 'order_id': '1337'} + base_url = 'https://api.bitcoin.de/v2/orders' + url_args = '/{}/{}'.format(params.get('order_id'), params.get('trading_pair')) + response = { "errors": [], + "credits": 5 } + m.delete(requests_mock.ANY, json=response, status_code=200) + btcde.deleteOrder(self.conn, params.get('order_id'), params.get('trading_pair')) + history = m.request_history + self.assertEqual(history[0].method, "DELETE") + self.assertEqual(history[0].url, base_url + url_args) + + def test_showMyOrders(self, m): + '''Test the function showMyOrders.''' + params = {'type': 'buy', + 'trading_pair': 'btceur', + 'price': '1337'} + base_url = 'https://api.bitcoin.de/v2/orders/my_own' + url_args = '?price={}&trading_pair={}&type={}'.format(params.get('price'), params.get('trading_pair'), params.get('type')) + response = { "orders": + [ + { + "order_id": "2EDYNS", + "trading_pair": "btceur", + "type": "sell", + "max_amount": 0.5, + "min_amount": 0.2, + "price": 250.55, + "max_volume": 125.28, + "min_volume": 50.11, + "end_datetime": "2015-01-20T15:00:00+02:00", + "new_order_for_remaining_amount": True, + "state": 0, + "order_requirements": + { + "min_trust_level":"silver", + "only_kyc_full": True, + "payment_option": 1, + "seat_of_bank": "NL" + }, + "created_at": "2015-01-10T15:00:00+02:00", + }, + ], + "page": { + "current": 1, + "last": 2 + }, + "errors": [], + "credits": 15 + } + m.get(requests_mock.ANY, json=response, status_code=200) + btcde.showMyOrders(self.conn, type=params.get('type'), trading_pair=params.get('trading_pair'), price=params.get('price')) + history = m.request_history + self.assertEqual(history[0].method, "GET") + self.assertEqual(history[0].url, base_url + url_args) + + def test_showMyOrderDetails(self, m): + '''Test the function showMyOrderDetails.''' + params = {'order_id': '1337'} + base_url = 'https://api.bitcoin.de/v2/orders/{}'.format(params.get('order_id')) + url_args = '' + response = {"order": + { + "order_id": "2EDYNS", + "trading_pair": "btceur", + "type": "sell", + "max_amount": 0.5, + "min_amount": 0.2, + "price": 250.55, + "max_volume": 125.28, + "min_volume": 50.11, + "end_datetime": "2015-01-20T15:00:00+02:00", + "new_order_for_remaining_amount": True, + "state": 0, + "order_requirements": + { + "min_trust_level":"silver", + "only_kyc_full": True, + "payment_option": 1, + "seat_of_bank": "DE" + }, + "created_at": "2015-01-10T15:00:00+02:00" + }, + "errors": [], + "credits": 15 + } + m.get(requests_mock.ANY, json=response, status_code=200) + btcde.showMyOrderDetails(self.conn, params.get('order_id')) + history = m.request_history + self.assertEqual(history[0].method, "GET") + self.assertEqual(history[0].url, base_url + url_args) + + def test_executeTrade(self, m): + '''Test the function executeTrade.''' + params = { 'type': 'buy', + 'trading_pair': 'btceur', + 'amount': '10', + 'order_id': '1337' } + base_url = 'https://api.bitcoin.de/v2/trades/{}'.format(params.get('order_id')) + url_args = '?amount={}&order_id={}&trading_pair={}&type={}'.format(params.get('amount'), params.get('order_id'), params.get('trading_pair'), params.get('type')) + response = { "errors": [], + "credits": 8 } + m.post(requests_mock.ANY, json=response, status_code=201) + btcde.executeTrade(self.conn, params.get('order_id'), params.get('type'), params.get('trading_pair'), params.get('amount')) + history = m.request_history + self.assertEqual(history[0].method, "POST") + self.assertEqual(history[0].url, base_url + url_args) + + def test_showMyTrades(self, m): + '''Test the function showMyTrades.''' + base_url = 'https://api.bitcoin.de/v2/trades' + url_args = '' + response = {"order": + { + "order_id": "2EDYNS", + "trading_pair": "btceur", + "type": "sell", + "max_amount": 0.5, + "min_amount": 0.2, + "price": 250.55, + "max_volume": 125.28, + "min_volume": 50.11, + "end_datetime": "2015-01-20T15:00:00+02:00", + "new_order_for_remaining_amount": True, + "state": 0, + "order_requirements": + { + "min_trust_level":"silver", + "only_kyc_full": True, + "payment_option": 1, + "seat_of_bank": "DE" + }, + "created_at": "2015-01-10T15:00:00+02:00" + }, + "errors": [], + "credits": 15 + } + m.get(requests_mock.ANY, json=response, status_code=200) + btcde.showMyTrades(self.conn) + history = m.request_history + self.assertEqual(history[0].method, "GET") + self.assertEqual(history[0].url, base_url + url_args) + + def test_showMyTrades_with_params(self, m): + '''Test the function showMyTrades with parameters.''' + params = { 'type': 'buy', + 'trading_pair': 'btceur' } + base_url = 'https://api.bitcoin.de/v2/trades' + url_args = '?trading_pairs={}&type={}'.format(params.get('trading_pairs'), params.get('type')) + response = {"order": + { + "order_id": "2EDYNS", + "trading_pair": "btceur", + "type": "sell", + "max_amount": 0.5, + "min_amount": 0.2, + "price": 250.55, + "max_volume": 125.28, + "min_volume": 50.11, + "end_datetime": "2015-01-20T15:00:00+02:00", + "new_order_for_remaining_amount": True, + "state": 0, + "order_requirements": + { + "min_trust_level":"silver", + "only_kyc_full": True, + "payment_option": 1, + "seat_of_bank": "DE" + }, + "created_at": "2015-01-10T15:00:00+02:00" + }, + "errors": [], + "credits": 15 + } + m.get(requests_mock.ANY, json=response, status_code=200) + btcde.showMyTrades(self.conn, type=params.get('type'), trading_pairs=params.get('trading_pairs')) + history = m.request_history + self.assertEqual(history[0].method, "GET") + self.assertEqual(history[0].url, base_url + url_args) + + def test_showMyTradeDetails(self, m): + '''Test the function showMyTradeDetails.''' + params = { 'trade_id': '1337'} + base_url = 'https://api.bitcoin.de/v2/trades' + url_args = '/{}'.format(params.get('trade_id')) + response = {"trade": + { + "trade_id": "2EDYNS", + "trading_pair": "btceur", + "type": "sell", + "amount": 0.5, + "price": 250.55, + "volume": 125.28, + "fee_eur": 0.6, + "fee_btc": 0.0025, + "fee_currency": 0.0025, + "new_trade_id_for_remaining_amount": "C4Y8HD", + "state": 1, + "my_rating_for_trading_partner": "positive", + "trading_partner_information": + { + "username":"testuser", + "is_kyc_full": True, + "bank_name": "sparkasse", + "bic": "HASPDEHHXXX", + "rating": 99, + "amount_trades": 42, + "trust_level": "gold", + "seat_of_bank": "DE", + }, + "payment_method": 1, + "created_at": "2015-01-10T15:00:00+02:00", + "successfully_finished_at": "2015-01-10T15:00:00+02:00", + }, + "errors": [], + "credits": 15, + } + m.get(requests_mock.ANY, json=response, status_code=200) + btcde.showMyTradeDetails(self.conn, params.get('trade_id')) + history = m.request_history + self.assertEqual(history[0].method, "GET") + self.assertEqual(history[0].url, base_url + url_args) + + def test_showAccountInfo(self, m): + '''Test the function showAccountInfo.''' + base_url = 'https://api.bitcoin.de/v2/account' + url_args = '' + response = { "errors": [], + "credits": 5 } + m.get(requests_mock.ANY, json=response, status_code=200) + btcde.showAccountInfo(self.conn) + history = m.request_history + self.assertEqual(history[0].method, "GET") + self.assertEqual(history[0].url, base_url + url_args) + + def test_showOrderbookCompact(self, m): + '''Test the function showOrderbookCompact.''' + params = { 'trading_pair': 'btceur'} + base_url = 'https://api.bitcoin.de/v2/orders/compact' + url_args = '?trading_pair={}'.format(params.get('trading_pair')) + response = { "errors": [], + "credits": 5 } + m.get(requests_mock.ANY, json=response, status_code=200) + btcde.showOrderbookCompact(self.conn, params.get('trading_pair')) + history = m.request_history + self.assertEqual(history[0].method, "GET") + self.assertEqual(history[0].url, base_url + url_args) + + def test_showPublicTradeHistory(self, m): + '''Test the function showPublicTradeHistory.''' + params = { 'trading_pair': 'btceur'} + base_url = 'https://api.bitcoin.de/v2/trades/history' + url_args = '?trading_pair={}'.format(params.get('trading_pair')) + response = { "trading_pair":"btceur", + "trades":[ + { + "date":1435922625, + "price":230, + "amount":"2.50000000", + "tid":1252020 + }, + { + "date":1435922655, + "price":200.1, + "amount":"0.60000000", + "tid":1252023 + } + ], + "errors":[], + "credits":19 + } + m.get(requests_mock.ANY, json=response, status_code=200) + btcde.showPublicTradeHistory(self.conn, params.get('trading_pair')) + history = m.request_history + self.assertEqual(history[0].method, "GET") + self.assertEqual(history[0].url, base_url + url_args) + + def test_showRates(self, m): + '''Test the function showRates.''' + params = { 'trading_pair': 'btceur'} + base_url = 'https://api.bitcoin.de/v2/rates' + url_args = '?trading_pair={}'.format(params.get('trading_pair')) + response = { "trading_pair":"btceur", + "rates":{ + "rate_weighted":"257.3999269", + "rate_weighted_3h":"258.93994247", + "rate_weighted_12h":"255.30363219" + }, + "errors":[], + "credits":19 + } + m.get(requests_mock.ANY, json=response, status_code=200) + btcde.showRates(self.conn, params.get('trading_pair')) + history = m.request_history + self.assertEqual(history[0].method, "GET") + self.assertEqual(history[0].url, base_url + url_args) + + def test_showAccountLedger(self, m): + '''Test the function showAccountLedger.''' + params = { 'currency': 'btceur'} + base_url = 'https://api.bitcoin.de/v2/account/ledger' + url_args = '?currency={}'.format(params.get('currency')) + response = { "trading_pair":"btceur", + "rates":{ + "rate_weighted":"257.3999269", + "rate_weighted_3h":"258.93994247", + "rate_weighted_12h":"255.30363219" + }, + "errors":[], + "credits":19 + } + m.get(requests_mock.ANY, json=response, status_code=200) + btcde.showAccountLedger(self.conn, params.get('currency')) + history = m.request_history + self.assertEqual(history[0].method, "GET") + self.assertEqual(history[0].url, base_url + url_args) + + From cae66af136ea3061917970edf198590fceb96043 Mon Sep 17 00:00:00 2001 From: peshay Date: Sun, 12 Nov 2017 20:13:01 +0100 Subject: [PATCH 2/5] adapt readme for branch --- README.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 679efdf..039a810 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -[![Build Status](https://travis-ci.org/peshay/btcde.svg?branch=master)](https://travis-ci.org/peshay/btcde) -[![Codecov](https://codecov.io/gh/peshay/btcde/branch/master/graph/badge.svg)](https://codecov.io/gh/peshay/btcde/branch/master) -[![Scrutinizer](https://scrutinizer-ci.com/g/peshay/btcde/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/peshay/btcde/?branch=master) +[![Build Status](https://travis-ci.org/peshay/btcde.svg?branch=new-test)](https://travis-ci.org/peshay/btcde) +[![Codecov](https://codecov.io/gh/peshay/btcde/branch/new-test/graph/badge.svg)](https://codecov.io/gh/peshay/btcde/branch/new-test) +[![Scrutinizer](https://scrutinizer-ci.com/g/peshay/btcde/badges/quality-score.png?b=new-test)](https://scrutinizer-ci.com/g/peshay/btcde/?branch=new-test) [![Python version](https://img.shields.io/pypi/pyversions/btcde.svg)](https://pypi.python.org/pypi/btcde) -[![license](https://img.shields.io/github/license/peshay/btcde.svg)](https://github.com/peshay/btcde/blob/master/LICENSE) +[![license](https://img.shields.io/github/license/peshay/btcde.svg)](https://github.com/peshay/btcde/blob/new-test/LICENSE) [![Beerpay](https://beerpay.io/peshay/btcde/badge.svg?style=beer)](https://beerpay.io/peshay/btcde) # btcde.py @@ -90,8 +90,3 @@ All mandatory parameters have to be passed to a function, all optional are resol #### showAccountLedger(conn, **args) *API Credits Cost: 3* - -## Support on Beerpay -Hey dude! Help me out for a couple of :beers:! - -[![Beerpay](https://beerpay.io/peshay/btcde/badge.svg?style=beer-square)](https://beerpay.io/peshay/btcde) [![Beerpay](https://beerpay.io/peshay/btcde/make-wish.svg?style=flat-square)](https://beerpay.io/peshay/btcde?focus=wish) From 61fa1538f43f127037ba44107057dd4b79ece6f7 Mon Sep 17 00:00:00 2001 From: Andreas Hubert Date: Sun, 10 Dec 2017 19:41:11 +0100 Subject: [PATCH 3/5] fixed showAccountLedger to work like API Documentation suggested --- btcde.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/btcde.py b/btcde.py index e33a9ee..8825f91 100644 --- a/btcde.py +++ b/btcde.py @@ -98,7 +98,7 @@ def set_header(conn, url, method, encoded_string): 'X-API-NONCE': str(nonce), 'X-API-SIGNATURE': hmac_signed } return header - + def send_request(url, method, header, encoded_string): if method == 'GET': r = requests.get(url, headers=(header), @@ -110,7 +110,7 @@ def send_request(url, method, header, encoded_string): r = requests.delete(url, headers=(header), stream=True, verify=False) return r - + def APIConnect(conn, method, params, uri): """Transform Parameters to URL""" url, encoded_string = params_url(params, uri) @@ -214,6 +214,9 @@ def showRates(conn, trading_pair): return APIConnect(conn, 'GET', params, newuri) -def showAccountLedger(conn, **args): +def showAccountLedger(conn, currency, **args): """Query on Account statement.""" - return APIConnect(conn, 'GET', args, accounturi + '/ledger') + params = {'currency': currency} + params.update(args) + args.update() + return APIConnect(conn, 'GET', params, accounturi + '/ledger') From 5d4ab0feec8d48553b74ff0738dbe57d23efdea7 Mon Sep 17 00:00:00 2001 From: Andreas Hubert Date: Sun, 10 Dec 2017 19:41:28 +0100 Subject: [PATCH 4/5] remove old tests --- tests/test_btcde.py | 135 -------------------------------------------- 1 file changed, 135 deletions(-) delete mode 100644 tests/test_btcde.py diff --git a/tests/test_btcde.py b/tests/test_btcde.py deleted file mode 100644 index 4a5a689..0000000 --- a/tests/test_btcde.py +++ /dev/null @@ -1,135 +0,0 @@ -from unittest import TestCase -from mock import patch -import btcde - -class TestBtcdeApi(TestCase): - """Test Api Functions.""" - - def setUp(self): - self.patcher = patch('btcde.APIConnect') - self.mock_APIConnect = self.patcher.start() - - def tearDown(self): - self.patcher.stop() - - def assertArguments(self, expected_arguments, mock_APIConnect): - for idx, expected in enumerate(expected_arguments): - actual = mock_APIConnect.call_args[0][idx] - self.assertEqual(actual, expected, - 'Argument {} with value {} ' - 'does not match expected {}'.format(idx, - actual, - expected)) - - def test_showOrderbook_buy_and_sell(self): - methods = 'buy', 'sell' - trading_pairs = ['btceur', 'bcheur', 'etheur'] - for trading_pair in trading_pairs: - for method in methods: - result = btcde.showOrderbook('mock', method, trading_pair) - expected_arguments = ['mock', 'GET', {'type': method, 'trading_pair': trading_pair}, btcde.orderuri] - self.assertArguments(expected_arguments, self.mock_APIConnect) - - def test_createOrder(self): - OrderType = 'now' - trading_pair = 'btceur' - max_amount = 5 - price = 10 - result = btcde.createOrder('mock', OrderType, trading_pair, max_amount, price) - params = {'type': OrderType, 'max_amount': max_amount, 'price': price, 'trading_pair': trading_pair} - expected_arguments = ['mock', 'POST', params, btcde.orderuri] - self.assertArguments(expected_arguments, self.mock_APIConnect) - - def test_deleteOrder(self): - order_id = '42' - trading_pair = 'btceur' - result = btcde.deleteOrder('mock', order_id, trading_pair) - params = {'order_id': order_id, 'trading_pair': trading_pair} - expected_arguments = ['mock', 'DELETE', params, btcde.orderuri + "/" + order_id + "/" + trading_pair] - self.assertArguments(expected_arguments, self.mock_APIConnect) - - def test_showMyOrders(self): - result = btcde.showMyOrders('mock') - expected_arguments = ['mock', 'GET', {}, btcde.orderuri + '/my_own'] - self.assertArguments(expected_arguments, self.mock_APIConnect) - - def test_showMyOrderDetails(self): - order_id = '42' - result = btcde.showMyOrderDetails('mock', order_id) - params = {'order_id': order_id} - expected_arguments = ['mock', 'GET', params, btcde.orderuri + '/' + order_id] - self.assertArguments(expected_arguments, self.mock_APIConnect) - - def test_executeTrade(self): - order_id = '42' - OrderType = 'foobar' - amount = '73' - trading_pair = 'btceur' - result = btcde.executeTrade('mock', order_id, OrderType, trading_pair, amount) - params = {'order_id': order_id, 'type': OrderType, 'amount': amount, 'trading_pair': trading_pair} - expected_arguments = ['mock', 'POST', params, btcde.tradeuri + '/' + order_id] - self.assertArguments(expected_arguments, self.mock_APIConnect) - - def test_showMyTrades(self): - result = btcde.showMyTrades('mock') - expected_arguments = ['mock', 'GET', {}, btcde.tradeuri] - self.assertArguments(expected_arguments, self.mock_APIConnect) - - def test_showMyTradeDetails(self): - trade_id = '42' - result = btcde.showMyTradeDetails('mock', trade_id) - params = {'trade_id': trade_id} - expected_arguments = ['mock', 'GET', params, btcde.tradeuri + '/' + trade_id] - self.assertArguments(expected_arguments, self.mock_APIConnect) - - def test_showAccountInfo(self): - result = btcde.showAccountInfo('mock') - params = {} - expected_arguments = ['mock', 'GET', params, btcde.accounturi] - self.assertArguments(expected_arguments, self.mock_APIConnect) - - def test_showOrderbookCompact(self): - trading_pair = 'btceur' - result = btcde.showOrderbookCompact('mock', trading_pair) - params = {'trading_pair': trading_pair} - expected_arguments = ['mock', 'GET', params, btcde.orderuri + '/compact'] - self.assertArguments(expected_arguments, self.mock_APIConnect) - - def test_showPublicTradeHistory(self): - trading_pair = 'btceur' - result1 = btcde.showPublicTradeHistory('mock', trading_pair) - params = {'trading_pair': trading_pair} - expected_arguments = ['mock', 'GET', params, btcde.tradeuri + '/history'] - self.assertArguments(expected_arguments, self.mock_APIConnect) - self.tearDown() - self.setUp() - since_tid = '3' - params.update({'since_tid': since_tid}) - result2 = btcde.showPublicTradeHistory('mock', trading_pair, since_tid) - expected_arguments = ['mock', 'GET', params, btcde.tradeuri + '/history'] - self.assertArguments(expected_arguments, self.mock_APIConnect) - - def test_showRates(self): - trading_pair = 'btceur' - result = btcde.showRates('mock',trading_pair ) - params = {'trading_pair': trading_pair} - expected_arguments = ['mock', 'GET', params, btcde.apihost + '/' + btcde.apiversion + '/rates'] - self.assertArguments(expected_arguments, self.mock_APIConnect) - - def test_showAccountLedger(self): - result = btcde.showAccountLedger('mock') - expected_arguments = ['mock', 'GET', {}, btcde.accounturi + '/ledger'] - self.assertArguments(expected_arguments, self.mock_APIConnect) - -class TestSimpleFunctions(TestCase): - - def test_params_url(self): - sample_params = { 'foo': 'bar', 'bar': 'foo'} - result = btcde.params_url(sample_params, 'https://foo.bar') - expected_result = 'https://foo.bar?bar=foo&foo=bar' - self.assertEquals(result[0], expected_result) - - def test_params_url_wo_params(self): - result = btcde.params_url({}, 'https://foo.bar') - expected_result = 'https://foo.bar' - self.assertEquals(result[0], expected_result) From cda2118fec0ba5ceb0cc268ec4591376ecb9a81a Mon Sep 17 00:00:00 2001 From: peshay Date: Sat, 16 Dec 2017 09:52:19 +0100 Subject: [PATCH 5/5] fixed all tests --- btcde.py | 6 +++--- tests/test_btcde_func.py | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/btcde.py b/btcde.py index 8825f91..4b3bb7e 100644 --- a/btcde.py +++ b/btcde.py @@ -150,7 +150,7 @@ def createOrder(conn, OrderType, trading_pair, max_amount, price, **args): def deleteOrder(conn, order_id, trading_pair): """Delete an Order.""" newuri = orderuri + "/" + order_id + "/" + trading_pair - params = {'order_id': order_id, 'trading_pair': trading_pair} + params = {} return APIConnect(conn, 'DELETE', params, newuri) @@ -163,7 +163,7 @@ def showMyOrders(conn, **args): def showMyOrderDetails(conn, order_id): """Details to an own Order.""" newuri = orderuri + '/' + order_id - params = {'order_id': order_id} + params = {} return APIConnect(conn, 'GET', params, newuri) @@ -182,7 +182,7 @@ def showMyTrades(conn, **args): def showMyTradeDetails(conn, trade_id): """Details to a specific Trade.""" newuri = tradeuri + '/' + trade_id - params = {'trade_id': trade_id} + params = {} return APIConnect(conn, 'GET', params, newuri) diff --git a/tests/test_btcde_func.py b/tests/test_btcde_func.py index 2e63410..590c5c3 100644 --- a/tests/test_btcde_func.py +++ b/tests/test_btcde_func.py @@ -96,14 +96,12 @@ def test_signature_delete(self, m): '''Test the signature on a delete request.''' order_id = 'A1234BC' trading_pair = 'btceur' - params = {'order_id': order_id, - 'trading_pair': trading_pair} m.delete(requests_mock.ANY, json={}, status_code=200) btcde.deleteOrder(self.conn, order_id, trading_pair) history = m.request_history request_signature = history[0].headers.get('X-API-SIGNATURE') url = btcde.orderuri + "/" + order_id + "/" + trading_pair - verified_signature = self.verifySignature(url, 'DELETE', params) + verified_signature = self.verifySignature(url, 'DELETE', {}) self.assertEqual(request_signature, verified_signature) def test_show_orderbook(self, m):