Update pricing documentation
This commit is contained in:
parent
2d740230f7
commit
8ebef914e2
@ -106,16 +106,16 @@ Mandatory parameters are marked as **Required**, which means that they are requi
|
||||
| `unfilledtimeout.exit` | **Required.** How long (in minutes or seconds) the bot will wait for an unfilled exit order to complete, after which the order will be cancelled and repeated at current (new) price, as long as there is a signal. [Strategy Override](#parameters-in-the-strategy).<br> **Datatype:** Integer
|
||||
| `unfilledtimeout.unit` | Unit to use in unfilledtimeout setting. Note: If you set unfilledtimeout.unit to "seconds", "internals.process_throttle_secs" must be inferior or equal to timeout [Strategy Override](#parameters-in-the-strategy). <br> *Defaults to `minutes`.* <br> **Datatype:** String
|
||||
| `unfilledtimeout.exit_timeout_count` | How many times can exit orders time out. Once this number of timeouts is reached, an emergency sell is triggered. 0 to disable and allow unlimited order cancels. [Strategy Override](#parameters-in-the-strategy).<br>*Defaults to `0`.* <br> **Datatype:** Integer
|
||||
| `enter_pricing.price_side` | Select the side of the spread the bot should look at to get the entry rate. [More information below](#buy-price-side).<br> *Defaults to `same`.* <br> **Datatype:** String (either `ask`, `bid`, `same` or `other`).
|
||||
| `enter_pricing.price_last_balance` | **Required.** Interpolate the bidding price. More information [below](#buy-price-without-orderbook-enabled).
|
||||
| `enter_pricing.use_order_book` | Enable entering using the rates in [Order Book Bids](#buy-price-with-orderbook-enabled). <br> *Defaults to `True`.*<br> **Datatype:** Boolean
|
||||
| `enter_pricing.order_book_top` | Bot will use the top N rate in Order Book "price_side" to enter a trade. I.e. a value of 2 will allow the bot to pick the 2nd entry in [Order Book Bids](#buy-price-with-orderbook-enabled). <br>*Defaults to `1`.* <br> **Datatype:** Positive Integer
|
||||
| `enter_pricing. check_depth_of_market.enabled` | Do not enter if the difference of buy orders and sell orders is met in Order Book. [Check market depth](#check-depth-of-market). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
|
||||
| `enter_pricing. check_depth_of_market.bids_to_ask_delta` | The difference ratio of buy orders and sell orders found in Order Book. A value below 1 means sell order size is greater, while value greater than 1 means buy order size is higher. [Check market depth](#check-depth-of-market) <br> *Defaults to `0`.* <br> **Datatype:** Float (as ratio)
|
||||
| `exit_pricing.price_side` | Select the side of the spread the bot should look at to get the exit rate. [More information below](#sell-price-side).<br> *Defaults to `same`.* <br> **Datatype:** String (either `ask`, `bid`, `same` or `other`).
|
||||
| `exit_pricing.price_last_balance` | Interpolate the exiting price. More information [below](#sell-price-without-orderbook-enabled).
|
||||
| `exit_pricing.use_order_book` | Enable exiting of open trades using [Order Book Asks](#sell-price-with-orderbook-enabled). <br> *Defaults to `True`.*<br> **Datatype:** Boolean
|
||||
| `exit_pricing.order_book_top` | Bot will use the top N rate in Order Book "price_side" to sell. I.e. a value of 2 will allow the bot to pick the 2nd ask rate in [Order Book Asks](#sell-price-with-orderbook-enabled)<br>*Defaults to `1`.* <br> **Datatype:** Positive Integer
|
||||
| `entry_pricing.price_side` | Select the side of the spread the bot should look at to get the entry rate. [More information below](#buy-price-side).<br> *Defaults to `same`.* <br> **Datatype:** String (either `ask`, `bid`, `same` or `other`).
|
||||
| `entry_pricing.price_last_balance` | **Required.** Interpolate the bidding price. More information [below](#entry-price-without-orderbook-enabled).
|
||||
| `entry_pricing.use_order_book` | Enable entering using the rates in [Order Book Entry](#entry-price-with-orderbook-enabled). <br> *Defaults to `True`.*<br> **Datatype:** Boolean
|
||||
| `entry_pricing.order_book_top` | Bot will use the top N rate in Order Book "price_side" to enter a trade. I.e. a value of 2 will allow the bot to pick the 2nd entry in [Order Book Entry](#entry-price-with-orderbook-enabled). <br>*Defaults to `1`.* <br> **Datatype:** Positive Integer
|
||||
| `entry_pricing. check_depth_of_market.enabled` | Do not enter if the difference of buy orders and sell orders is met in Order Book. [Check market depth](#check-depth-of-market). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
|
||||
| `entry_pricing. check_depth_of_market.bids_to_ask_delta` | The difference ratio of buy orders and sell orders found in Order Book. A value below 1 means sell order size is greater, while value greater than 1 means buy order size is higher. [Check market depth](#check-depth-of-market) <br> *Defaults to `0`.* <br> **Datatype:** Float (as ratio)
|
||||
| `exit_pricing.price_side` | Select the side of the spread the bot should look at to get the exit rate. [More information below](#exit-price-side).<br> *Defaults to `same`.* <br> **Datatype:** String (either `ask`, `bid`, `same` or `other`).
|
||||
| `exit_pricing.price_last_balance` | Interpolate the exiting price. More information [below](#exit-price-without-orderbook-enabled).
|
||||
| `exit_pricing.use_order_book` | Enable exiting of open trades using [Order Book Exit](#exit-price-with-orderbook-enabled). <br> *Defaults to `True`.*<br> **Datatype:** Boolean
|
||||
| `exit_pricing.order_book_top` | Bot will use the top N rate in Order Book "price_side" to sell. I.e. a value of 2 will allow the bot to pick the 2nd ask rate in [Order Book Exit](#exit-price-with-orderbook-enabled)<br>*Defaults to `1`.* <br> **Datatype:** Positive Integer
|
||||
| `use_sell_signal` | Use sell signals produced by the strategy in addition to the `minimal_roi`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `true`.* <br> **Datatype:** Boolean
|
||||
| `sell_profit_only` | Wait until the bot reaches `sell_profit_offset` before taking a sell decision. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
|
||||
| `sell_profit_offset` | Sell-signal is only active above this value. Only active in combination with `sell_profit_only=True`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `0.0`.* <br> **Datatype:** Float (as ratio)
|
||||
|
@ -1,6 +1,6 @@
|
||||
## Prices used for orders
|
||||
|
||||
Prices for regular orders can be controlled via the parameter structures `bid_strategy` for buying and `ask_strategy` for selling.
|
||||
Prices for regular orders can be controlled via the parameter structures `entry_pricing` for trade entries and `exit_pricing` for trade exits.
|
||||
Prices are always retrieved right before an order is placed, either by querying the exchange tickers or by using the orderbook data.
|
||||
|
||||
!!! Note
|
||||
@ -9,20 +9,11 @@ Prices are always retrieved right before an order is placed, either by querying
|
||||
!!! Warning "Using market orders"
|
||||
Please read the section [Market order pricing](#market-order-pricing) section when using market orders.
|
||||
|
||||
### Buy price
|
||||
### Entry price
|
||||
|
||||
#### Check depth of market
|
||||
#### Enter price side
|
||||
|
||||
When check depth of market is enabled (`bid_strategy.check_depth_of_market.enabled=True`), the buy signals are filtered based on the orderbook depth (sum of all amounts) for each orderbook side.
|
||||
|
||||
Orderbook `bid` (buy) side depth is then divided by the orderbook `ask` (sell) side depth and the resulting delta is compared to the value of the `bid_strategy.check_depth_of_market.bids_to_ask_delta` parameter. The buy order is only executed if the orderbook delta is greater than or equal to the configured delta value.
|
||||
|
||||
!!! Note
|
||||
A delta value below 1 means that `ask` (sell) orderbook side depth is greater than the depth of the `bid` (buy) orderbook side, while a value greater than 1 means opposite (depth of the buy side is higher than the depth of the sell side).
|
||||
|
||||
#### Buy price side
|
||||
|
||||
The configuration setting `bid_strategy.price_side` defines the side of the spread the bot looks for when buying.
|
||||
The configuration setting `entry_pricing.price_side` defines the side of the orderbook the bot looks for when buying.
|
||||
|
||||
The following displays an orderbook.
|
||||
|
||||
@ -38,30 +29,53 @@ The following displays an orderbook.
|
||||
...
|
||||
```
|
||||
|
||||
If `bid_strategy.price_side` is set to `"bid"`, then the bot will use 99 as buying price.
|
||||
In line with that, if `bid_strategy.price_side` is set to `"ask"`, then the bot will use 101 as buying price.
|
||||
If `entry_pricing.price_side` is set to `"bid"`, then the bot will use 99 as entry price.
|
||||
In line with that, if `entry_pricing.price_side` is set to `"ask"`, then the bot will use 101 as entry price.
|
||||
|
||||
Using `ask` price often guarantees quicker filled orders, but the bot can also end up paying more than what would have been necessary.
|
||||
Depending on the order direction (_long_/_short_), this will lead to different results. Therefore we recommend to use `"same"` or `"other"` for this configuration instead.
|
||||
This would result in the following pricing matrix:
|
||||
|
||||
| direction | Order | setting | price | crosses spread |
|
||||
|------ |--------|-----|-----|-----|
|
||||
| long | buy | ask | 101 | yes |
|
||||
| long | buy | bid | 99 | no |
|
||||
| long | buy | same | 99 | no |
|
||||
| long | buy | other | 101 | yes |
|
||||
| short | sell | ask | 101 | no |
|
||||
| short | sell | bid | 99 | yes |
|
||||
| short | sell | same | 101 | no |
|
||||
| short | sell | other | 99 | yes |
|
||||
|
||||
Using the other side of the orderbook often guarantees quicker filled orders, but the bot can also end up paying more than what would have been necessary.
|
||||
Taker fees instead of maker fees will most likely apply even when using limit buy orders.
|
||||
Also, prices at the "ask" side of the spread are higher than prices at the "bid" side in the orderbook, so the order behaves similar to a market order (however with a maximum price).
|
||||
Also, prices at the "other" side of the spread are higher than prices at the "bid" side in the orderbook, so the order behaves similar to a market order (however with a maximum price).
|
||||
|
||||
#### Buy price with Orderbook enabled
|
||||
#### Entry price with Orderbook enabled
|
||||
|
||||
When buying with the orderbook enabled (`bid_strategy.use_order_book=True`), Freqtrade fetches the `bid_strategy.order_book_top` entries from the orderbook and uses the entry specified as `bid_strategy.order_book_top` on the configured side (`bid_strategy.price_side`) of the orderbook. 1 specifies the topmost entry in the orderbook, while 2 would use the 2nd entry in the orderbook, and so on.
|
||||
When entering a trade with the orderbook enabled (`entry_pricing.use_order_book=True`), Freqtrade fetches the `entry_pricing.order_book_top` entries from the orderbook and uses the entry specified as `entry_pricing.order_book_top` on the configured side (`entry_pricing.price_side`) of the orderbook. 1 specifies the topmost entry in the orderbook, while 2 would use the 2nd entry in the orderbook, and so on.
|
||||
|
||||
#### Buy price without Orderbook enabled
|
||||
#### Entry price without Orderbook enabled
|
||||
|
||||
The following section uses `side` as the configured `bid_strategy.price_side` (defaults to `"bid"`).
|
||||
The following section uses `side` as the configured `entry_pricing.price_side` (defaults to `"same"`).
|
||||
|
||||
When not using orderbook (`bid_strategy.use_order_book=False`), Freqtrade uses the best `side` price from the ticker if it's below the `last` traded price from the ticker. Otherwise (when the `side` price is above the `last` price), it calculates a rate between `side` and `last` price based on `bid_strategy.price_last_balance`..
|
||||
When not using orderbook (`entry_pricing.use_order_book=False`), Freqtrade uses the best `side` price from the ticker if it's below the `last` traded price from the ticker. Otherwise (when the `side` price is above the `last` price), it calculates a rate between `side` and `last` price based on `entry_pricing.price_last_balance`.
|
||||
|
||||
The `bid_strategy.price_last_balance` configuration parameter controls this. A value of `0.0` will use `side` price, while `1.0` will use the `last` price and values between those interpolate between ask and last price.
|
||||
The `entry_pricing.price_last_balance` configuration parameter controls this. A value of `0.0` will use `side` price, while `1.0` will use the `last` price and values between those interpolate between ask and last price.
|
||||
|
||||
### Sell price
|
||||
#### Check depth of market
|
||||
|
||||
#### Sell price side
|
||||
When check depth of market is enabled (`entry_pricing.check_depth_of_market.enabled=True`), the entry signals are filtered based on the orderbook depth (sum of all amounts) for each orderbook side.
|
||||
|
||||
The configuration setting `ask_strategy.price_side` defines the side of the spread the bot looks for when selling.
|
||||
Orderbook `bid` (buy) side depth is then divided by the orderbook `ask` (sell) side depth and the resulting delta is compared to the value of the `entry_pricing.check_depth_of_market.bids_to_ask_delta` parameter. The entry order is only executed if the orderbook delta is greater than or equal to the configured delta value.
|
||||
|
||||
!!! Note
|
||||
A delta value below 1 means that `ask` (sell) orderbook side depth is greater than the depth of the `bid` (buy) orderbook side, while a value greater than 1 means opposite (depth of the buy side is higher than the depth of the sell side).
|
||||
|
||||
### Exit price
|
||||
|
||||
#### Exit price side
|
||||
|
||||
The configuration setting `exit_pricing.price_side` defines the side of the spread the bot looks for when exiting a trade.
|
||||
|
||||
The following displays an orderbook:
|
||||
|
||||
@ -77,27 +91,41 @@ The following displays an orderbook:
|
||||
...
|
||||
```
|
||||
|
||||
If `ask_strategy.price_side` is set to `"ask"`, then the bot will use 101 as selling price.
|
||||
In line with that, if `ask_strategy.price_side` is set to `"bid"`, then the bot will use 99 as selling price.
|
||||
If `exit_pricing.price_side` is set to `"ask"`, then the bot will use 101 as exiting price.
|
||||
In line with that, if `exit_pricing.price_side` is set to `"bid"`, then the bot will use 99 as exiting price.
|
||||
|
||||
#### Sell price with Orderbook enabled
|
||||
Depending on the order direction (_long_/_short_), this will lead to different results. Therefore we recommend to use `"same"` or `"other"` for this configuration instead.
|
||||
This would result in the following pricing matrix:
|
||||
|
||||
When selling with the orderbook enabled (`ask_strategy.use_order_book=True`), Freqtrade fetches the `ask_strategy.order_book_top` entries in the orderbook and uses the entry specified as `ask_strategy.order_book_top` from the configured side (`ask_strategy.price_side`) as selling price.
|
||||
| Direction | Order | setting | price | crosses spread |
|
||||
|------ |--------|-----|-----|-----|
|
||||
| long | sell | ask | 101 | no |
|
||||
| long | sell | bid | 99 | yes |
|
||||
| long | sell | same | 101 | no |
|
||||
| long | sell | other | 99 | yes |
|
||||
| short | buy | ask | 101 | yes |
|
||||
| short | buy | bid | 99 | no |
|
||||
| short | buy | same | 99 | no |
|
||||
| short | buy | other | 101 | yes |
|
||||
|
||||
#### Exit price with Orderbook enabled
|
||||
|
||||
When exiting with the orderbook enabled (`exit_pricing.use_order_book=True`), Freqtrade fetches the `exit_pricing.order_book_top` entries in the orderbook and uses the entry specified as `exit_pricing.order_book_top` from the configured side (`exit_pricing.price_side`) as trade exit price.
|
||||
|
||||
1 specifies the topmost entry in the orderbook, while 2 would use the 2nd entry in the orderbook, and so on.
|
||||
|
||||
#### Sell price without Orderbook enabled
|
||||
#### Exit price without Orderbook enabled
|
||||
|
||||
The following section uses `side` as the configured `ask_strategy.price_side` (defaults to `"ask"`).
|
||||
The following section uses `side` as the configured `exit_pricing.price_side` (defaults to `"ask"`).
|
||||
|
||||
When not using orderbook (`ask_strategy.use_order_book=False`), Freqtrade uses the best `side` price from the ticker if it's above the `last` traded price from the ticker. Otherwise (when the `side` price is below the `last` price), it calculates a rate between `side` and `last` price based on `ask_strategy.price_last_balance`.
|
||||
When not using orderbook (`exit_pricing.use_order_book=False`), Freqtrade uses the best `side` price from the ticker if it's above the `last` traded price from the ticker. Otherwise (when the `side` price is below the `last` price), it calculates a rate between `side` and `last` price based on `exit_pricing.price_last_balance`.
|
||||
|
||||
The `ask_strategy.price_last_balance` configuration parameter controls this. A value of `0.0` will use `side` price, while `1.0` will use the last price and values between those interpolate between `side` and last price.
|
||||
The `exit_pricing.price_last_balance` configuration parameter controls this. A value of `0.0` will use `side` price, while `1.0` will use the last price and values between those interpolate between `side` and last price.
|
||||
|
||||
### Market order pricing
|
||||
|
||||
When using market orders, prices should be configured to use the "correct" side of the orderbook to allow realistic pricing detection.
|
||||
Assuming both buy and sell are using market orders, a configuration similar to the following might be used
|
||||
Assuming both entry and exits are using market orders, a configuration similar to the following must be used
|
||||
|
||||
``` jsonc
|
||||
"order_types": {
|
||||
@ -105,12 +133,12 @@ Assuming both buy and sell are using market orders, a configuration similar to t
|
||||
"exit": "market"
|
||||
// ...
|
||||
},
|
||||
"bid_strategy": {
|
||||
"price_side": "ask",
|
||||
"entry_pricing": {
|
||||
"price_side": "other",
|
||||
// ...
|
||||
},
|
||||
"ask_strategy":{
|
||||
"price_side": "bid",
|
||||
"exit_pricing":{
|
||||
"price_side": "other",
|
||||
// ...
|
||||
},
|
||||
```
|
||||
|
@ -2276,6 +2276,7 @@ def test_fetch_l2_order_book_exception(default_conf, mocker, exchange_name):
|
||||
|
||||
|
||||
@pytest.mark.parametrize("side,ask,bid,last,last_ab,expected", [
|
||||
('other', 20, 19, 10, 0.0, 20), # Full ask side
|
||||
('ask', 20, 19, 10, 0.0, 20), # Full ask side
|
||||
('ask', 20, 19, 10, 1.0, 10), # Full last side
|
||||
('ask', 20, 19, 10, 0.5, 15), # Between ask and last
|
||||
@ -2288,6 +2289,7 @@ def test_fetch_l2_order_book_exception(default_conf, mocker, exchange_name):
|
||||
('ask', 4, 5, None, 0.5, 4), # last not available - uses ask
|
||||
('ask', 4, 5, None, 1, 4), # last not available - uses ask
|
||||
('ask', 4, 5, None, 0, 4), # last not available - uses ask
|
||||
('same', 21, 20, 10, 0.0, 20), # Full bid side
|
||||
('bid', 21, 20, 10, 0.0, 20), # Full bid side
|
||||
('bid', 21, 20, 10, 1.0, 10), # Full last side
|
||||
('bid', 21, 20, 10, 0.5, 15), # Between bid and last
|
||||
|
Loading…
Reference in New Issue
Block a user