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

Closes #296 #301

Merged
merged 2 commits into from
May 25, 2016
Merged

Closes #296 #301

merged 2 commits into from
May 25, 2016

Conversation

analicia
Copy link
Contributor

No description provided.

@jbredeche
Copy link
Member

Thanks for the PR! It looks like the build is failing due to flake8 issues, can you run flake8 locally and sort those out?

@twiecki
Copy link
Contributor

twiecki commented May 21, 2016

@justinlent Can you review this?

@justinlent
Copy link
Contributor

@twiecki LGTM. Merge at your convenience

@justinlent justinlent assigned twiecki and unassigned justinlent May 21, 2016
@@ -57,13 +57,14 @@ def get_long_short_pos(positions):

pos_wo_cash = positions.drop('cash', axis=1)
longs = pos_wo_cash[pos_wo_cash > 0].sum(axis=1).fillna(0)
shorts = pos_wo_cash[pos_wo_cash < 0].abs().sum(axis=1).fillna(0)
shorts = pos_wo_cash[pos_wo_cash < 0].sum(axis=1).fillna(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't removing abs() not change the results of the plot?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it will. One of the issue tasks is to make the "shorts" line show up
as negative instead of positive.

"Make Long exposure line positive number, and Short exposure line all
negative numbers"

On Mon, May 23, 2016 at 3:34 AM, Thomas Wiecki [email protected]
wrote:

In pyfolio/pos.py
#301 (comment):

@@ -57,13 +57,14 @@ def get_long_short_pos(positions):

 pos_wo_cash = positions.drop('cash', axis=1)
 longs = pos_wo_cash[pos_wo_cash > 0].sum(axis=1).fillna(0)
  • shorts = pos_wo_cash[pos_wo_cash < 0].abs().sum(axis=1).fillna(0)
  • shorts = pos_wo_cash[pos_wo_cash < 0].sum(axis=1).fillna(0)

Won't removing abs() not change the results of the plot?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/quantopian/pyfolio/pull/301/files/12907415ecd871a19bd60e39c35613cc13692168#r64178908

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

@twiecki @ahgnaw see line 62 below where cash is added in the net_liquidation value. I believe this results in the cash taken in from shorts being double counted. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

if shorts is a negative number, net liquidation should be longs + shorts + cash

Copy link
Contributor

@justinlent justinlent Jun 28, 2016

Choose a reason for hiding this comment

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

from our offline chat:

The explicit calculation would be net_liquidation = longs - shorts + (cash + shorts)

which removes the short exposure from the cash component
which then begs the simplification to just net_liquidation = longs + cash
where net_liquidation == portfolio_value (e.g. the amount of $ you could actually withdraw from the account)

will have to think about whether that makes sense though

@twiecki twiecki merged commit bb721df into quantopian:master May 25, 2016
@twiecki
Copy link
Contributor

twiecki commented May 25, 2016

Thanks @ahgnaw!

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.

5 participants