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

Bitget TONCOIN issue in 4.3.4 #22235

Closed
edwardchenchen opened this issue Apr 22, 2024 · 3 comments
Closed

Bitget TONCOIN issue in 4.3.4 #22235

edwardchenchen opened this issue Apr 22, 2024 · 3 comments
Assignees
Labels

Comments

@edwardchenchen
Copy link

edwardchenchen commented Apr 22, 2024

Operating System

ubuntu 2204

Programming Languages

Python

CCXT Version

4.3.4

Description

https://api.bitget.com/api/v2/spot/public/symbols?symbol=TONCOINUSDT
return

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1713757475532,
    "data": [
        {
            "symbol": "TONCOINUSDT",
            "baseCoin": "TONCOIN",
            "quoteCoin": "USDT",
            "minTradeAmount": "0",
            "maxTradeAmount": "10000000000",
            "takerFeeRate": "0.001",
            "makerFeeRate": "0.001",
            "pricePrecision": "5",
            "quantityPrecision": "2",
            "quotePrecision": "6",
            "status": "online",
            "minTradeUSDT": "5",
            "buyLimitPriceRatio": "0.1",
            "sellLimitPriceRatio": "0.1",
            "areaSymbol": "no"
        }
    ]
}

in ccxt 4.2.75

    import ccxt
    exchange = ccxt.bitget()
    symbol = "TONCOIN/USDT"
    data = exchange.fetch_ticker(symbol)
    print(json.dumps(data, indent=4, default=str))

prints

{
    "symbol": "TONCOIN/USDT",
    "timestamp": 1713759009444,
    "datetime": "2024-04-22T04:10:09.444Z",
    "high": 6.60879,
    "low": 5.99003,
    "bid": 6.18556,
    "bidVolume": 0.86,
    "ask": 6.19186,
    "askVolume": 3.8,
    "vwap": 6.253684561665931,
    "open": 6.22383,
    "close": 6.18556,
    "last": 6.18556,
    "previousClose": null,
    "change": 0.0117,
    "percentage": 1.17,
    "average": 6.204695,
    "baseVolume": 178846.24,
    "quoteVolume": 1118447.97,
    "info": {
        "open": "6.22383",
        "symbol": "TONCOINUSDT",
        "high24h": "6.60879",
        "low24h": "5.99003",
        "lastPr": "6.18556",
        "quoteVolume": "1118447.97",
        "baseVolume": "178846.24",
        "usdtVolume": "1118447.9655168",
        "ts": "1713759009444",
        "bidPr": "6.18556",
        "askPr": "6.19186",
        "bidSz": "0.86",
        "askSz": "3.8",
        "openUtc": "6.13747",
        "changeUtc24h": "0.00784",
        "change24h": "0.0117"
    }
}

however in ccxt 4.3.4

    import ccxt
    exchange = ccxt.bitget()
    symbol = "TONCOIN/USDT"
    data = exchange.fetch_ticker(symbol)
    print(json.dumps(data, indent=4, default=str))

throws error

crypto/bitget_demo_2.py", line 42, in <module>
    data = exchange.fetch_ticker(symbol)
  File "/Users/echen/opt/anaconda3/envs/cc-39/lib/python3.9/site-packages/ccxt/bitget.py", line 2620, in fetch_ticker
    market = self.market(symbol)
  File "/Users/echen/opt/anaconda3/envs/cc-39/lib/python3.9/site-packages/ccxt/base/exchange.py", line 4497, in market
    raise BadSymbol(self.id + ' does not have market symbol ' + symbol)
ccxt.base.errors.BadSymbol: bitget does not have market symbol TONCOIN/USDT

I have to use TON/USDT

is this intended change of behavior

Code

  

@carlosmiei carlosmiei self-assigned this Apr 22, 2024
@carlosmiei
Copy link
Collaborator

Hello @edwardchenchen,
Yes we did that override because most exchanges refer to it as TON and not TONCOIN. If you want you can revert it by doing this exchange.commonCurrencies['TONCOIN'] = 'TONCOIN' right after instantiating the exchange.

@edwardchenchen
Copy link
Author

ok, I see how it works, and it also opens lot of possibilities to fix what I am currently doing workarounds.

e.g
https://www.bitget.com/support/articles/12560603808156

exchange.commonCurrencies['OMNI'] = 'SOMETHING_ELSE'
exchange.commonCurrencies['OMNI1'] = 'OMNI'

so I can make changes to any symbol to make it consistent across all exchanges

@carlosmiei
Copy link
Collaborator

@edwardchenchen That's exactly what commonCurrencies is meant for, just make sure you set the overrides before start using the unified methods or calling load_markets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants