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

ENH: Add the possibility to let unclose trades at end of bt.run (#273) (#343) #359

Closed
wants to merge 0 commits into from

Conversation

Benouare
Copy link
Contributor

@Benouare Benouare commented May 23, 2021

Hi,
Just saw that this could be interessting for (#343).
Hope it will help.

Cheers.

Continued in #393

@mdavidg
Copy link

mdavidg commented Jun 19, 2021

Hi,
Just saw that this could be interessting for (#343).
Hope it will help.

Cheers.

@zlpatel Please accept this change as soon as posible!

Copy link
Contributor

@zlpatel zlpatel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Copy link
Owner

@kernc kernc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tremendous apologies for the late review. I'll try to catch up. 😅

Would you also add a changelog entry?

@@ -984,7 +984,8 @@ def __init__(self,
margin: float = 1.,
trade_on_close=False,
hedging=False,
exclusive_orders=False
exclusive_orders=False,
close_all_at_end=True
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type and amount of feedback following #168 makes me think we should flip the default back to False.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a descriptive docstring below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -1078,7 +1079,7 @@ def __init__(self,
warnings.warn('Data index is not datetime. Assuming simple periods, '
'but `pd.DateTimeIndex` is advised.',
stacklevel=2)

self._close_all_at_end = close_all_at_end
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cast to bool() so passing =1 is supported.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

if not self.position:
self.buy()

self.assertGreater(len(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be assertEqual too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Benouare
Copy link
Contributor Author

Tremendous apologies for the late review. I'll try to catch up. 😅

Would you also add a changelog entry?

Done.

@Benouare
Copy link
Contributor Author

Move to #393

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

Successfully merging this pull request may close these issues.

4 participants