feature: add buy tag to forcebuy

This commit is contained in:
lukasgor
2022-02-11 13:10:44 +01:00
parent 6a59103869
commit d563bfc3d0
3 changed files with 6 additions and 3 deletions

View File

@@ -280,6 +280,7 @@ class ForceBuyPayload(BaseModel):
price: Optional[float]
ordertype: Optional[OrderTypeValues]
stakeamount: Optional[float]
buy_tag: Optional[str]
class ForceSellPayload(BaseModel):

View File

@@ -136,8 +136,9 @@ 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
buy_tag = payload.buy_tag if payload.buy_tag else None
trade = rpc._rpc_forcebuy(payload.pair, payload.price, ordertype, stake_amount)
trade = rpc._rpc_forcebuy(payload.pair, payload.price, ordertype, stake_amount, buy_tag)
if trade:
return ForceBuyResponse.parse_obj(trade.to_json())