Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce newer ccxt and accomodate changes. #386

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pdr_backend/trader/approach1/test/test_ccxt_exchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

@enforce_types
def test_ccxt_mexc_pairs():
exchange = ccxt.mexc3()
exchange = ccxt.mexc()
markets = exchange.load_markets()

# print(f"MEXC symbols: {[v.get('symbol','') for k,v in exchange.markets.items()]}")
Expand Down
4 changes: 2 additions & 2 deletions pdr_backend/trader/approach1/test/test_trader_agent1.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def mock_feed():
@patch.object(TraderAgent1, "check_subscriptions_and_subscribe")
def test_new_agent(check_subscriptions_and_subscribe_mock, predictoor_contract):
trader_config = Mock(spec=TraderConfig1)
trader_config.exchange_str = "mexc3"
trader_config.exchange_str = "mexc"
trader_config.exchange_pair = "BTC/USDT"
trader_config.timeframe = "5m"
trader_config.size = 10.0
Expand Down Expand Up @@ -53,7 +53,7 @@ async def test_do_trade(
web3_config,
):
trader_config = Mock(spec=TraderConfig1)
trader_config.exchange_str = "mexc3"
trader_config.exchange_str = "mexc"
trader_config.exchange_pair = "BTC/USDT"
trader_config.timeframe = "5m"
trader_config.size = 10.0
Expand Down
2 changes: 1 addition & 1 deletion pdr_backend/trader/approach1/trader_agent1.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async def do_trade(self, feed: Feed, prediction: Tuple[float, float]):
if self.order is not None and isinstance(self.order, dict):
# get existing long position
amount = 0.0
if self.config.exchange_str in ("mexc", "mexc3"):
if self.config.exchange_str in ("mexc"):
amount = float(self.order["info"]["origQty"])

# close it
Expand Down
4 changes: 2 additions & 2 deletions pdr_backend/trader/approach1/trader_config1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pdr_backend.trader.trader_config import TraderConfig

CAND_EXCHANGE = ["mexc3", "mexc"]
CAND_EXCHANGE = ["mexc"]
CAND_PAIR = [
"BTC/USDT",
"ETH/USDT",
Expand All @@ -20,7 +20,7 @@
CAND_TIMEFRAME = ["5m", "1h"]


# Mexc3 does not support
# Mexc does not support
@enforce_types
class TraderConfig1(TraderConfig):
def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion pdr_backend/trader/approach2/portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def timestamp(self):


def create_order(order: Dict, exchange: ccxt.Exchange) -> Order:
if exchange in ("mexc", "mexc3"):
if exchange in ("mexc"):
return MEXCOrder(order)
return Order(order)

Expand Down
8 changes: 4 additions & 4 deletions pdr_backend/trader/approach2/test/test_trader_agent2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def mock_feed():
def test_new_agent(check_subscriptions_and_subscribe_mock, predictoor_contract):
# Setting up the mock trader configuration
trader_config = Mock(spec=TraderConfig2)
trader_config.exchange_str = "mexc3"
trader_config.exchange_str = "mexc"
trader_config.exchange_pair = "BTC/USDT"
trader_config.timeframe = "5m"
trader_config.size = 10.0
Expand Down Expand Up @@ -60,7 +60,7 @@ async def test_do_trade(
):
# Mocking the trader configuration
trader_config = Mock(spec=TraderConfig2)
trader_config.exchange_str = "mexc3"
trader_config.exchange_str = "mexc"
trader_config.exchange_pair = "BTC/USDT"
trader_config.timeframe = "5m"
trader_config.size = 10.0
Expand Down Expand Up @@ -113,7 +113,7 @@ def test_update_positions(
web3_config,
):
trader_config = Mock(spec=TraderConfig2)
trader_config.exchange_str = "mexc3"
trader_config.exchange_str = "mexc"
trader_config.exchange_pair = "BTC/USDT"
trader_config.timeframe = "5m"
trader_config.size = 10.0
Expand Down Expand Up @@ -170,7 +170,7 @@ def test_should_close(
web3_config,
):
trader_config = Mock(spec=TraderConfig2)
trader_config.exchange_str = "mexc3"
trader_config.exchange_str = "mexc"
trader_config.exchange_pair = "BTC/USDT"
trader_config.timeframe = "5m"
trader_config.size = 10.0
Expand Down
4 changes: 2 additions & 2 deletions pdr_backend/trader/approach2/trader_config2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pdr_backend.trader.trader_config import TraderConfig

CAND_EXCHANGE = ["mexc3", "mexc"]
CAND_EXCHANGE = ["mexc"]
CAND_PAIR = [
"BTC/USDT",
"ETH/USDT",
Expand All @@ -20,7 +20,7 @@
CAND_TIMEFRAME = ["5m", "1h"]


# Mexc3 does not support
# Mexc does not support
class TraderConfig2(TraderConfig):
@enforce_types
def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# or pip install -e .
install_requirements = [
"bumpversion",
"ccxt",
"ccxt>=4.1.59",
"coverage",
"enforce_typing",
"eth-account",
Expand Down