Use Close value for trade signal calculation
This commit is contained in:
parent
33f00d23b9
commit
5b9cbaf277
@ -909,15 +909,15 @@ class RPC:
|
|||||||
if has_content:
|
if has_content:
|
||||||
|
|
||||||
dataframe.loc[:, '__date_ts'] = dataframe.loc[:, 'date'].view(int64) // 1000 // 1000
|
dataframe.loc[:, '__date_ts'] = dataframe.loc[:, 'date'].view(int64) // 1000 // 1000
|
||||||
# Move open to separate column when signal for easy plotting
|
# Move signal close to separate column when signal for easy plotting
|
||||||
if 'buy' in dataframe.columns:
|
if 'buy' in dataframe.columns:
|
||||||
buy_mask = (dataframe['buy'] == 1)
|
buy_mask = (dataframe['buy'] == 1)
|
||||||
buy_signals = int(buy_mask.sum())
|
buy_signals = int(buy_mask.sum())
|
||||||
dataframe.loc[buy_mask, '_buy_signal_open'] = dataframe.loc[buy_mask, 'open']
|
dataframe.loc[buy_mask, '_buy_signal_close'] = dataframe.loc[buy_mask, 'close']
|
||||||
if 'sell' in dataframe.columns:
|
if 'sell' in dataframe.columns:
|
||||||
sell_mask = (dataframe['sell'] == 1)
|
sell_mask = (dataframe['sell'] == 1)
|
||||||
sell_signals = int(sell_mask.sum())
|
sell_signals = int(sell_mask.sum())
|
||||||
dataframe.loc[sell_mask, '_sell_signal_open'] = dataframe.loc[sell_mask, 'open']
|
dataframe.loc[sell_mask, '_sell_signal_close'] = dataframe.loc[sell_mask, 'close']
|
||||||
dataframe = dataframe.replace([inf, -inf], NAN)
|
dataframe = dataframe.replace([inf, -inf], NAN)
|
||||||
dataframe = dataframe.replace({NAN: None})
|
dataframe = dataframe.replace({NAN: None})
|
||||||
|
|
||||||
|
@ -1129,7 +1129,7 @@ def test_api_pair_candles(botclient, ohlcv_history):
|
|||||||
assert isinstance(rc.json()['columns'], list)
|
assert isinstance(rc.json()['columns'], list)
|
||||||
assert rc.json()['columns'] == ['date', 'open', 'high',
|
assert rc.json()['columns'] == ['date', 'open', 'high',
|
||||||
'low', 'close', 'volume', 'sma', 'buy', 'sell',
|
'low', 'close', 'volume', 'sma', 'buy', 'sell',
|
||||||
'__date_ts', '_buy_signal_open', '_sell_signal_open']
|
'__date_ts', '_buy_signal_close', '_sell_signal_close']
|
||||||
assert 'pair' in rc.json()
|
assert 'pair' in rc.json()
|
||||||
assert rc.json()['pair'] == 'XRP/BTC'
|
assert rc.json()['pair'] == 'XRP/BTC'
|
||||||
|
|
||||||
@ -1140,7 +1140,7 @@ def test_api_pair_candles(botclient, ohlcv_history):
|
|||||||
[['2017-11-26 08:50:00', 8.794e-05, 8.948e-05, 8.794e-05, 8.88e-05, 0.0877869,
|
[['2017-11-26 08:50:00', 8.794e-05, 8.948e-05, 8.794e-05, 8.88e-05, 0.0877869,
|
||||||
None, 0, 0, 1511686200000, None, None],
|
None, 0, 0, 1511686200000, None, None],
|
||||||
['2017-11-26 08:55:00', 8.88e-05, 8.942e-05, 8.88e-05,
|
['2017-11-26 08:55:00', 8.88e-05, 8.942e-05, 8.88e-05,
|
||||||
8.893e-05, 0.05874751, 8.886500000000001e-05, 1, 0, 1511686500000, 8.88e-05, None],
|
8.893e-05, 0.05874751, 8.886500000000001e-05, 1, 0, 1511686500000, 8.893e-05, None],
|
||||||
['2017-11-26 09:00:00', 8.891e-05, 8.893e-05, 8.875e-05, 8.877e-05,
|
['2017-11-26 09:00:00', 8.891e-05, 8.893e-05, 8.875e-05, 8.877e-05,
|
||||||
0.7039405, 8.885e-05, 0, 0, 1511686800000, None, None]
|
0.7039405, 8.885e-05, 0, 0, 1511686800000, None, None]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user