for testing feature: percent from top of book or from ask/bid
This commit is contained in:
parent
e5ad5a6aaa
commit
735356197d
@ -17,7 +17,8 @@
|
|||||||
"bid_strategy": {
|
"bid_strategy": {
|
||||||
"ask_last_balance": 0.0,
|
"ask_last_balance": 0.0,
|
||||||
"use_book_order": true,
|
"use_book_order": true,
|
||||||
"book_order_top": 6
|
"book_order_top": 6,
|
||||||
|
"percent_from_top": 0.005
|
||||||
},
|
},
|
||||||
"ask_strategy":{
|
"ask_strategy":{
|
||||||
"use_book_order": true,
|
"use_book_order": true,
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
"bid_strategy": {
|
"bid_strategy": {
|
||||||
"ask_last_balance": 0.0,
|
"ask_last_balance": 0.0,
|
||||||
"use_book_order": true,
|
"use_book_order": true,
|
||||||
"book_order_top": 6
|
"book_order_top": 6,
|
||||||
|
"percent_from_top": 0.005
|
||||||
},
|
},
|
||||||
"ask_strategy":{
|
"ask_strategy":{
|
||||||
"use_book_order": true,
|
"use_book_order": true,
|
||||||
|
@ -73,7 +73,8 @@ CONF_SCHEMA = {
|
|||||||
'exclusiveMaximum': False
|
'exclusiveMaximum': False
|
||||||
},
|
},
|
||||||
'use_book_order': {'type': 'boolean'},
|
'use_book_order': {'type': 'boolean'},
|
||||||
'book_order_top': {'type': 'number', 'maximum': 20, 'minimum': 1}
|
'book_order_top': {'type': 'number', 'maximum': 20, 'minimum': 1},
|
||||||
|
'percent_from_top' : {'type': 'number', 'minimum': 0}
|
||||||
},
|
},
|
||||||
'required': ['ask_last_balance','use_book_order']
|
'required': ['ask_last_balance','use_book_order']
|
||||||
},
|
},
|
||||||
|
@ -253,6 +253,8 @@ class FreqtradeBot(object):
|
|||||||
else:
|
else:
|
||||||
balance = self.config['bid_strategy']['ask_last_balance']
|
balance = self.config['bid_strategy']['ask_last_balance']
|
||||||
ticker_rate = ticker['ask'] + balance * (ticker['last'] - ticker['ask'])
|
ticker_rate = ticker['ask'] + balance * (ticker['last'] - ticker['ask'])
|
||||||
|
|
||||||
|
used_rate = ticker_rate
|
||||||
|
|
||||||
if self.config['bid_strategy']['use_book_order']:
|
if self.config['bid_strategy']['use_book_order']:
|
||||||
logger.info('Getting price from Order Book')
|
logger.info('Getting price from Order Book')
|
||||||
@ -263,11 +265,18 @@ class FreqtradeBot(object):
|
|||||||
logger.info('...book order bid rate %0.8f',orderBook_rate)
|
logger.info('...book order bid rate %0.8f',orderBook_rate)
|
||||||
if ticker_rate < orderBook_rate:
|
if ticker_rate < orderBook_rate:
|
||||||
logger.info('...using ticker rate instead %0.8f',ticker_rate )
|
logger.info('...using ticker rate instead %0.8f',ticker_rate )
|
||||||
return ticker_rate
|
used_rate = ticker_rate
|
||||||
return orderBook_rate
|
used_rate = orderBook_rate
|
||||||
else:
|
else:
|
||||||
logger.info('Using Last Ask / Last Price')
|
logger.info('Using Last Ask / Last Price')
|
||||||
return ticker_rate
|
used_rate = ticker_rate
|
||||||
|
|
||||||
|
logger.info('used rate %0.8f',used_rate)
|
||||||
|
|
||||||
|
if self.config['bid_strategy']['percent_from_top'] > 0:
|
||||||
|
used_rate = self.analyze.trunc_num(used_rate - (used_rate * self.config['bid_strategy']['percent_from_top']),8)
|
||||||
|
logger.info('used rate xx %0.8f',used_rate)
|
||||||
|
return used_rate
|
||||||
|
|
||||||
def create_trade(self) -> bool:
|
def create_trade(self) -> bool:
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user