Compare commits
19 Commits
feat/freqa
...
2022.4.2
Author | SHA1 | Date | |
---|---|---|---|
|
851c5dad30 | ||
|
5b76ae452f | ||
|
2c750fdb09 | ||
|
e7f5252074 | ||
|
dfbd1c34c4 | ||
|
7615c4e904 | ||
|
e9b78bf3ae | ||
|
2e397a88e1 | ||
|
fe6c62e144 | ||
|
f0db721f05 | ||
|
4d8d30ea39 | ||
|
e90e3cead0 | ||
|
a568548192 | ||
|
f9d10a7fad | ||
|
cbc2b00ee6 | ||
|
8f7b857ae9 | ||
|
e88b022cd4 | ||
|
bfb738f69f | ||
|
00dd8e76ee |
@@ -1,5 +1,5 @@
|
||||
""" Freqtrade bot """
|
||||
__version__ = 'develop'
|
||||
__version__ = '2022.4.2'
|
||||
|
||||
if 'dev' in __version__:
|
||||
try:
|
||||
|
@@ -1613,7 +1613,9 @@ class Exchange:
|
||||
order['fee']['cost'] / safe_value_fallback2(order, order, 'filled', 'amount'), 8)
|
||||
elif fee_curr in self.get_pair_quote_currency(order['symbol']):
|
||||
# Quote currency - divide by cost
|
||||
return round(order['fee']['cost'] / order['cost'], 8) if order['cost'] else None
|
||||
return round(self._contracts_to_amount(
|
||||
order['symbol'], order['fee']['cost']) / order['cost'],
|
||||
8) if order['cost'] else None
|
||||
else:
|
||||
# If Fee currency is a different currency
|
||||
if not order['cost']:
|
||||
@@ -1628,7 +1630,8 @@ class Exchange:
|
||||
fee_to_quote_rate = self._config['exchange'].get('unknown_fee_rate', None)
|
||||
if not fee_to_quote_rate:
|
||||
return None
|
||||
return round((order['fee']['cost'] * fee_to_quote_rate) / order['cost'], 8)
|
||||
return round((self._contracts_to_amount(
|
||||
order['symbol'], order['fee']['cost']) * fee_to_quote_rate) / order['cost'], 8)
|
||||
|
||||
def extract_cost_curr_rate(self, order: Dict) -> Tuple[float, str, Optional[float]]:
|
||||
"""
|
||||
|
@@ -599,7 +599,6 @@ class FreqtradeBot(LoggingMixin):
|
||||
pair, price, stake_amount, trade_side, enter_tag, trade)
|
||||
|
||||
if not stake_amount:
|
||||
logger.info(f"No stake amount to enter a trade for {pair}.")
|
||||
return False
|
||||
|
||||
if pos_adjust:
|
||||
|
@@ -4151,7 +4151,10 @@ def test__order_contracts_to_amount(
|
||||
'cost': 60.0,
|
||||
'filled': None,
|
||||
'remaining': 30.0,
|
||||
'fee': 0.06,
|
||||
'fee': {
|
||||
'currency': 'USDT',
|
||||
'cost': 0.06,
|
||||
},
|
||||
'fees': [{
|
||||
'currency': 'USDT',
|
||||
'cost': 0.06,
|
||||
@@ -4178,7 +4181,10 @@ def test__order_contracts_to_amount(
|
||||
'cost': 80.0,
|
||||
'filled': None,
|
||||
'remaining': 40.0,
|
||||
'fee': 0.08,
|
||||
'fee': {
|
||||
'currency': 'USDT',
|
||||
'cost': 0.08,
|
||||
},
|
||||
'fees': [{
|
||||
'currency': 'USDT',
|
||||
'cost': 0.08,
|
||||
@@ -4212,12 +4218,18 @@ def test__order_contracts_to_amount(
|
||||
'info': {},
|
||||
},
|
||||
]
|
||||
order1_bef = orders[0]
|
||||
order2_bef = orders[1]
|
||||
order1 = exchange._order_contracts_to_amount(deepcopy(order1_bef))
|
||||
order2 = exchange._order_contracts_to_amount(deepcopy(order2_bef))
|
||||
assert order1['amount'] == order1_bef['amount'] * contract_size
|
||||
assert order1['cost'] == order1_bef['cost'] * contract_size
|
||||
|
||||
order1 = exchange._order_contracts_to_amount(orders[0])
|
||||
order2 = exchange._order_contracts_to_amount(orders[1])
|
||||
assert order2['amount'] == order2_bef['amount'] * contract_size
|
||||
assert order2['cost'] == order2_bef['cost'] * contract_size
|
||||
|
||||
# Don't fail
|
||||
exchange._order_contracts_to_amount(orders[2])
|
||||
assert order1['amount'] == 30.0 * contract_size
|
||||
assert order2['amount'] == 40.0 * contract_size
|
||||
|
||||
|
||||
@pytest.mark.parametrize('pair,contract_size,trading_mode', [
|
||||
|
Reference in New Issue
Block a user