fix persistance test
This commit is contained in:
parent
8dfa1df2ce
commit
2b5d61c9e4
@ -2,7 +2,6 @@
|
||||
import os
|
||||
import pytest
|
||||
from sqlalchemy import create_engine
|
||||
from freqtrade.exchange import Exchanges
|
||||
from freqtrade.persistence import Trade, init, clean_dry_run_db
|
||||
|
||||
|
||||
@ -117,10 +116,10 @@ def test_update_with_bittrex(limit_buy_order, limit_sell_order):
|
||||
"""
|
||||
|
||||
trade = Trade(
|
||||
pair='BTC_ETH',
|
||||
pair='ETH/BTC',
|
||||
stake_amount=0.001,
|
||||
fee=0.0025,
|
||||
exchange=Exchanges.BITTREX,
|
||||
exchange="BITTREX",
|
||||
)
|
||||
assert trade.open_order_id is None
|
||||
assert trade.open_rate is None
|
||||
@ -144,10 +143,10 @@ def test_update_with_bittrex(limit_buy_order, limit_sell_order):
|
||||
|
||||
def test_calc_open_close_trade_price(limit_buy_order, limit_sell_order):
|
||||
trade = Trade(
|
||||
pair='BTC_ETH',
|
||||
pair='ETH/BTC',
|
||||
stake_amount=0.001,
|
||||
fee=0.0025,
|
||||
exchange=Exchanges.BITTREX,
|
||||
exchange="BITTREX",
|
||||
)
|
||||
|
||||
trade.open_order_id = 'something'
|
||||
@ -166,10 +165,10 @@ def test_calc_open_close_trade_price(limit_buy_order, limit_sell_order):
|
||||
|
||||
def test_calc_close_trade_price_exception(limit_buy_order):
|
||||
trade = Trade(
|
||||
pair='BTC_ETH',
|
||||
pair='ETH/BTC',
|
||||
stake_amount=0.001,
|
||||
fee=0.0025,
|
||||
exchange=Exchanges.BITTREX,
|
||||
exchange="BITTREX",
|
||||
)
|
||||
|
||||
trade.open_order_id = 'something'
|
||||
@ -179,10 +178,10 @@ def test_calc_close_trade_price_exception(limit_buy_order):
|
||||
|
||||
def test_update_open_order(limit_buy_order):
|
||||
trade = Trade(
|
||||
pair='BTC_ETH',
|
||||
pair='ETH/BTC',
|
||||
stake_amount=1.00,
|
||||
fee=0.1,
|
||||
exchange=Exchanges.BITTREX,
|
||||
exchange="BITTREX",
|
||||
)
|
||||
|
||||
assert trade.open_order_id is None
|
||||
@ -201,10 +200,10 @@ def test_update_open_order(limit_buy_order):
|
||||
|
||||
def test_update_invalid_order(limit_buy_order):
|
||||
trade = Trade(
|
||||
pair='BTC_ETH',
|
||||
pair='ETH/BTC',
|
||||
stake_amount=1.00,
|
||||
fee=0.1,
|
||||
exchange=Exchanges.BITTREX,
|
||||
exchange="BITTREX"
|
||||
)
|
||||
limit_buy_order['type'] = 'invalid'
|
||||
with pytest.raises(ValueError, match=r'Unknown order type'):
|
||||
@ -213,10 +212,10 @@ def test_update_invalid_order(limit_buy_order):
|
||||
|
||||
def test_calc_open_trade_price(limit_buy_order):
|
||||
trade = Trade(
|
||||
pair='BTC_ETH',
|
||||
pair='ETH/BTC',
|
||||
stake_amount=0.001,
|
||||
fee=0.0025,
|
||||
exchange=Exchanges.BITTREX,
|
||||
exchange="BITTREX",
|
||||
)
|
||||
trade.open_order_id = 'open_trade'
|
||||
trade.update(limit_buy_order) # Buy @ 0.00001099
|
||||
@ -230,10 +229,10 @@ def test_calc_open_trade_price(limit_buy_order):
|
||||
|
||||
def test_calc_close_trade_price(limit_buy_order, limit_sell_order):
|
||||
trade = Trade(
|
||||
pair='BTC_ETH',
|
||||
pair='ETH/BTC',
|
||||
stake_amount=0.001,
|
||||
fee=0.0025,
|
||||
exchange=Exchanges.BITTREX,
|
||||
exchange="BITTREX",
|
||||
)
|
||||
trade.open_order_id = 'close_trade'
|
||||
trade.update(limit_buy_order) # Buy @ 0.00001099
|
||||
@ -251,10 +250,10 @@ def test_calc_close_trade_price(limit_buy_order, limit_sell_order):
|
||||
|
||||
def test_calc_profit(limit_buy_order, limit_sell_order):
|
||||
trade = Trade(
|
||||
pair='BTC_ETH',
|
||||
pair='ETH/BTC',
|
||||
stake_amount=0.001,
|
||||
fee=0.0025,
|
||||
exchange=Exchanges.BITTREX,
|
||||
exchange="BITTREX",
|
||||
)
|
||||
trade.open_order_id = 'profit_percent'
|
||||
trade.update(limit_buy_order) # Buy @ 0.00001099
|
||||
@ -285,10 +284,10 @@ def test_calc_profit(limit_buy_order, limit_sell_order):
|
||||
|
||||
def test_calc_profit_percent(limit_buy_order, limit_sell_order):
|
||||
trade = Trade(
|
||||
pair='BTC_ETH',
|
||||
pair='ETH/BTC',
|
||||
stake_amount=0.001,
|
||||
fee=0.0025,
|
||||
exchange=Exchanges.BITTREX,
|
||||
exchange="BITTREX",
|
||||
)
|
||||
trade.open_order_id = 'profit_percent'
|
||||
trade.update(limit_buy_order) # Buy @ 0.00001099
|
||||
|
Loading…
Reference in New Issue
Block a user