Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong trade price if stop_price is set too low #1195

Open
sidgwick opened this issue Jan 7, 2025 · 0 comments
Open

wrong trade price if stop_price is set too low #1195

sidgwick opened this issue Jan 7, 2025 · 0 comments

Comments

@sidgwick
Copy link

sidgwick commented Jan 7, 2025

related issue #174

If you change the test line 484 below

def test_stop_limit_order_price_is_stop_price(self):
def coroutine(self):
self.buy(stop=112, limit=113, size=1)
self.sell(stop=107, limit=105, size=1)
yield
stats = self._Backtest(coroutine).run()
self.assertListEqual(stats._trades.filter(like='Price').stack().tolist(), [112, 107])

to

self.buy(stop=88, limit=113, size=1)

backtesting framework will make a new trade with price 88, but testing google price never reach that price.

image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant