hummingbot / hummingbot

Open source software that helps you create and deploy high-frequency crypto trading bots
https://hummingbot.org
Apache License 2.0
7.91k stars 2.75k forks source link

Perp MM - Long and short profit taking spreads and log message are reversed #3149

Closed dennisocana closed 3 years ago

dennisocana commented 3 years ago

Describe the bug

When my buy order is filled, it opens a LONG position. Then it crates a profit taking sell order with short_profit_taking_spread value.

To reproduce this behavior, use this config to intentionally get your buy order filled and open a long position.

derivative : binance_perpetual_testnet
market : BTC-USDT
position_mode : One-way
bid_spread : 0.01
ask_spread : 1
order_refresh_time : 10
position_management : Profit_taking
long_profit_taking_spread : 1
short_profit_taking_spread : 5
close_position_order_type : LIMIT

As you can see below, I have a long position opened.

image

In Hummingbot, I'm expecting to close the position at 1% but the profit taking sell order was at 5% which is my short_profit_taking_spread value. In the logs it should also state "Creating profit taking sell order to lock profit on short long position".

Screen Shot 2021-04-03 at 2 26 15 PM

Same issue happens in reverse when a SHORT position is opened, the profit taking buy order uses the long_profit_taking_spread value.

derivative : binance_perpetual_testnet
market : BTC-USDT
position_mode : One-way
bid_spread : 1
ask_spread : 0.01
order_refresh_time : 10
position_management : Profit_taking
long_profit_taking_spread : 5
short_profit_taking_spread : 1
close_position_order_type : LIMIT

The bot opened a short position because my sell order was filled.

image

I'm expecting to close the position at 1% but the profit taking buy order was at 5% which is my long_profit_taking_spread value. In the logs it should also state "Creating profit taking sell order to lock profit on long short position".

Screen Shot 2021-04-03 at 2 33 10 PM

Release version

Version: 0.37.1 Operating system: Ubuntu 18.04 LTS Environment: AWS t2.medium Installation type: Docker

Attachments

perp_mm_bug_report.txt logs_perp_mm_bug_report.log

dennisocana commented 3 years ago

Fixed in version 0.38