Automatically assign buy-tag to force-buys

closes #6544
This commit is contained in:
Matthias 2022-03-20 09:30:11 +01:00
parent aceaa3faec
commit 8556e6a053
4 changed files with 4 additions and 2 deletions

View File

@ -277,6 +277,7 @@ Starting capital is either taken from the `available_capital` setting, or calcul
> **BITTREX:** Buying ETH/BTC with limit `0.03400000` (`1.000000 ETH`, `225.290 USD`)
Omitting the pair will open a query asking for the pair to buy (based on the current whitelist).
Trades crated through `/forcebuy` will have the buy-tag of `forceentry`.
![Telegram force-buy screenshot](assets/telegram_forcebuy.png)

View File

@ -137,7 +137,7 @@ def show_config(rpc: Optional[RPC] = Depends(get_rpc_optional), config=Depends(g
def forcebuy(payload: ForceBuyPayload, rpc: RPC = Depends(get_rpc)):
ordertype = payload.ordertype.value if payload.ordertype else None
stake_amount = payload.stakeamount if payload.stakeamount else None
entry_tag = payload.entry_tag if payload.entry_tag else None
entry_tag = payload.entry_tag if payload.entry_tag else 'forceentry'
trade = rpc._rpc_forcebuy(payload.pair, payload.price, ordertype, stake_amount, entry_tag)

View File

@ -713,7 +713,7 @@ class RPC:
def _rpc_forcebuy(self, pair: str, price: Optional[float], order_type: Optional[str] = None,
stake_amount: Optional[float] = None,
buy_tag: Optional[str] = None) -> Optional[Trade]:
buy_tag: Optional[str] = 'forceentry') -> Optional[Trade]:
"""
Handler for forcebuy <asset> <price>
Buys a pair trade at the given or current price

View File

@ -1147,6 +1147,7 @@ def test_rpcforcebuy(mocker, default_conf, ticker, fee, limit_buy_order_open) ->
pair = 'LTC/BTC'
trade = rpc._rpc_forcebuy(pair, 0.0001, order_type='limit', stake_amount=0.05)
assert trade.stake_amount == 0.05
assert trade.buy_tag == 'forceentry'
# Test not buying
pair = 'XRP/BTC'