Merge branch 'develop' into bybit

This commit is contained in:
Matthias 2023-01-30 07:23:41 +01:00
commit f57394c1ce
5 changed files with 82 additions and 14 deletions

View File

@ -80,7 +80,7 @@ class AwesomeStrategy(IStrategy):
## Enter Tag ## Enter Tag
When your strategy has multiple buy signals, you can name the signal that triggered. When your strategy has multiple buy signals, you can name the signal that triggered.
Then you can access you buy signal on `custom_exit` Then you can access your buy signal on `custom_exit`
```python ```python
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:

View File

@ -1,5 +1,5 @@
""" Freqtrade bot """ """ Freqtrade bot """
__version__ = '2023.1.dev' __version__ = '2023.2.dev'
if 'dev' in __version__: if 'dev' in __version__:
from pathlib import Path from pathlib import Path

View File

@ -775,6 +775,11 @@ class Backtesting:
trade: Optional[LocalTrade] = None, trade: Optional[LocalTrade] = None,
requested_rate: Optional[float] = None, requested_rate: Optional[float] = None,
requested_stake: Optional[float] = None) -> Optional[LocalTrade]: requested_stake: Optional[float] = None) -> Optional[LocalTrade]:
"""
:param trade: Trade to adjust - initial entry if None
:param requested_rate: Adjusted entry rate
:param requested_stake: Stake amount for adjusted orders (`adjust_entry_price`).
"""
current_time = row[DATE_IDX].to_pydatetime() current_time = row[DATE_IDX].to_pydatetime()
entry_tag = row[ENTER_TAG_IDX] if len(row) >= ENTER_TAG_IDX + 1 else None entry_tag = row[ENTER_TAG_IDX] if len(row) >= ENTER_TAG_IDX + 1 else None
@ -800,7 +805,7 @@ class Backtesting:
return trade return trade
time_in_force = self.strategy.order_time_in_force['entry'] time_in_force = self.strategy.order_time_in_force['entry']
if stake_amount and (not min_stake_amount or stake_amount > min_stake_amount): if stake_amount and (not min_stake_amount or stake_amount >= min_stake_amount):
self.order_id_counter += 1 self.order_id_counter += 1
base_currency = self.exchange.get_pair_base_currency(pair) base_currency = self.exchange.get_pair_base_currency(pair)
amount_p = (stake_amount / propose_rate) * leverage amount_p = (stake_amount / propose_rate) * leverage

View File

@ -2,7 +2,7 @@ numpy==1.24.1
pandas==1.5.3 pandas==1.5.3
pandas-ta==0.3.14b pandas-ta==0.3.14b
ccxt==2.7.7 ccxt==2.7.12
# Pin cryptography for now due to rust build errors with piwheels # Pin cryptography for now due to rust build errors with piwheels
cryptography==38.0.1; platform_machine == 'armv7l' cryptography==38.0.1; platform_machine == 'armv7l'
cryptography==39.0.0; platform_machine != 'armv7l' cryptography==39.0.0; platform_machine != 'armv7l'

View File

@ -43,7 +43,7 @@ EXCHANGES = {
'hasQuoteVolumeFutures': True, 'hasQuoteVolumeFutures': True,
'leverage_tiers_public': False, 'leverage_tiers_public': False,
'leverage_in_spot_market': False, 'leverage_in_spot_market': False,
'sample_order': { 'sample_order': [{
"symbol": "SOLUSDT", "symbol": "SOLUSDT",
"orderId": 3551312894, "orderId": 3551312894,
"orderListId": -1, "orderListId": -1,
@ -60,7 +60,32 @@ EXCHANGES = {
"workingTime": 1674493798550, "workingTime": 1674493798550,
"fills": [], "fills": [],
"selfTradePreventionMode": "NONE", "selfTradePreventionMode": "NONE",
} }]
},
'binanceus': {
'pair': 'BTC/USDT',
'stake_currency': 'USDT',
'hasQuoteVolume': True,
'timeframe': '5m',
'futures': False,
'sample_order': [{
"symbol": "SOLUSDT",
"orderId": 3551312894,
"orderListId": -1,
"clientOrderId": "x-R4DD3S8297c73a11ccb9dc8f2811ba",
"transactTime": 1674493798550,
"price": "15.00000000",
"origQty": "1.00000000",
"executedQty": "0.00000000",
"cummulativeQuoteQty": "0.00000000",
"status": "NEW",
"timeInForce": "GTC",
"type": "LIMIT",
"side": "BUY",
"workingTime": 1674493798550,
"fills": [],
"selfTradePreventionMode": "NONE",
}]
}, },
'kraken': { 'kraken': {
'pair': 'BTC/USDT', 'pair': 'BTC/USDT',
@ -77,6 +102,40 @@ EXCHANGES = {
'timeframe': '5m', 'timeframe': '5m',
'leverage_tiers_public': False, 'leverage_tiers_public': False,
'leverage_in_spot_market': True, 'leverage_in_spot_market': True,
'sample_order': [
{'id': '63d6742d0adc5570001d2bbf7'}, # create order
{
'id': '63d6742d0adc5570001d2bbf7',
'symbol': 'NAKA-USDT',
'opType': 'DEAL',
'type': 'limit',
'side': 'buy',
'price': '30',
'size': '0.1',
'funds': '0',
'dealFunds': '0.032626',
'dealSize': '0.1',
'fee': '0.000065252',
'feeCurrency': 'USDT',
'stp': '',
'stop': '',
'stopTriggered': False,
'stopPrice': '0',
'timeInForce': 'GTC',
'postOnly': False,
'hidden': False,
'iceberg': False,
'visibleSize': '0',
'cancelAfter': 0,
'channel': 'API',
'clientOid': '0a053870-11bf-41e5-be61-b272a4cb62e1',
'remark': None,
'tags': 'partner:ccxt',
'isActive': False,
'cancelExist': False,
'createdAt': 1674493798550,
'tradeType': 'TRADE'
}],
}, },
'gateio': { 'gateio': {
'pair': 'BTC/USDT', 'pair': 'BTC/USDT',
@ -242,10 +301,14 @@ class TestCCXTExchange():
def test_ccxt_order_parse(self, exchange: EXCHANGE_FIXTURE_TYPE): def test_ccxt_order_parse(self, exchange: EXCHANGE_FIXTURE_TYPE):
exch, exchange_name = exchange exch, exchange_name = exchange
if stuff := EXCHANGES[exchange_name].get('sample_order'): if orders := EXCHANGES[exchange_name].get('sample_order'):
for order in orders:
po = exch._api.parse_order(stuff) po = exch._api.parse_order(order)
assert isinstance(po['id'], str)
assert po['id'] is not None
if len(order.keys()) > 1:
assert po['timestamp'] == 1674493798550 assert po['timestamp'] == 1674493798550
assert isinstance(po['datetime'], str)
assert isinstance(po['timestamp'], int) assert isinstance(po['timestamp'], int)
assert isinstance(po['price'], float) assert isinstance(po['price'], float)
assert isinstance(po['amount'], float) assert isinstance(po['amount'], float)