BUG: for issue #183, added more logic to catch order amount adjustments

This commit is contained in:
Frederic Fortier
2018-02-03 18:24:28 -05:00
parent a360a5fe3a
commit 9f88e7a003
2 changed files with 12 additions and 4 deletions
+2 -2
View File
@@ -37,8 +37,8 @@ def initialize(context):
context.base_price = None
context.current_day = None
context.RSI_OVERSOLD = 55
context.RSI_OVERBOUGHT = 60
context.RSI_OVERSOLD = 40
context.RSI_OVERBOUGHT = 50
context.CANDLE_SIZE = '15T'
context.start_time = time.time()
+10 -2
View File
@@ -798,13 +798,21 @@ class CCXT(Exchange):
)
raise ExchangeRequestError(error=e)
exchange_amount = None
if 'amount' in result and result['amount'] != adj_amount:
exchange_amount = result['amount']
elif 'info' in result:
if 'origQty' in result['info']:
exchange_amount = float(result['info']['origQty'])
if exchange_amount:
log.info(
'order amount adjusted by {} from {} to {}'.format(
self.name, adj_amount, result['amount']
self.name, adj_amount, exchange_amount
)
)
adj_amount = result['amount']
adj_amount = exchange_amount
if 'info' not in result:
raise ValueError('cannot use order without info attribute')