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

Refactor roundtrip #293

Merged
merged 13 commits into from
Apr 19, 2016
Merged

Refactor roundtrip #293

merged 13 commits into from
Apr 19, 2016

Conversation

twiecki
Copy link
Contributor

@twiecki twiecki commented Apr 18, 2016

Complete rewrite of the round-trip analysis. Now does complete portfolio reconstruction based on transactions and matches orders even without crossing the zero-mark which should make it much more generally applicable. Also much better output.

@twiecki
Copy link
Contributor Author

twiecki commented Apr 18, 2016

CC @a-campbell

('Avg # round_trips per day', lambda x: float(len(x)) /
(x.max() - x.min()).days),
('Avg # round_trips per month', lambda x: float(len(x)) /
(((x.max() - x.min()).days) / 21)),
Copy link
Contributor

Choose a reason for hiding this comment

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

could use utils.APPROX_BDAYS_PER_MONTH

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1

abs_amount = int(abs(t.amount))
indiv_prices = [signed_price] * abs_amount
if (len(price_stack) == 0) or \
(copysign(1, price_stack[-1]) == copysign(1, t.amount)):
Copy link
Contributor

Choose a reason for hiding this comment

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

would np.sign(price_stack[-1]) == np.sign(t.amount) work here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what I had initially but there was a huge overhead with calling numpy on a scalar.

@twiecki twiecki merged commit 04de9c4 into master Apr 19, 2016
@twiecki twiecki deleted the refactor_roundtrip branch April 19, 2016 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants