Skip to content

Commit f174701

Browse files
committed
[Tests] Add polymarket authenticated tests
1 parent 25dc5dc commit f174701

File tree

3 files changed

+138
-1
lines changed

3 files changed

+138
-1
lines changed

additional_tests/exchanges_tests/.env.template

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ PHEMEX_KEY=
1616
PHEMEX_SECRET=
1717
PHEMEX_PASSWORD=
1818
PHEMEX_SANDBOXED=true
19+
20+
POLYMARKET_KEY=
21+
POLYMARKET_SECRET=
22+
POLYMARKET_PASSWORD=

additional_tests/exchanges_tests/abstract_authenticated_exchange_tester.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ async def test_create_and_cancel_limit_orders(self):
555555
async def inner_test_create_and_cancel_limit_orders(self, symbol=None, settlement_currency=None, **kwargs):
556556
symbol = symbol or self.SYMBOL
557557
side = trading_enums.TradeOrderSide.BUY
558+
is_fetch_cancelled_orders_supported = True
558559
# # DEBUG tools p1, uncomment to create specific orders
559560
# symbol = "ADA/USDT"
560561
# # end debug tools
@@ -598,7 +599,11 @@ async def inner_test_create_and_cancel_limit_orders(self, symbol=None, settlemen
598599
# )
599600
# # end debug tools
600601
open_orders = await self.get_open_orders(exchange_data)
601-
cancelled_orders = await self.get_cancelled_orders(exchange_data)
602+
try:
603+
cancelled_orders = await self.get_cancelled_orders(exchange_data)
604+
except trading_errors.NotSupported as err:
605+
is_fetch_cancelled_orders_supported = False
606+
cancelled_orders = []
602607
if self.CHECK_EMPTY_ACCOUNT:
603608
assert size >= trading_constants.ZERO if enable_min_size_check else size == trading_constants.ZERO
604609
assert open_orders == []
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# This file is part of OctoBot (https://github.com/Drakkar-Software/OctoBot)
2+
# Copyright (c) 2025 Drakkar-Software, All rights reserved.
3+
#
4+
# OctoBot is free software; you can redistribute it and/or
5+
# modify it under the terms of the GNU General Public License
6+
# as published by the Free Software Foundation; either
7+
# version 3.0 of the License, or (at your option) any later version.
8+
#
9+
# OctoBot is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
# General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public
15+
# License along with OctoBot. If not, see <https://www.gnu.org/licenses/>.
16+
import pytest
17+
18+
from additional_tests.exchanges_tests import abstract_authenticated_exchange_tester
19+
20+
try:
21+
import tentacles.Trading.Exchange.polymarket.ccxt.polymarket_async
22+
except ImportError:
23+
pytest.skip(
24+
reason=(
25+
"Polymarket tentacle is not installed, skipping TestPolymarketAuthenticatedExchange"
26+
)
27+
)
28+
29+
# All test coroutines will be treated as marked.
30+
pytestmark = pytest.mark.asyncio
31+
32+
33+
class TestPolymarketAuthenticatedExchange(
34+
abstract_authenticated_exchange_tester.AbstractAuthenticatedExchangeTester
35+
):
36+
# enter exchange name as a class variable here
37+
EXCHANGE_NAME = "polymarket"
38+
ORDER_CURRENCY = "will-bitcoin-replace-sha-256-before-2027"
39+
SETTLEMENT_CURRENCY = "USDC"
40+
EXPIRATION_DATE = "261231"
41+
SYMBOL = f"{ORDER_CURRENCY}/{SETTLEMENT_CURRENCY}:{SETTLEMENT_CURRENCY}-{EXPIRATION_DATE}"
42+
ORDER_SIZE = 0.1 # % of portfolio to include in test orders
43+
EXPECT_MISSING_FEE_IN_CANCELLED_ORDERS = False
44+
45+
async def test_get_portfolio(self):
46+
await super().test_get_portfolio()
47+
48+
async def test_get_portfolio_with_market_filter(self):
49+
# pass if not implemented
50+
pass
51+
52+
async def test_untradable_symbols(self):
53+
# pass if not implemented
54+
pass
55+
56+
async def test_get_max_orders_count(self):
57+
# pass if not implemented
58+
pass
59+
60+
async def test_get_account_id(self):
61+
# pass if not implemented
62+
pass
63+
64+
async def test_is_authenticated_request(self):
65+
await super().test_is_authenticated_request()
66+
67+
async def test_invalid_api_key_error(self):
68+
await super().test_invalid_api_key_error() # TODO fix ExchangeError instead of AuthenticationError ?
69+
70+
async def test_get_api_key_permissions(self):
71+
# pass if not implemented
72+
pass
73+
74+
async def test_missing_trading_api_key_permissions(self):
75+
pass
76+
77+
async def test_api_key_ip_whitelist_error(self):
78+
# pass if not implemented
79+
pass
80+
81+
async def test_get_not_found_order(self):
82+
await super().test_get_not_found_order()
83+
84+
async def test_is_valid_account(self):
85+
# pass if not implemented
86+
pass
87+
88+
async def test_get_special_orders(self):
89+
# pass if not implemented
90+
pass
91+
92+
async def test_create_and_cancel_limit_orders(self):
93+
await super().test_create_and_cancel_limit_orders()
94+
95+
async def test_create_and_fill_market_orders(self):
96+
# pass if not implemented
97+
pass
98+
99+
async def test_get_my_recent_trades(self):
100+
await super().test_get_my_recent_trades() # TODO requires trades on my account for SYMBOL
101+
102+
async def test_get_closed_orders(self):
103+
# pass if not implemented
104+
pass
105+
106+
async def test_get_cancelled_orders(self):
107+
# pass if not implemented
108+
pass
109+
110+
async def test_create_and_cancel_stop_orders(self):
111+
# pass if not implemented
112+
pass
113+
114+
async def test_edit_limit_order(self):
115+
# pass if not implemented
116+
pass
117+
118+
async def test_edit_stop_order(self):
119+
# pass if not implemented
120+
pass
121+
122+
async def test_create_single_bundled_orders(self):
123+
# pass if not implemented
124+
pass
125+
126+
async def test_create_double_bundled_orders(self):
127+
# pass if not implemented
128+
pass

0 commit comments

Comments
 (0)