adapt dry_run return values

This commit is contained in:
gcarq 2017-11-01 01:12:16 +01:00
parent 543857ddb2
commit 9cb249610a
2 changed files with 13 additions and 4 deletions

View File

@ -66,14 +66,14 @@ def validate_pairs(pairs: List[str]) -> None:
def buy(pair: str, rate: float, amount: float) -> str:
if _CONF['dry_run']:
return 'dry_run'
return 'dry_run_buy'
return _API.buy(pair, rate, amount)
def sell(pair: str, rate: float, amount: float) -> str:
if _CONF['dry_run']:
return 'dry_run'
return 'dry_run_sell'
return _API.sell(pair, rate, amount)
@ -106,7 +106,16 @@ def cancel_order(order_id: str) -> None:
def get_order(order_id: str) -> Dict:
if _CONF['dry_run']:
return {}
return {
'id': 'dry_run_sell',
'type': 'LIMIT_SELL',
'pair': 'mocked',
'opened': arrow.utcnow().datetime,
'rate': 0.07256060,
'amount': 206.43811673387373,
'remaining': 0.0,
'closed': arrow.utcnow().datetime,
}
return _API.get_order(order_id)

View File

@ -78,7 +78,7 @@ class Trade(Base):
:param order: order retrieved by exchange.get_order()
:return: None
"""
if not order.get('closed'):
if not order['closed']:
return
logger.debug('Updating trade (id=%d) ...', self.id)