예제 #1
0
 def getTakerFee(self):
     if self.exchange == 'coinbasepro':
         api = CBAuthAPI(self.getAPIKey(), self.getAPISecret(), self.getAPIPassphrase(), self.getAPIURL())
         return api.getTakerFee()
     elif self.exchange == 'binance':
         api = BAuthAPI(self.getAPIKey(), self.getAPISecret(), self.getAPIURL())
         return api.getTakerFee(self.getMarket())
     else:
         return 0.005
예제 #2
0
 def getTakerFee(self):
     if self.isSimulation() is True and self.exchange == 'coinbasepro':
         return 0.005  # default lowest fee tier
     elif self.isSimulation() is True and self.exchange == 'binance':
         return 0.001  # default lowest fee tier
     elif self.exchange == 'coinbasepro':
         api = CBAuthAPI(self.getAPIKey(), self.getAPISecret(),
                         self.getAPIPassphrase(), self.getAPIURL())
         return api.getTakerFee()
     elif self.exchange == 'binance':
         api = BAuthAPI(self.getAPIKey(), self.getAPISecret(),
                        self.getAPIURL())
         return api.getTakerFee()
     else:
         return 0.005
def test_getTakerFeeWithMarket():
    filename = 'config.json'

    with open(filename) as config_file:
        config = json.load(config_file)

        api_key = ''
        api_secret = ''
        api_passphrase = ''
        api_url = ''
        if 'api_key' in config and 'api_secret' in config and 'api_pass' in config and 'api_url' in config:
            api_key = config['api_key']
            api_secret = config['api_secret']
            api_passphrase = config['api_pass']
            api_url = config['api_url']

        elif 'api_key' in config['coinbasepro'] and 'api_secret' in config[
                'coinbasepro'] and 'api_passphrase' in config[
                    'coinbasepro'] and 'api_url' in config['coinbasepro']:
            api_key = config['coinbasepro']['api_key']
            api_secret = config['coinbasepro']['api_secret']
            api_passphrase = config['coinbasepro']['api_passphrase']
            api_url = config['coinbasepro']['api_url']

    exchange = AuthAPI(api_key, api_secret, api_passphrase, api_url)
    assert type(exchange) is AuthAPI

    fee = exchange.getTakerFee(getValidOrderMarket())
    assert type(fee) is float
    assert fee > 0
def test_get_taker_fee_with_market():
    api_key = app.getAPIKey()
    api_secret = app.getAPISecret()
    api_passphrase = app.getAPIPassphrase()
    api_url = "https://public.sandbox.pro.coinbase.com"
    exchange = AuthAPI(api_key, api_secret, api_passphrase, api_url)
    assert type(exchange) is AuthAPI

    fee = exchange.getTakerFee()
    assert type(fee) is float
    assert fee == 0.005