This commit is contained in:
Stefano Ariestasia 2022-03-30 08:35:49 +09:00
parent 05db0067ee
commit c615e4fcc2
5 changed files with 41 additions and 62 deletions

View File

@ -100,7 +100,6 @@ Mandatory parameters are marked as **Required**, which means that they are requi
| `trailing_only_offset_is_reached` | Only apply trailing stoploss when the offset is reached. [stoploss documentation](stoploss.md). [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean | `trailing_only_offset_is_reached` | Only apply trailing stoploss when the offset is reached. [stoploss documentation](stoploss.md). [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
| `fee` | Fee used during backtesting / dry-runs. Should normally not be configured, which has freqtrade fall back to the exchange default fee. Set as ratio (e.g. 0.001 = 0.1%). Fee is applied twice for each trade, once when buying, once when selling. <br> **Datatype:** Float (as ratio) | `fee` | Fee used during backtesting / dry-runs. Should normally not be configured, which has freqtrade fall back to the exchange default fee. Set as ratio (e.g. 0.001 = 0.1%). Fee is applied twice for each trade, once when buying, once when selling. <br> **Datatype:** Float (as ratio)
| `trading_mode` | Specifies if you want to trade regularly, trade with leverage, or trade contracts whose prices are derived from matching cryptocurrency prices. [leverage documentation](leverage.md). <br>*Defaults to `"spot"`.* <br> **Datatype:** String | `trading_mode` | Specifies if you want to trade regularly, trade with leverage, or trade contracts whose prices are derived from matching cryptocurrency prices. [leverage documentation](leverage.md). <br>*Defaults to `"spot"`.* <br> **Datatype:** String
| `can_short` | Specifies if the bot can do futures shorting trade. <br>[Strategy Override](#parameters-in-the-strategy) <br>*Defaults to `false`.* <br> **Datatype:** Boolean
| `margin_mode` | When trading with leverage, this determines if the collateral owned by the trader will be shared or isolated to each trading pair [leverage documentation](leverage.md). <br> **Datatype:** String | `margin_mode` | When trading with leverage, this determines if the collateral owned by the trader will be shared or isolated to each trading pair [leverage documentation](leverage.md). <br> **Datatype:** String
| `liquidation_buffer` | A ratio specifying how large of a safety net to place between the liquidation price and the stoploss to prevent a position from reaching the liquidation price [leverage documentation](leverage.md). <br>*Defaults to `0.05`.* <br> **Datatype:** Float | `liquidation_buffer` | A ratio specifying how large of a safety net to place between the liquidation price and the stoploss to prevent a position from reaching the liquidation price [leverage documentation](leverage.md). <br>*Defaults to `0.05`.* <br> **Datatype:** Float
| `unfilledtimeout.entry` | **Required.** How long (in minutes or seconds) the bot will wait for an unfilled entry 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.entry` | **Required.** How long (in minutes or seconds) the bot will wait for an unfilled entry 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

View File

@ -64,6 +64,26 @@ Binance supports [time_in_force](configuration.md#understand-order_time_in_force
For Binance, please add `"BNB/<STAKE>"` to your blacklist to avoid issues. For Binance, please add `"BNB/<STAKE>"` to your blacklist to avoid issues.
Accounts having BNB accounts use this to pay for fees - if your first trade happens to be on `BNB`, further trades will consume this position and make the initial BNB trade unsellable as the expected amount is not there anymore. Accounts having BNB accounts use this to pay for fees - if your first trade happens to be on `BNB`, further trades will consume this position and make the initial BNB trade unsellable as the expected amount is not there anymore.
### Binance Futures' order pricing
When trading on Binance Futures market. orderbook must be used because there is no price ticker data for futures.
``` jsonc
"bid_strategy": {
"ask_last_balance": 0.0,
"use_order_book": true,
"order_book_top": 1,
"check_depth_of_market": {
"enabled": false,
"bids_to_ask_delta": 1
}
},
"ask_strategy": {
"use_order_book": true,
"order_book_top": 1
},
```
### Binance sites ### Binance sites
Binance has been split into 2, and users must use the correct ccxt exchange ID for their exchange, otherwise API keys are not recognized. Binance has been split into 2, and users must use the correct ccxt exchange ID for their exchange, otherwise API keys are not recognized.

View File

@ -116,23 +116,3 @@ Assuming both buy and sell are using market orders, a configuration similar to t
``` ```
Obviously, if only one side is using limit orders, different pricing combinations can be used. Obviously, if only one side is using limit orders, different pricing combinations can be used.
### Futures market's order pricing
When trading on futures market. orderbook must be used because there is no ticker data for futures.
``` jsonc
"bid_strategy": {
"ask_last_balance": 0.0,
"use_order_book": true,
"order_book_top": 1,
"check_depth_of_market": {
"enabled": false,
"bids_to_ask_delta": 1
}
},
"ask_strategy": {
"use_order_book": true,
"order_book_top": 1
},
```

View File

@ -205,7 +205,7 @@ Edit the method `populate_entry_trend()` in your strategy file to update your en
It's important to always return the dataframe without removing/modifying the columns `"open", "high", "low", "close", "volume"`, otherwise these fields would contain something unexpected. It's important to always return the dataframe without removing/modifying the columns `"open", "high", "low", "close", "volume"`, otherwise these fields would contain something unexpected.
This method will also define a new column, `"enter_long"`, which needs to contain 1 for entries, and 0 for "no action". This method will also define a new column, `"enter_long"`, which needs to contain 1 for entries, and 0 for "no action". `enter_long` column is a mandatory column that must be set even if the strategy is shorting only.
Sample from `user_data/strategies/sample_strategy.py`: Sample from `user_data/strategies/sample_strategy.py`:
@ -235,47 +235,28 @@ def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFram
Short-trades need to be supported by your exchange and market configuration! Short-trades need to be supported by your exchange and market configuration!
Please make sure to set [`can_short`]() appropriately on your strategy if you intend to short. Please make sure to set [`can_short`]() appropriately on your strategy if you intend to short.
```python ```python
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[ dataframe.loc[
( (
(qtpylib.crossed_above(dataframe['rsi'], 30)) & # Signal: RSI crosses above 30 (qtpylib.crossed_above(dataframe['rsi'], 30)) & # Signal: RSI crosses above 30
(dataframe['tema'] <= dataframe['bb_middleband']) & # Guard (dataframe['tema'] <= dataframe['bb_middleband']) & # Guard
(dataframe['tema'] > dataframe['tema'].shift(1)) & # Guard (dataframe['tema'] > dataframe['tema'].shift(1)) & # Guard
(dataframe['volume'] > 0) # Make sure Volume is not 0 (dataframe['volume'] > 0) # Make sure Volume is not 0
), ),
['enter_long', 'enter_tag']] = (1, 'rsi_cross') ['enter_long', 'enter_tag']] = (1, 'rsi_cross')
dataframe.loc[ dataframe.loc[
( (
(qtpylib.crossed_below(dataframe['rsi'], 70)) & # Signal: RSI crosses below 70 (qtpylib.crossed_below(dataframe['rsi'], 70)) & # Signal: RSI crosses below 70
(dataframe['tema'] > dataframe['bb_middleband']) & # Guard (dataframe['tema'] > dataframe['bb_middleband']) & # Guard
(dataframe['tema'] < dataframe['tema'].shift(1)) & # Guard (dataframe['tema'] < dataframe['tema'].shift(1)) & # Guard
(dataframe['volume'] > 0) # Make sure Volume is not 0 (dataframe['volume'] > 0) # Make sure Volume is not 0
), ),
['enter_short', 'enter_tag']] = (1, 'rsi_cross') ['enter_short', 'enter_tag']] = (1, 'rsi_cross')
return dataframe return dataframe
``` ```
!!! Note
`enter_long` column must be set, even when your strategy is a shorting-only strategy. On other hand, enter_short is an optional column and don't need to be set if the strategy is a long-only strategy
```python
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[: ,'enter_long'] = 0
dataframe.loc[
(
(qtpylib.crossed_below(dataframe['rsi'], 70)) & # Signal: RSI crosses below 70
(dataframe['tema'] > dataframe['bb_middleband']) & # Guard
(dataframe['tema'] < dataframe['tema'].shift(1)) & # Guard
(dataframe['volume'] > 0) # Make sure Volume is not 0
),
['enter_short', 'enter_tag']] = (1, 'rsi_cross')
return dataframe
```
!!! Note !!! Note
Buying requires sellers to buy from - therefore volume needs to be > 0 (`dataframe['volume'] > 0`) to make sure that the bot does not buy/sell in no-activity periods. Buying requires sellers to buy from - therefore volume needs to be > 0 (`dataframe['volume'] > 0`) to make sure that the bot does not buy/sell in no-activity periods.

View File

@ -18,7 +18,6 @@ If you intend on using markets other than spot markets, please migrate your stra
* `sell` -> `exit_long` * `sell` -> `exit_long`
* `buy_tag` -> `enter_tag` (used for both long and short trades) * `buy_tag` -> `enter_tag` (used for both long and short trades)
* New column `enter_short` and corresponding new column `exit_short` * New column `enter_short` and corresponding new column `exit_short`
* `enter_long` MUST be set even if the strategy is a shorting strategy.
* trade-object now has the following new properties: `is_short`, `enter_side`, `exit_side` and `trade_direction`. * trade-object now has the following new properties: `is_short`, `enter_side`, `exit_side` and `trade_direction`.
* New `side` argument to callbacks without trade object * New `side` argument to callbacks without trade object
* `custom_stake_amount` * `custom_stake_amount`