price_last_balance renaming

This commit is contained in:
Matthias
2022-03-28 19:48:45 +02:00
parent d7c6520268
commit 2d740230f7
16 changed files with 50 additions and 33 deletions

View File

@@ -297,9 +297,18 @@ def _validate_pricing_rules(conf: Dict[str, Any]) -> None:
)
conf['entry_pricing'] = {}
for obj in list(conf.get('bid_strategy', {}).keys()):
process_deprecated_setting(conf, 'bid_strategy', obj, 'entry_pricing', obj)
if obj == 'ask_last_balance':
process_deprecated_setting(conf, 'bid_strategy', obj,
'entry_pricing', 'price_last_balance')
else:
process_deprecated_setting(conf, 'bid_strategy', obj, 'entry_pricing', obj)
del conf['bid_strategy']
conf['exit_pricing'] = {}
for obj in list(conf.get('ask_strategy', {}).keys()):
process_deprecated_setting(conf, 'ask_strategy', obj, 'exit_pricing', obj)
if obj == 'bid_last_balance':
process_deprecated_setting(conf, 'ask_strategy', obj,
'exit_pricing', 'price_last_balance')
else:
process_deprecated_setting(conf, 'ask_strategy', obj, 'exit_pricing', obj)
del conf['ask_strategy']

View File

@@ -174,7 +174,7 @@ CONF_SCHEMA = {
'entry_pricing': {
'type': 'object',
'properties': {
'ask_last_balance': {
'price_last_balance': {
'type': 'number',
'minimum': 0,
'maximum': 1,
@@ -197,7 +197,7 @@ CONF_SCHEMA = {
'type': 'object',
'properties': {
'price_side': {'type': 'string', 'enum': PRICING_SIDES, 'default': 'same'},
'bid_last_balance': {
'price_last_balance': {
'type': 'number',
'minimum': 0,
'maximum': 1,

View File

@@ -1503,10 +1503,10 @@ class Exchange:
ticker_rate = ticker[price_side]
if ticker['last'] and ticker_rate:
if side == 'entry' and ticker_rate > ticker['last']:
balance = conf_strategy.get('ask_last_balance', 0.0)
balance = conf_strategy.get('price_last_balance', 0.0)
ticker_rate = ticker_rate + balance * (ticker['last'] - ticker_rate)
elif side == 'exit' and ticker_rate < ticker['last']:
balance = conf_strategy.get('bid_last_balance', 0.0)
balance = conf_strategy.get('price_last_balance', 0.0)
ticker_rate = ticker_rate - balance * (ticker_rate - ticker['last'])
rate = ticker_rate

View File

@@ -23,8 +23,8 @@
},
"entry_pricing": {
"price_side": "same",
"ask_last_balance": 0.0,
"use_order_book": true,
"price_last_balance": 0.0,
"order_book_top": 1,
"check_depth_of_market": {
"enabled": false,