Merge remote-tracking branch 'origin/master' into stock

This commit is contained in:
Markus
2020-12-07 19:58:52 +01:00
3 changed files with 5 additions and 4 deletions

View File

@@ -94,8 +94,9 @@ def portfolio_vs_asset_returns():
price_dict[key]['prices'][price_dict[key]['indexes'][str(int(t.opened_at))]]
)
plt.plot(buy_x, buy_y, '.', color='green')
plt.plot(sell_x, sell_y, '.', color='red')
plt.plot(buy_x, np.array(buy_y)*0.99, '^', color='blue', markersize=7)
plt.plot(sell_x, np.array(sell_y)*1.01, 'v', color='red', markersize=7)
plt.xlabel('date')
plt.ylabel('price change %')

View File

@@ -50,7 +50,7 @@ def test_open_pl_and_total_open_trades():
backtest_mode.run('2019-04-01', '2019-04-02', get_btc_candles())
assert len(store.completed_trades.trades) == 0
assert len(store.completed_trades.trades) == 1
assert store.app.total_open_trades == 1
assert store.app.total_open_pl == 97 # 99 - 2

View File

@@ -105,7 +105,7 @@ def test_can_close_a_long_position_and_go_short_at_the_same_candle():
single_route_backtest('Test45')
trades = store.completed_trades.trades
assert len(trades) == 1
assert len(trades) == 2
assert store.app.total_open_trades == 1
# more assertions in the Test45 file