Skip to content

Commit

Permalink
[Exchanges] add CoinEx tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Jan 18, 2024
1 parent 0225b47 commit e110897
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,13 @@ async def inner_test_create_and_cancel_limit_orders(self, symbol=None, settlemen
# # end debug tools
open_orders = await self.get_open_orders(exchange_data)
buy_limit = await self.create_limit_order(price, size, trading_enums.TradeOrderSide.BUY, symbol=symbol)
self.check_created_limit_order(buy_limit, price, size, trading_enums.TradeOrderSide.BUY)
assert await self.order_in_open_orders(open_orders, buy_limit, symbol=symbol)
await self.check_can_get_order(buy_limit)
await self.cancel_order(buy_limit)
try:
self.check_created_limit_order(buy_limit, price, size, trading_enums.TradeOrderSide.BUY)
assert await self.order_in_open_orders(open_orders, buy_limit, symbol=symbol)
await self.check_can_get_order(buy_limit)
finally:
# don't leave buy_limit as open order
await self.cancel_order(buy_limit)
assert await self.order_not_in_open_orders(open_orders, buy_limit, symbol=symbol)

async def test_create_and_fill_market_orders(self):
Expand Down
75 changes: 75 additions & 0 deletions additional_tests/exchanges_tests/test_coinex.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# This file is part of OctoBot (https://github.com/Drakkar-Software/OctoBot)
# Copyright (c) 2023 Drakkar-Software, All rights reserved.
#
# OctoBot is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either
# version 3.0 of the License, or (at your option) any later version.
#
# OctoBot is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with OctoBot. If not, see <https://www.gnu.org/licenses/>.
import pytest

from additional_tests.exchanges_tests import abstract_authenticated_exchange_tester

# All test coroutines will be treated as marked.
pytestmark = pytest.mark.asyncio


class TestCoinExAuthenticatedExchange(
abstract_authenticated_exchange_tester.AbstractAuthenticatedExchangeTester
):
# enter exchange name as a class variable here
EXCHANGE_NAME = "coinex"
ORDER_CURRENCY = "BTC"
SETTLEMENT_CURRENCY = "USDT"
SYMBOL = f"{ORDER_CURRENCY}/{SETTLEMENT_CURRENCY}"
ORDER_SIZE = 70 # % of portfolio to include in test orders
CONVERTS_ORDER_SIZE_BEFORE_PUSHING_TO_EXCHANGES = True

async def test_get_portfolio(self):
await super().test_get_portfolio()

async def test_get_portfolio_with_market_filter(self):
await super().test_get_portfolio_with_market_filter()

async def test_get_account_id(self):
# pass if not implemented
pass

async def test_create_and_cancel_limit_orders(self):
await super().test_create_and_cancel_limit_orders()

async def test_create_and_fill_market_orders(self):
await super().test_create_and_fill_market_orders()

async def test_get_my_recent_trades(self):
await super().test_get_my_recent_trades()

async def test_get_closed_orders(self):
await super().test_get_closed_orders()

async def test_create_and_cancel_stop_orders(self):
# pass if not implemented
pass

async def test_edit_limit_order(self):
# pass if not implemented
pass

async def test_edit_stop_order(self):
# pass if not implemented
pass

async def test_create_single_bundled_orders(self):
# pass if not implemented
pass

async def test_create_double_bundled_orders(self):
# pass if not implemented
pass
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Drakkar-Software requirements
OctoBot-Commons==1.9.37
OctoBot-Trading==2.4.50
OctoBot-Trading==2.4.51
OctoBot-Evaluators==1.9.4
OctoBot-Tentacles-Manager==2.9.8
OctoBot-Tentacles-Manager==2.9.9
OctoBot-Services==1.6.10
OctoBot-Backtesting==1.9.7
Async-Channel==2.2.1
trading-backend==1.2.12
trading-backend==1.2.13

## Others
colorlog==6.8.0
Expand Down

0 comments on commit e110897

Please sign in to comment.