1

I am relatively new to Python and Software development in general. I have made the following code, and my query at this stage is, How do I connect to CCXT library using a user defined parameter or variable? `

class Exchange:
    """ docstring goes here """
    def __init__(self, ex_name):
        self.name = ex_name
        ex_obj = getattr(ccxt, ex_name)
        self.ex = ex_obj({
            'enableRateLimit': True
        })
        print(self.ex)      # just for checking connection


Exchange('binance')

How do I achieve THIS result?

exchange = ccxt.binance()
print(exchange.fetch_ticker('BTC/BUSD'))

`

How do I get to use the ccxt methods on custom/ user-defined variables or attributes.

  • I may be too new to Python to understand what you are doing here but when I create the `exchange` object this is my code ```exchange = ccxt.kucoin({})``` additionally I pass in the exchange credentials. So in the brackets above: ```({ 'password' : apiPassword, 'apiKey': apiKey, 'secret': apiSecret, 'enableRateLimit' : True, })``` It's for Kucoin but should be similar enough. – JoelAZ Jun 04 '23 at 19:16

0 Answers0