forked from ccxt/ccxt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_calculate_fee.py
More file actions
47 lines (33 loc) · 1.07 KB
/
test_calculate_fee.py
File metadata and controls
47 lines (33 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- coding: utf-8 -*-
# THIS IS A MOCKUP FILE IN PROGRESS
# import argparse
import os
import sys
# import json
# import time
# ------------------------------------------------------------------------------
root = os.path.dirname(os.path.abspath(__file__))
sys.path.append(root)
# ------------------------------------------------------------------------------
import ccxt # noqa: E402
# ------------------------------------------------------------------------------
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}}