Compare commits

...

34 Commits

Author SHA1 Message Date
Jakub W.
954da3298f
Merge 5ec04d168e into 2fe67edab3 2024-09-16 22:37:49 +02:00
Matthias
2fe67edab3 chore: update link to okx liquidation formula
Some checks failed
Build Documentation / Deploy Docs through mike (push) Waiting to run
Pre-commit auto-update / auto-update (push) Has been cancelled
2024-09-16 19:05:00 +02:00
Matthias
167e43cbef
Merge pull request #10655 from freqtrade/dependabot/pip/develop/types-dda07fe7e8
Some checks are pending
Build Documentation / Deploy Docs through mike (push) Waiting to run
chore(deps-dev): bump types-requests from 2.32.0.20240907 to 2.32.0.20240914 in the types group
2024-09-16 11:12:07 +02:00
Matthias
d8cb407c25
Merge pull request #10666 from freqtrade/dependabot/pip/develop/pydantic-2.9.1
chore(deps): bump pydantic from 2.9.0 to 2.9.1
2024-09-16 10:56:51 +02:00
Matthias
9452afe3f7
Merge pull request #10660 from freqtrade/dependabot/pip/develop/ruff-0.6.5
chore(deps-dev): bump ruff from 0.6.4 to 0.6.5
2024-09-16 10:21:12 +02:00
Matthias
8dc6d9ce7d
Merge pull request #10665 from freqtrade/dependabot/pip/develop/rich-13.8.1
chore(deps): bump rich from 13.8.0 to 13.8.1
2024-09-16 09:45:01 +02:00
Matthias
bf4b8a318d
Merge pull request #10661 from freqtrade/dependabot/pip/develop/scikit-learn-1.5.2
chore(deps): bump scikit-learn from 1.5.1 to 1.5.2
2024-09-16 09:44:31 +02:00
Matthias
20f6022050
Merge pull request #10663 from freqtrade/dependabot/pip/develop/ccxt-4.4.3
chore(deps): bump ccxt from 4.3.98 to 4.4.3
2024-09-16 09:33:16 +02:00
dependabot[bot]
65e6c737cd
chore(deps): bump pydantic from 2.9.0 to 2.9.1
Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.9.0 to 2.9.1.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md)
- [Commits](https://github.com/pydantic/pydantic/compare/v2.9.0...v2.9.1)

---
updated-dependencies:
- dependency-name: pydantic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 07:07:06 +00:00
Matthias
6d2572e347
Merge pull request #10662 from freqtrade/dependabot/pip/develop/fastapi-0.114.2
Some checks are pending
Build Documentation / Deploy Docs through mike (push) Waiting to run
chore(deps): bump fastapi from 0.114.0 to 0.114.2
2024-09-16 09:06:12 +02:00
Matthias
52a35197c7
Merge pull request #10659 from freqtrade/dependabot/pip/develop/pytz-2024.2
chore(deps): bump pytz from 2024.1 to 2024.2
2024-09-16 08:33:08 +02:00
Matthias
2b3a41db3e
Merge pull request #10658 from freqtrade/dependabot/pip/develop/urllib3-2.2.3
chore(deps): bump urllib3 from 2.2.2 to 2.2.3
2024-09-16 08:32:52 +02:00
dependabot[bot]
09c1459411
chore(deps-dev): bump ruff from 0.6.4 to 0.6.5
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.4 to 0.6.5.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.6.4...0.6.5)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 06:17:40 +00:00
Matthias
98f18b89da
Merge pull request #10657 from freqtrade/dependabot/pip/develop/plotly-5.24.1
chore(deps): bump plotly from 5.24.0 to 5.24.1
2024-09-16 08:16:56 +02:00
Matthias
4249db4330
Merge pull request #10656 from freqtrade/dependabot/pip/develop/pytest-baa91b6655
chore(deps-dev): bump pytest from 8.3.2 to 8.3.3 in the pytest group
2024-09-16 08:16:43 +02:00
Matthias
a7f46500ed
chore: bump types-requests in pre-commit 2024-09-16 06:38:45 +02:00
dependabot[bot]
c73fa2b0eb
chore(deps): bump rich from 13.8.0 to 13.8.1
Bumps [rich](https://github.com/Textualize/rich) from 13.8.0 to 13.8.1.
- [Release notes](https://github.com/Textualize/rich/releases)
- [Changelog](https://github.com/Textualize/rich/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Textualize/rich/compare/v13.8.0...v13.8.1)

---
updated-dependencies:
- dependency-name: rich
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 03:18:09 +00:00
dependabot[bot]
db4c4b971a
chore(deps): bump ccxt from 4.3.98 to 4.4.3
Bumps [ccxt](https://github.com/ccxt/ccxt) from 4.3.98 to 4.4.3.
- [Release notes](https://github.com/ccxt/ccxt/releases)
- [Changelog](https://github.com/ccxt/ccxt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ccxt/ccxt/compare/4.3.98...4.4.3)

---
updated-dependencies:
- dependency-name: ccxt
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 03:17:58 +00:00
dependabot[bot]
e9ccc98ada
chore(deps): bump fastapi from 0.114.0 to 0.114.2
Bumps [fastapi](https://github.com/fastapi/fastapi) from 0.114.0 to 0.114.2.
- [Release notes](https://github.com/fastapi/fastapi/releases)
- [Commits](https://github.com/fastapi/fastapi/compare/0.114.0...0.114.2)

---
updated-dependencies:
- dependency-name: fastapi
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 03:17:46 +00:00
dependabot[bot]
11d6ec33b3
chore(deps): bump scikit-learn from 1.5.1 to 1.5.2
Bumps [scikit-learn](https://github.com/scikit-learn/scikit-learn) from 1.5.1 to 1.5.2.
- [Release notes](https://github.com/scikit-learn/scikit-learn/releases)
- [Commits](https://github.com/scikit-learn/scikit-learn/compare/1.5.1...1.5.2)

---
updated-dependencies:
- dependency-name: scikit-learn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 03:17:39 +00:00
dependabot[bot]
c3b6f4ca85
chore(deps): bump pytz from 2024.1 to 2024.2
Bumps [pytz](https://github.com/stub42/pytz) from 2024.1 to 2024.2.
- [Release notes](https://github.com/stub42/pytz/releases)
- [Commits](https://github.com/stub42/pytz/compare/release_2024.1...release_2024.2)

---
updated-dependencies:
- dependency-name: pytz
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 03:17:21 +00:00
dependabot[bot]
d37405a307
chore(deps): bump urllib3 from 2.2.2 to 2.2.3
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.2 to 2.2.3.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.2.2...2.2.3)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 03:17:05 +00:00
dependabot[bot]
d7a9841328
chore(deps): bump plotly from 5.24.0 to 5.24.1
Bumps [plotly](https://github.com/plotly/plotly.py) from 5.24.0 to 5.24.1.
- [Release notes](https://github.com/plotly/plotly.py/releases)
- [Changelog](https://github.com/plotly/plotly.py/blob/master/CHANGELOG.md)
- [Commits](https://github.com/plotly/plotly.py/compare/v5.24.0...v5.24.1)

---
updated-dependencies:
- dependency-name: plotly
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 03:17:01 +00:00
dependabot[bot]
cf3af42477
chore(deps-dev): bump pytest from 8.3.2 to 8.3.3 in the pytest group
Bumps the pytest group with 1 update: [pytest](https://github.com/pytest-dev/pytest).


Updates `pytest` from 8.3.2 to 8.3.3
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/8.3.2...8.3.3)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: pytest
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 03:16:39 +00:00
dependabot[bot]
ad8e6e7d67
chore(deps-dev): bump types-requests in the types group
Bumps the types group with 1 update: [types-requests](https://github.com/python/typeshed).


Updates `types-requests` from 2.32.0.20240907 to 2.32.0.20240914
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-requests
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: types
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 03:15:58 +00:00
Jakub Werner (jakubikan)
5ec04d168e removing sandbox mode 2024-03-23 12:39:40 +01:00
Jakub Werner (jakubikan)
26afad8bc1 adding some addtional test and makine cache a bit better 2024-03-23 12:27:59 +01:00
Jakub Werner (jakubikan)
80dd586dc7 fix 2024-03-23 11:28:34 +01:00
Jakub Werner (jakubikan)
78d189564f JW; testing with sandbox mode 2024-03-23 11:26:26 +01:00
Jakub Werner (jakubikan)
2b0b85330e works also without __class__ 2024-03-22 21:40:36 +01:00
Jakub Werner (jakubikan)
4257e1ca96 JW: reverting pep8 changes 2024-03-22 21:33:38 +01:00
Jakub Werner (jakubikan)
ff2eaeb3b4 making ruff happy 2024-03-22 21:29:33 +01:00
Jakub Werner (jakubikan)
cbc98d384e Updating delisting function to return the time when it will delist if it is delisting 2024-03-22 21:17:17 +01:00
Jakub Werner (jakubikan)
4ef45314dd JW: adding first draft for deslist schedule 2024-03-22 20:18:52 +01:00
9 changed files with 89 additions and 14 deletions

View File

@ -16,7 +16,7 @@ repos:
additional_dependencies:
- types-cachetools==5.5.0.20240820
- types-filelock==3.2.7
- types-requests==2.32.0.20240907
- types-requests==2.32.0.20240914
- types-tabulate==0.9.0.20240106
- types-python-dateutil==2.9.0.20240906
- SQLAlchemy==2.0.34

View File

@ -6,6 +6,8 @@ from pathlib import Path
from typing import Dict, List, Optional, Tuple
import ccxt
from cachetools import TTLCache, cached
from threading import Lock
from freqtrade.enums import CandleType, MarginMode, PriceType, TradingMode
from freqtrade.exceptions import DDosProtection, OperationalException, TemporaryError
@ -53,6 +55,11 @@ class Binance(Exchange):
(TradingMode.FUTURES, MarginMode.ISOLATED)
]
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self._spot_delist_schedule_cache: TTLCache = TTLCache(maxsize=100, ttl=300)
self._spot_delist_schedule_cache_lock = Lock()
def get_tickers(self, symbols: Optional[List[str]] = None, cached: bool = False) -> Tickers:
tickers = super().get_tickers(symbols=symbols, cached=cached)
if self.trading_mode == TradingMode.FUTURES:
@ -214,3 +221,58 @@ class Binance(Exchange):
return self.get_leverage_tiers()
else:
return {}
@retrier
@cached(cache=TTLCache(maxsize=100, ttl=10), lock=Lock())
def get_deslist_schedule(self):
try:
delist_schedule = self._api.sapi_get_spot_delist_schedule()
return delist_schedule
except ccxt.DDoSProtection as e:
raise DDosProtection(e) from e
except (ccxt.NetworkError, ccxt.ExchangeError) as e:
raise TemporaryError(
f'Could not get delist schedule {e.__class__.__name__}. Message: {e}') from e
except ccxt.BaseError as e:
raise OperationalException(e) from e
def get_spot_pair_delist_time(self, pair, refresh: bool = True) -> int | None:
"""
Get the delisting time for a pair if it will be delisted
:param pair: Pair to get the delisting time for
:param refresh: true if you need fresh data
:return: int: delisting time None if not delisting
"""
if not pair:
return
cache = self._spot_delist_schedule_cache
lock = self._spot_delist_schedule_cache_lock
schedule_pair = pair.replace('/', '')
if not refresh:
with lock:
delist_time = cache[f"{schedule_pair}"]
if delist_time:
return delist_time
delist_schedule = self.get_deslist_schedule()
if delist_schedule is None:
return None
with lock:
for schedule in delist_schedule:
for symbol in schedule['symbols']:
cache[f"{symbol}"] = int(schedule['delistTime'])
with lock:
return cache.get(f"{schedule_pair}")

View File

@ -3594,7 +3594,7 @@ class Exchange:
Wherein, "+" or "-" depends on whether the contract goes long or short:
"-" for long, and "+" for short.
okex: https://www.okex.com/support/hc/en-us/articles/
okex: https://www.okx.com/support/hc/en-us/articles/
360053909592-VI-Introduction-to-the-isolated-mode-of-Single-Multi-currency-Portfolio-margin
:param pair: Pair to calculate liquidation price for

View File

@ -7,10 +7,10 @@
-r docs/requirements-docs.txt
coveralls==4.0.1
ruff==0.6.4
ruff==0.6.5
mypy==1.11.2
pre-commit==3.8.0
pytest==8.3.2
pytest==8.3.3
pytest-asyncio==0.24.0
pytest-cov==5.0.0
pytest-mock==3.14.0
@ -27,6 +27,6 @@ nbconvert==7.16.4
# mypy types
types-cachetools==5.5.0.20240820
types-filelock==3.2.7
types-requests==2.32.0.20240907
types-requests==2.32.0.20240914
types-tabulate==0.9.0.20240106
types-python-dateutil==2.9.0.20240906

View File

@ -3,7 +3,7 @@
-r requirements-plot.txt
# Required for freqai
scikit-learn==1.5.1
scikit-learn==1.5.2
joblib==1.4.2
catboost==1.2.7; 'arm' not in platform_machine
# Pin Matplotlib - it's depended on by catboost

View File

@ -4,6 +4,6 @@
# Required for hyperopt
scipy==1.14.1; python_version >= "3.10"
scipy==1.13.1; python_version < "3.10"
scikit-learn==1.5.1
scikit-learn==1.5.2
ft-scikit-optimize==0.9.2
filelock==3.16.0

View File

@ -1,4 +1,4 @@
# Include all requirements to run the bot.
-r requirements.txt
plotly==5.24.0
plotly==5.24.1

View File

@ -4,7 +4,7 @@ bottleneck==1.4.0
numexpr==2.10.1
pandas-ta==0.3.14b
ccxt==4.3.98
ccxt==4.4.3
cryptography==42.0.8; platform_machine == 'armv7l'
cryptography==43.0.1; platform_machine != 'armv7l'
aiohttp==3.10.5
@ -15,7 +15,7 @@ httpx>=0.24.1
humanize==4.10.0
cachetools==5.5.0
requests==2.32.3
urllib3==2.2.2
urllib3==2.2.3
jsonschema==4.23.0
TA-Lib==0.4.32
technical==1.4.4
@ -26,7 +26,7 @@ jinja2==3.1.4
tables==3.9.1; python_version < "3.10"
tables==3.10.1; python_version >= "3.10"
joblib==1.4.2
rich==13.8.0
rich==13.8.1
pyarrow==17.0.0; platform_machine != 'armv7l'
# find first, C search in arrays
@ -41,8 +41,8 @@ orjson==3.10.7
sdnotify==0.3.2
# API Server
fastapi==0.114.0
pydantic==2.9.0
fastapi==0.114.2
pydantic==2.9.1
uvicorn==0.30.6
pyjwt==2.9.0
aiofiles==24.1.0
@ -53,7 +53,7 @@ questionary==2.0.1
prompt-toolkit==3.0.36
# Extensions to datetime library
python-dateutil==2.9.0.post0
pytz==2024.1
pytz==2024.2
#Futures
schedule==1.2.2

View File

@ -723,3 +723,16 @@ def test_get_maintenance_ratio_and_amt_binance(
exchange._leverage_tiers = leverage_tiers
(result_ratio, result_amt) = exchange.get_maintenance_ratio_and_amt(pair, notional_value)
assert (round(result_ratio, 8), round(result_amt, 8)) == (mm_ratio, amt)
def test_get_spot_delist_schedule(mocker, default_conf) -> None:
exchange = get_patched_exchange(mocker, default_conf, id='binance')
return_value = [{
'delistTime': '1712113200000',
'symbols': ['DREPBTC', 'DREPUSDT', 'MOBBTC', 'MOBUSDT', 'PNTUSDT']
}]
exchange._api.sapi_get_spot_delist_schedule = MagicMock(return_value=return_value)
assert exchange.get_spot_pair_delist_time('DREP/USDT') == 1712113200000
assert exchange.get_spot_pair_delist_time('BTC/USDT') is None