Merge branch 'freqtrade:develop' into partial_sell

This commit is contained in:
Kavinkumar 2022-03-14 12:37:01 +05:30 committed by GitHub
commit 32ca2a1aaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 25 additions and 23 deletions

View File

@ -174,16 +174,17 @@ def drop_orders_table(engine, table_back_name: str):
def migrate_orders_table(engine, table_back_name: str, cols_order: List):
ft_fee_base = get_column_def(cols_order, 'ft_fee_base', 'null')
average = get_column_def(cols_order, 'average', 'null')
# let SQLAlchemy create the schema as required
with engine.begin() as connection:
connection.execute(text(f"""
insert into orders ( id, ft_trade_id, ft_order_side, ft_pair, ft_is_open, order_id,
status, symbol, order_type, side, price, amount, filled, average, remaining, cost,
order_date, order_filled_date, order_update_date, ft_fee_base)
status, symbol, order_type, side, price, amount, filled, average, remaining,
cost, order_date, order_filled_date, order_update_date, ft_fee_base)
select id, ft_trade_id, ft_order_side, ft_pair, ft_is_open, order_id,
status, symbol, order_type, side, price, amount, filled, null average, remaining, cost,
order_date, order_filled_date, order_update_date, {ft_fee_base}
status, symbol, order_type, side, price, amount, filled, {average} average, remaining,
cost, order_date, order_filled_date, order_update_date, {ft_fee_base} ft_fee_base
from {table_back_name}
"""))

View File

@ -98,7 +98,7 @@ class AgeFilter(IPairList):
"""
Validate age for the ticker
:param pair: Pair that's currently validated
:param ticker: ticker dict as returned from ccxt.fetch_tickers()
:param daily_candles: Downloaded daily candles
:return: True if the pair can stay, false if it should be removed
"""
# Check symbol in cache

View File

@ -51,7 +51,7 @@ class PrecisionFilter(IPairList):
:param ticker: ticker dict as returned from ccxt.fetch_tickers()
:return: True if the pair can stay, false if it should be removed
"""
stop_price = ticker['ask'] * self._stoploss
stop_price = ticker['last'] * self._stoploss
# Adjust stop-prices to precision
sp = self._exchange.price_to_precision(pair, stop_price)

View File

@ -90,7 +90,7 @@ class VolatilityFilter(IPairList):
"""
Validate trading range
:param pair: Pair that's currently validated
:param ticker: ticker dict as returned from ccxt.fetch_tickers()
:param daily_candles: Downloaded daily candles
:return: True if the pair can stay, false if it should be removed
"""
# Check symbol in cache

View File

@ -88,7 +88,7 @@ class RangeStabilityFilter(IPairList):
"""
Validate trading range
:param pair: Pair that's currently validated
:param ticker: ticker dict as returned from ccxt.fetch_tickers()
:param daily_candles: Downloaded daily candles
:return: True if the pair can stay, false if it should be removed
"""
# Check symbol in cache

View File

@ -582,7 +582,7 @@ class RPC:
else:
try:
pair = self._freqtrade.exchange.get_valid_pair_combination(coin, stake_currency)
rate = tickers.get(pair, {}).get('bid', None)
rate = tickers.get(pair, {}).get('last', None)
if rate:
if pair.startswith(stake_currency) and not pair.endswith(stake_currency):
rate = 1.0 / rate

View File

@ -6,8 +6,8 @@
coveralls==3.3.1
flake8==4.0.1
flake8-tidy-imports==4.6.0
mypy==0.931
pytest==7.0.1
mypy==0.940
pytest==7.1.0
pytest-asyncio==0.18.2
pytest-cov==3.0.0
pytest-mock==3.7.0
@ -17,12 +17,12 @@ isort==5.10.1
time-machine==2.6.0
# Convert jupyter notebooks to markdown documents
nbconvert==6.4.2
nbconvert==6.4.4
# mypy types
types-cachetools==4.2.10
types-cachetools==5.0.0
types-filelock==3.2.5
types-requests==2.27.11
types-requests==2.27.12
types-tabulate==0.8.5
# Extensions to datetime library

View File

@ -1,8 +1,8 @@
numpy==1.22.2
numpy==1.22.3
pandas==1.4.1
pandas-ta==0.3.14b
ccxt==1.75.12
ccxt==1.76.5
# Pin cryptography for now due to rust build errors with piwheels
cryptography==36.0.1
aiohttp==3.8.1
@ -32,7 +32,7 @@ sdnotify==0.3.2
# API Server
fastapi==0.75.0
uvicorn==0.17.5
uvicorn==0.17.6
pyjwt==2.3.0
aiofiles==0.8.0
psutil==5.9.0

View File

@ -42,7 +42,7 @@ setup(
],
install_requires=[
# from requirements.txt
'ccxt>=1.74.17',
'ccxt>=1.76.5',
'SQLAlchemy',
'python-telegram-bot>=13.4',
'arrow>=0.17.0',

View File

@ -611,8 +611,8 @@ def test_rpc_balance_handle(default_conf, mocker, tickers):
rpc._fiat_converter = CryptoToFiatConverter()
result = rpc._rpc_balance(default_conf['stake_currency'], default_conf['fiat_display_currency'])
assert prec_satoshi(result['total'], 12.309096315)
assert prec_satoshi(result['value'], 184636.44472997)
assert prec_satoshi(result['total'], 12.30909624)
assert prec_satoshi(result['value'], 184636.443606915)
assert tickers.call_count == 1
assert tickers.call_args_list[0][1]['cached'] is True
assert 'USD' == result['symbol']
@ -630,17 +630,16 @@ def test_rpc_balance_handle(default_conf, mocker, tickers):
'est_stake': 0.30794,
'used': 4.0,
'stake': 'BTC',
},
{'free': 5.0,
'balance': 10.0,
'currency': 'USDT',
'est_stake': 0.0011563153318162476,
'est_stake': 0.0011562404610161968,
'used': 5.0,
'stake': 'BTC',
}
]
assert result['total'] == 12.309096315331816
assert result['total'] == 12.309096240461017
def test_rpc_start(mocker, default_conf) -> None:

View File

@ -26,7 +26,9 @@ def test_ttl_cache():
assert 'a' in cache1h
t.move_to("2021-09-01 05:59:59 +00:00")
assert 'a' not in cache
assert 'a' in cache1h
t.move_to("2021-09-01 06:00:00 +00:00")
assert 'a' not in cache
assert 'a' not in cache1h