Use ccxt order format

This commit is contained in:
enenn
2018-03-13 22:29:22 +01:00
parent a6ce6ef2c4
commit 421cd76272
7 changed files with 48 additions and 31 deletions

View File

@@ -137,13 +137,14 @@ def health():
def limit_buy_order():
return {
'id': 'mocked_limit_buy',
'type': 'LIMIT_BUY',
'type': 'limit',
'side': 'buy',
'pair': 'mocked',
'opened': str(arrow.utcnow().datetime),
'datetime': arrow.utcnow().isoformat(),
'rate': 0.00001099,
'amount': 90.99181073,
'remaining': 0.0,
'closed': str(arrow.utcnow().datetime),
'status': 'closed'
}
@@ -151,12 +152,14 @@ def limit_buy_order():
def limit_buy_order_old():
return {
'id': 'mocked_limit_buy_old',
'type': 'LIMIT_BUY',
'type': 'limit',
'side': 'buy',
'pair': 'ETH/BTC',
'opened': str(arrow.utcnow().shift(minutes=-601).datetime),
'datetime': arrow.utcnow().shift(minutes=-601).isoformat(),
'rate': 0.00001099,
'amount': 90.99181073,
'remaining': 90.99181073,
'status': 'open'
}
@@ -164,12 +167,14 @@ def limit_buy_order_old():
def limit_sell_order_old():
return {
'id': 'mocked_limit_sell_old',
'type': 'LIMIT_SELL',
'type': 'limit',
'side': 'sell',
'pair': 'ETH/BTC',
'opened': str(arrow.utcnow().shift(minutes=-601).datetime),
'datetime': arrow.utcnow().shift(minutes=-601).isoformat(),
'rate': 0.00001099,
'amount': 90.99181073,
'remaining': 90.99181073,
'status': 'open'
}
@@ -177,12 +182,14 @@ def limit_sell_order_old():
def limit_buy_order_old_partial():
return {
'id': 'mocked_limit_buy_old_partial',
'type': 'LIMIT_BUY',
'type': 'limit',
'side': 'buy',
'pair': 'ETH/BTC',
'opened': str(arrow.utcnow().shift(minutes=-601).datetime),
'datetime': arrow.utcnow().shift(minutes=-601).isoformat(),
'rate': 0.00001099,
'amount': 90.99181073,
'remaining': 67.99181073,
'status': 'open'
}
@@ -190,13 +197,14 @@ def limit_buy_order_old_partial():
def limit_sell_order():
return {
'id': 'mocked_limit_sell',
'type': 'LIMIT_SELL',
'type': 'limit',
'side': 'sell',
'pair': 'mocked',
'opened': str(arrow.utcnow().datetime),
'datetime': arrow.utcnow().isoformat(),
'rate': 0.00001173,
'amount': 90.99181073,
'remaining': 0.0,
'closed': str(arrow.utcnow().datetime),
'status': 'closed'
}

View File

@@ -294,8 +294,9 @@ def test_exec_forcesell_open_orders(default_conf, ticker, mocker):
mocker.patch.multiple('freqtrade.main.exchange',
get_ticker=ticker,
get_order=MagicMock(return_value={
'closed': None,
'type': 'LIMIT_BUY',
'type': 'limit',
'side': 'buy',
'status': 'open'
}),
cancel_order=cancel_order_mock)
trade = Trade(

View File

@@ -189,7 +189,7 @@ def test_update_open_order(limit_buy_order):
assert trade.close_profit is None
assert trade.close_date is None
limit_buy_order['closed'] = False
limit_buy_order['status'] = 'open'
trade.update(limit_buy_order)
assert trade.open_order_id is None