root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(root)

# ----------------------------------------------------------------------------

# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code

# ----------------------------------------------------------------------------

import ccxt  # noqa: F402

# ----------------------------------------------------------------------------

exchange = ccxt.Exchange({
    'id': 'regirock',
})

# ----------------------------------------------------------------------------

assert (exchange.iso8601(514862627000) == '1986-04-26T01:23:47.000Z')
assert (exchange.iso8601(0) == '1970-01-01T00:00:00.000Z')

assert (exchange.iso8601(-1) is None)
assert (exchange.iso8601() is None)
assert (exchange.iso8601(None) is None)
assert (exchange.iso8601('') is None)
assert (exchange.iso8601('a') is None)
assert (exchange.iso8601({}) is None)

# ----------------------------------------------------------------------------
Esempio n. 2
0
taker = 0.0025
maker = 0.0010
price = 100.00
amount = 10.00

market = {
    'id': 'foobar',
    'symbol': 'FOO/BAR',
    'base': 'FOO',
    'quote': 'BAR',
    'taker': taker,
    'maker': maker,
}

exchange = ccxt.Exchange({
    'id': 'mock',
    'markets': {
        'FOO/BAR': market
    },
})

exchange.calculate_fee(market['symbol'], 'limit', 'sell', amount, price,
                       'taker', {})

# {'rate': {'quote': 0.0025, 'base': 0.0}, 'cost': {'quote': 2.5, 'base': 0.0}}

exchange.calculate_fee(market['symbol'], 'limit', 'sell', amount, price,
                       'maker', {})

# {'rate': {'quote': 0.001, 'base': 0.0}, 'cost': {'quote': 1.0, 'base': 0.0}}
import os
import sys

# ------------------------------------------------------------------------------

root = os.path.dirname(os.path.abspath(__file__))
sys.path.append(root)

# ------------------------------------------------------------------------------

import ccxt  # noqa: E402

# ------------------------------------------------------------------------------

exchange = ccxt.Exchange()


class TestExchange(TestCase):
    def test_iso8601(self):
        self.assertEqual(exchange.iso8601(714862627000),
                         '1992-08-26T20:57:07.000Z')
        self.assertEqual(exchange.iso8601(0), '1970-01-01T00:00:00.000Z')

        self.assertEqual(exchange.iso8601(None), None)
        self.assertEqual(exchange.iso8601(), None)
        self.assertEqual(exchange.iso8601(-1), None)
        self.assertEqual(exchange.iso8601({}), None)
        self.assertEqual(exchange.iso8601(''), None)
        self.assertEqual(exchange.iso8601('a'), None)
        self.assertEqual(exchange.iso8601([]), None)
Esempio n. 4
0
	def calculateTxFee(self, market):
		exchange = ccxt.Exchange({
		  'id':self.exchange_id,
		  'markets':{'BTC/USDT': market},
		})
		return exchange.calculate_fee("BTC/USDT", 'limit', 'sell', 1000, 1000, 'taker', {})
import ccxt  # noqa: E402

market = {
    'id': 'foobar',
    'symbol': 'FOO/BAR',
    'base': 'FOO',
    'quote': 'BAR',
    'taker': '',
    'maker': '',
}

exchange = ccxt.Exchange({
    'id': 'mock',
    'markets': {
        'FOO/BAR': market
    },
    'requiresWeb3': True
})

# based on https://github.com/0xProject/0x-monorepo/blob/development/python-packages/order_utils/test/test_generate_order_hash_hex.py
example_order = {
    "makerAddress": "0x0000000000000000000000000000000000000000",
    "takerAddress": "0x0000000000000000000000000000000000000000",
    "senderAddress": "0x0000000000000000000000000000000000000000",
    "feeRecipientAddress": "0x0000000000000000000000000000000000000000",
    "makerAssetData": "0x0000000000000000000000000000000000000000",
    "takerAssetData": "0x0000000000000000000000000000000000000000",
    "salt": "0",
    "makerFee": "0",
    "takerFee": "0",
    "makerAssetAmount": "0",