Merge branch 'feat/short' into pr/samgermain/5780
This commit is contained in:
@@ -3,7 +3,7 @@ import json
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
|
||||
import arrow
|
||||
import ccxt
|
||||
@@ -119,10 +119,6 @@ class Binance(Exchange):
|
||||
except ccxt.BaseError as e:
|
||||
raise OperationalException(e) from e
|
||||
|
||||
def market_is_future(self, market: Dict[str, Any]) -> bool:
|
||||
# TODO-lev: This should be unified in ccxt to "swap"...
|
||||
return market.get('future', False) is True
|
||||
|
||||
@retrier
|
||||
def fill_leverage_brackets(self):
|
||||
"""
|
||||
|
@@ -338,7 +338,7 @@ class Exchange:
|
||||
return self.markets.get(pair, {}).get('base', '')
|
||||
|
||||
def market_is_future(self, market: Dict[str, Any]) -> bool:
|
||||
return market.get('swap', False) is True
|
||||
return market.get(self._ft_has["ccxt_futures_name"], False) is True
|
||||
|
||||
def market_is_spot(self, market: Dict[str, Any]) -> bool:
|
||||
return market.get('spot', False) is True
|
||||
|
@@ -20,7 +20,8 @@ class Ftx(Exchange):
|
||||
_ft_has: Dict = {
|
||||
"stoploss_on_exchange": True,
|
||||
"ohlcv_candle_limit": 1500,
|
||||
"mark_ohlcv_price": "index"
|
||||
"mark_ohlcv_price": "index",
|
||||
"ccxt_futures_name": "future"
|
||||
}
|
||||
|
||||
_supported_trading_mode_collateral_pairs: List[Tuple[TradingMode, Collateral]] = [
|
||||
@@ -159,7 +160,3 @@ class Ftx(Exchange):
|
||||
if order['type'] == 'stop':
|
||||
return safe_value_fallback2(order, order, 'id_stop', 'id')
|
||||
return order['id']
|
||||
|
||||
def market_is_future(self, market: Dict[str, Any]) -> bool:
|
||||
# TODO-lev: This should be unified in ccxt to "swap"...
|
||||
return market.get('future', False) is True
|
||||
|
@@ -70,7 +70,7 @@ class Backtesting:
|
||||
self.all_results: Dict[str, Dict] = {}
|
||||
self._exchange_name = self.config['exchange']['name']
|
||||
self.exchange = ExchangeResolver.load_exchange(self._exchange_name, self.config)
|
||||
self.dataprovider = DataProvider(self.config, None)
|
||||
self.dataprovider = DataProvider(self.config, self.exchange)
|
||||
|
||||
if self.config.get('strategy_list', None):
|
||||
for strat in list(self.config['strategy_list']):
|
||||
|
@@ -144,6 +144,7 @@ class OrderTypes(BaseModel):
|
||||
|
||||
class ShowConfig(BaseModel):
|
||||
version: str
|
||||
api_version: float
|
||||
dry_run: bool
|
||||
trading_mode: str
|
||||
short_allowed: bool
|
||||
|
@@ -26,6 +26,11 @@ from freqtrade.rpc.rpc import RPCException
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# API version
|
||||
# Pre-1.1, no version was provided
|
||||
# Version increments should happen in "small" steps (1.1, 1.12, ...) unless big changes happen.
|
||||
API_VERSION = 1.1
|
||||
|
||||
# Public API, requires no auth.
|
||||
router_public = APIRouter()
|
||||
# Private API, protected by authentication
|
||||
@@ -117,7 +122,9 @@ def show_config(rpc: Optional[RPC] = Depends(get_rpc_optional), config=Depends(g
|
||||
state = ''
|
||||
if rpc:
|
||||
state = rpc._freqtrade.state
|
||||
return RPC._rpc_show_config(config, state)
|
||||
resp = RPC._rpc_show_config(config, state)
|
||||
resp['api_version'] = API_VERSION
|
||||
return resp
|
||||
|
||||
|
||||
@router.post('/forcebuy', response_model=ForceBuyResponse, tags=['trading'])
|
||||
|
@@ -274,11 +274,11 @@ class Telegram(RPCHandler):
|
||||
f"*Buy Tag:* `{msg['buy_tag']}`\n"
|
||||
f"*Sell Reason:* `{msg['sell_reason']}`\n"
|
||||
f"*Duration:* `{msg['duration']} ({msg['duration_min']:.1f} min)`\n"
|
||||
f"*Amount:* `{msg['amount']:.8f}`\n")
|
||||
f"*Amount:* `{msg['amount']:.8f}`\n"
|
||||
f"*Open Rate:* `{msg['open_rate']:.8f}`\n")
|
||||
|
||||
if msg['type'] == RPCMessageType.SELL:
|
||||
message += (f"*Open Rate:* `{msg['open_rate']:.8f}`\n"
|
||||
f"*Current Rate:* `{msg['current_rate']:.8f}`\n"
|
||||
message += (f"*Current Rate:* `{msg['current_rate']:.8f}`\n"
|
||||
f"*Close Rate:* `{msg['limit']:.8f}`")
|
||||
|
||||
elif msg['type'] == RPCMessageType.SELL_FILL:
|
||||
|
@@ -81,12 +81,11 @@ def _create_and_merge_informative_pair(strategy, dataframe: DataFrame, metadata:
|
||||
# Not specifying an asset will define informative dataframe for current pair.
|
||||
asset = metadata['pair']
|
||||
|
||||
if '/' in asset:
|
||||
base, quote = asset.split('/')
|
||||
else:
|
||||
# When futures are supported this may need reevaluation.
|
||||
# base, quote = asset, ''
|
||||
raise OperationalException('Not implemented.')
|
||||
market = strategy.dp.market(asset)
|
||||
if market is None:
|
||||
raise OperationalException(f'Market {asset} is not available.')
|
||||
base = market['base']
|
||||
quote = market['quote']
|
||||
|
||||
# Default format. This optimizes for the common case: informative pairs using same stake
|
||||
# currency. When quote currency matches stake currency, column name will omit base currency.
|
||||
|
Reference in New Issue
Block a user