autopep8
This commit is contained in:
@@ -6,7 +6,7 @@ from shutil import copyfile
|
||||
from freqtrade import exchange, optimize
|
||||
from freqtrade.exchange import Bittrex
|
||||
from freqtrade.optimize.__init__ import make_testdata_path, download_pairs,\
|
||||
download_backtesting_testdata, load_tickerdata_file
|
||||
download_backtesting_testdata, load_tickerdata_file
|
||||
|
||||
# Change this if modifying BTC_UNITEST testdatafile
|
||||
_btc_unittest_length = 13681
|
||||
|
@@ -25,51 +25,51 @@ def whitelist_conf():
|
||||
|
||||
def get_market_summaries():
|
||||
return [{
|
||||
"MarketName": "BTC-TKN",
|
||||
"High": 0.00000919,
|
||||
"Low": 0.00000820,
|
||||
"Volume": 74339.61396015,
|
||||
"Last": 0.00000820,
|
||||
"BaseVolume": 1664,
|
||||
"TimeStamp": "2014-07-09T07:19:30.15",
|
||||
"Bid": 0.00000820,
|
||||
"Ask": 0.00000831,
|
||||
"OpenBuyOrders": 15,
|
||||
"OpenSellOrders": 15,
|
||||
"PrevDay": 0.00000821,
|
||||
"Created": "2014-03-20T06:00:00",
|
||||
"DisplayMarketName": ""
|
||||
}, {
|
||||
"MarketName": "BTC-ETH",
|
||||
"High": 0.00000072,
|
||||
"Low": 0.00000001,
|
||||
"Volume": 166340678.42280999,
|
||||
"Last": 0.00000005,
|
||||
"BaseVolume": 42,
|
||||
"TimeStamp": "2014-07-09T07:21:40.51",
|
||||
"Bid": 0.00000004,
|
||||
"Ask": 0.00000005,
|
||||
"OpenBuyOrders": 18,
|
||||
"OpenSellOrders": 18,
|
||||
"PrevDay": 0.00000002,
|
||||
"Created": "2014-05-30T07:57:49.637",
|
||||
"DisplayMarketName": ""
|
||||
}, {
|
||||
"MarketName": "BTC-BLK",
|
||||
"High": 0.00000072,
|
||||
"Low": 0.00000001,
|
||||
"Volume": 166340678.42280999,
|
||||
"Last": 0.00000005,
|
||||
"BaseVolume": 3,
|
||||
"TimeStamp": "2014-07-09T07:21:40.51",
|
||||
"Bid": 0.00000004,
|
||||
"Ask": 0.00000005,
|
||||
"OpenBuyOrders": 18,
|
||||
"OpenSellOrders": 18,
|
||||
"PrevDay": 0.00000002,
|
||||
"Created": "2014-05-30T07:57:49.637",
|
||||
"DisplayMarketName": ""
|
||||
}
|
||||
"MarketName": "BTC-TKN",
|
||||
"High": 0.00000919,
|
||||
"Low": 0.00000820,
|
||||
"Volume": 74339.61396015,
|
||||
"Last": 0.00000820,
|
||||
"BaseVolume": 1664,
|
||||
"TimeStamp": "2014-07-09T07:19:30.15",
|
||||
"Bid": 0.00000820,
|
||||
"Ask": 0.00000831,
|
||||
"OpenBuyOrders": 15,
|
||||
"OpenSellOrders": 15,
|
||||
"PrevDay": 0.00000821,
|
||||
"Created": "2014-03-20T06:00:00",
|
||||
"DisplayMarketName": ""
|
||||
}, {
|
||||
"MarketName": "BTC-ETH",
|
||||
"High": 0.00000072,
|
||||
"Low": 0.00000001,
|
||||
"Volume": 166340678.42280999,
|
||||
"Last": 0.00000005,
|
||||
"BaseVolume": 42,
|
||||
"TimeStamp": "2014-07-09T07:21:40.51",
|
||||
"Bid": 0.00000004,
|
||||
"Ask": 0.00000005,
|
||||
"OpenBuyOrders": 18,
|
||||
"OpenSellOrders": 18,
|
||||
"PrevDay": 0.00000002,
|
||||
"Created": "2014-05-30T07:57:49.637",
|
||||
"DisplayMarketName": ""
|
||||
}, {
|
||||
"MarketName": "BTC-BLK",
|
||||
"High": 0.00000072,
|
||||
"Low": 0.00000001,
|
||||
"Volume": 166340678.42280999,
|
||||
"Last": 0.00000005,
|
||||
"BaseVolume": 3,
|
||||
"TimeStamp": "2014-07-09T07:21:40.51",
|
||||
"Bid": 0.00000004,
|
||||
"Ask": 0.00000005,
|
||||
"OpenBuyOrders": 18,
|
||||
"OpenSellOrders": 18,
|
||||
"PrevDay": 0.00000002,
|
||||
"Created": "2014-05-30T07:57:49.637",
|
||||
"DisplayMarketName": ""
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
|
@@ -624,54 +624,54 @@ def test_sell_profit_only_disable_profit(default_conf, limit_buy_order, mocker):
|
||||
|
||||
|
||||
def test_sell_profit_only_enable_loss(default_conf, limit_buy_order, mocker):
|
||||
default_conf['experimental'] = {
|
||||
'use_sell_signal': True,
|
||||
'sell_profit_only': True,
|
||||
}
|
||||
default_conf['experimental'] = {
|
||||
'use_sell_signal': True,
|
||||
'sell_profit_only': True,
|
||||
}
|
||||
|
||||
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
||||
mocker.patch('freqtrade.main.min_roi_reached', return_value=False)
|
||||
mocker.patch('freqtrade.main.get_signal', side_effect=lambda s, t: True)
|
||||
mocker.patch.multiple('freqtrade.rpc', init=MagicMock(), send_msg=MagicMock())
|
||||
mocker.patch.multiple('freqtrade.main.exchange',
|
||||
validate_pairs=MagicMock(),
|
||||
get_ticker=MagicMock(return_value={
|
||||
'bid': 0.00000172,
|
||||
'ask': 0.00000173,
|
||||
'last': 0.00000172
|
||||
}),
|
||||
buy=MagicMock(return_value='mocked_limit_buy'))
|
||||
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
||||
mocker.patch('freqtrade.main.min_roi_reached', return_value=False)
|
||||
mocker.patch('freqtrade.main.get_signal', side_effect=lambda s, t: True)
|
||||
mocker.patch.multiple('freqtrade.rpc', init=MagicMock(), send_msg=MagicMock())
|
||||
mocker.patch.multiple('freqtrade.main.exchange',
|
||||
validate_pairs=MagicMock(),
|
||||
get_ticker=MagicMock(return_value={
|
||||
'bid': 0.00000172,
|
||||
'ask': 0.00000173,
|
||||
'last': 0.00000172
|
||||
}),
|
||||
buy=MagicMock(return_value='mocked_limit_buy'))
|
||||
|
||||
init(default_conf, create_engine('sqlite://'))
|
||||
create_trade(0.001)
|
||||
init(default_conf, create_engine('sqlite://'))
|
||||
create_trade(0.001)
|
||||
|
||||
trade = Trade.query.first()
|
||||
trade.update(limit_buy_order)
|
||||
assert handle_trade(trade) is False
|
||||
trade = Trade.query.first()
|
||||
trade.update(limit_buy_order)
|
||||
assert handle_trade(trade) is False
|
||||
|
||||
|
||||
def test_sell_profit_only_disable_loss(default_conf, limit_buy_order, mocker):
|
||||
default_conf['experimental'] = {
|
||||
'use_sell_signal': True,
|
||||
'sell_profit_only': False,
|
||||
}
|
||||
default_conf['experimental'] = {
|
||||
'use_sell_signal': True,
|
||||
'sell_profit_only': False,
|
||||
}
|
||||
|
||||
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
||||
mocker.patch('freqtrade.main.min_roi_reached', return_value=False)
|
||||
mocker.patch('freqtrade.main.get_signal', side_effect=lambda s, t: True)
|
||||
mocker.patch.multiple('freqtrade.rpc', init=MagicMock(), send_msg=MagicMock())
|
||||
mocker.patch.multiple('freqtrade.main.exchange',
|
||||
validate_pairs=MagicMock(),
|
||||
get_ticker=MagicMock(return_value={
|
||||
'bid': 0.00000172,
|
||||
'ask': 0.00000173,
|
||||
'last': 0.00000172
|
||||
}),
|
||||
buy=MagicMock(return_value='mocked_limit_buy'))
|
||||
mocker.patch.dict('freqtrade.main._CONF', default_conf)
|
||||
mocker.patch('freqtrade.main.min_roi_reached', return_value=False)
|
||||
mocker.patch('freqtrade.main.get_signal', side_effect=lambda s, t: True)
|
||||
mocker.patch.multiple('freqtrade.rpc', init=MagicMock(), send_msg=MagicMock())
|
||||
mocker.patch.multiple('freqtrade.main.exchange',
|
||||
validate_pairs=MagicMock(),
|
||||
get_ticker=MagicMock(return_value={
|
||||
'bid': 0.00000172,
|
||||
'ask': 0.00000173,
|
||||
'last': 0.00000172
|
||||
}),
|
||||
buy=MagicMock(return_value='mocked_limit_buy'))
|
||||
|
||||
init(default_conf, create_engine('sqlite://'))
|
||||
create_trade(0.001)
|
||||
init(default_conf, create_engine('sqlite://'))
|
||||
create_trade(0.001)
|
||||
|
||||
trade = Trade.query.first()
|
||||
trade.update(limit_buy_order)
|
||||
assert handle_trade(trade) is True
|
||||
trade = Trade.query.first()
|
||||
trade.update(limit_buy_order)
|
||||
assert handle_trade(trade) is True
|
||||
|
@@ -8,7 +8,7 @@ import pytest
|
||||
from jsonschema import ValidationError
|
||||
|
||||
from freqtrade.misc import throttle, parse_args, load_config,\
|
||||
parse_args_common
|
||||
parse_args_common
|
||||
|
||||
|
||||
def test_throttle():
|
||||
|
Reference in New Issue
Block a user