Codaone / DEXBot

Trading Bot for the BitShares Decentralized Exchange
Other
250 stars 129 forks source link

Stop Loss #652

Open CryptoKong opened 5 years ago

CryptoKong commented 5 years ago

Stop loss/ trailing stop loss feature for traders, this function can't be on chain as people would easily be able to stop hunt so running DEXBot in order to implement these features off chain by creating market orders when certain conditions are met would be very helpful for traders and might encourage them to use the other DEXBot strategies.

PermieBTS commented 5 years ago

A Stop Loss feature could possibly stay true to the "make liquidity, not take it" principle by creating a limit order for the desired stop loss price when the centre price is ~2% above the desired stop price

Example: User input Stop Loss Price: $0.04/bts Execution condition for placing a market order at $0.04: when centre price = ($0.04*1.02) = $0.0408 At which point the bot places a limit order to sell at $0.04.

Does this open up the potential for Stop-Hunting? Hunters would be unaware of the stop loss until the price is 2% above the desired stop. Is this too dangerous?

By "this function can't be on-chain" do you mean that the Stop Loss order should be held in a virtual order only known to the particular DEXBot user?

froooze commented 5 years ago

I see two different cases for a stop loss:

  1. A stop loss in form, to not create a new buy/sell order and stay neutral
  2. A stop loss in form to increase/decrease a position of one asset
bitphage commented 5 years ago

Check the Rudex "trailing stop" strategy description here: https://steemit.com/blockchain/@blockchained/announcement-of-a-public-trading-bots-from-rudex-spreadtrade-and-trailingstop

Looks like it's placing a limit order when market price goes below stoploss + trailing_percent / 3

CryptoKong commented 5 years ago

A Stop Loss feature could possibly stay true to the "make liquidity, not take it" principle by creating a limit order for the desired stop loss price when the centre price is ~2% above the desired stop price

Example: User input Stop Loss Price: $0.04/bts Execution condition for placing a market order at $0.04: when centre price = ($0.04*1.02) = $0.0408 At which point the bot places a limit order to sell at $0.04.

Does this open up the potential for Stop-Hunting? Hunters would be unaware of the stop loss until the price is 2% above the desired stop. Is this too dangerous?

By "this function can't be on-chain" do you mean that the Stop Loss order should be held in a virtual order only known to the particular DEXBot user?

I dont think we need to stay true to make liquidity not take liquidity with a stop loss feature, user should be able to choose between setting a limit order with a trigger and market order with a trigger. Limit orders dont always fill if price moves too quick so users need the option of market stops.

It is the trigger mechanism that is best off chain and offered by software like dexbot so price cannot be manipulated into triggering stops causing a load of market buying/selling. If the trigger is off-chain then potential manipulators cant see those triggers. This is why stop loss is best provided by the likes of dexbot rather than being an onchain function.

thehapax commented 5 years ago

Already building framework in for stop loss option for CEX trade object.

bitphage commented 4 years ago

I developed a Trailing Strategy which implements these features.