Based on a discussion on Discord I would like to open the conversation in this forum.
If you want to send orders to the market you have to use the methods:
- buy/sell if you are using scripts
- buy_with_specific_market/sell_with_specific_market if you are using strategies
I found this not very practical because I have to code a logic in the strategy every time that I want to buy or sell.
This are the current parameters that you have to send in the script strategy base:
- connector_name: The name of the connector
- trading_pair: The market trading pair
- amount: An order amount in base token value
- order_type: The type of the order
- price: An order price
- position_action: A position action (for perpetual market only)
and this are the ones for the strategy base:
I think that we should create a method like place order, and one of the parameters has to be the side of the trade.
Also, we were discussing in the group the support of market orders via Hummingbot.
For this topic I would like to explain what a CoinAlpha engineer told me about this and then let you decide.
The problem of using market orders is that you don’t know how much you will move the price and if there is not liquidity in the market you will be loosing money.
One solution for this is send a limit order with a price that is crossing the mid price…
e.g.: - Mid price: 100 - Best ask: 101 - Best bid: 99 I want to buy at market but I don't want to pay more than 102.
The solution is send a limit order with price 102. The bot will buy market but if the price is higher than 102 it will stop.
Hope that the explanation is clear enough and let me know if you need more details!
My opinion is that we should allow market orders because they will be useful if we want to trigger a stop loss for example, but regarding on the explanation, do you think that a “safe_market_order” method with a percentage of slippage will be useful too?
Let me know what you think about this, and if you have another ideas!