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

Total asset from three-headed output #11

Open
hanseul-jeong opened this issue Feb 13, 2021 · 5 comments
Open

Total asset from three-headed output #11

hanseul-jeong opened this issue Feb 13, 2021 · 5 comments

Comments

@hanseul-jeong
Copy link

Hi, I have a question about total wealth.
In your work, the output is summation of three heads initial, short, and reinvest vector, respectively.

The total sum of three heads is 1+(-1) + 1 = 1.
But this value is not considered of total asset volume.
The absolute asset is 3. So, i think it’s like managing three times asset.

(Of course, if the two output values are not zero for both positive and negative heads, respectively, then each absolute value will be offset because the final portfolio value is generated in addition.
However, if you finally put short position, you will always use more than 1.)

For example, for 3 stocks, the final portfolio value is like this at time t,
A_t = [0.8, -0.3, 0.5].
Abs(A_t) = 0.8 + -(-0.3) + 0.5 = 1.6.
So, final portfolio vector have to be scaled by 1.6.
Proper portfolio vector is
A_t’ = [0.8/1.6, -0.3/1.6, 0.5/1.6].

If I misunderstood something, please let me know.
Thank you!

@Ivsxk
Copy link
Owner

Ivsxk commented Mar 4, 2021

Hi, I have a question about total wealth.
In your work, the output is summation of three heads initial, short, and reinvest vector, respectively.

The total sum of three heads is 1+(-1) + 1 = 1.
But this value is not considered of total asset volume.
The absolute asset is 3. So, i think it’s like managing three times asset.

(Of course, if the two output values are not zero for both positive and negative heads, respectively, then each absolute value will be offset because the final portfolio value is generated in addition.
However, if you finally put short position, you will always use more than 1.)

For example, for 3 stocks, the final portfolio value is like this at time t,
A_t = [0.8, -0.3, 0.5].
Abs(A_t) = 0.8 + -(-0.3) + 0.5 = 1.6.
So, final portfolio vector have to be scaled by 1.6.
Proper portfolio vector is
A_t’ = [0.8/1.6, -0.3/1.6, 0.5/1.6].

If I misunderstood something, please let me know.
Thank you!

The softmax function has limited the output of each head to nonnegative.

@hanseul-jeong
Copy link
Author

The output i mean is final portfolio vector instead of output of softmax function.

In your codes, (EncoderDecoder class)

    out = self.linear_out(out)                    #[128,11,2*12+1]->[128,11,1]

    bias = self.bias.repeat(out.size()[0],1,1)    #[128,1,1]
    bias2 = self.bias2.repeat(out2.size()[0],1,1) #[128,1,1]

    out = torch.cat([bias,out],1)                 #[128,11,1] cat [128,1,1] -> [128,12,1]
    out2 = torch.cat([bias2,out2],1)              #[128,11,1] cat [128,1,1] -> [128,12,1]

    out = out.permute(0,2,1)                      #[128,1,12]
    out2 = out2.permute(0,2,1)                    #[128,1,12]

    out = F.softmax(out, dim = -1)
    out2 = F.softmax(out2, dim = -1)

    out = out*2
    out2 = -out2
    return out+out2                             #[128,1,12]

this output (return) could be negative value due to out2.

@HanLi123
Copy link

HanLi123 commented Apr 2, 2021

@hanseul-jeong you are right, the sum of out+out2==1 does not guarantee the abs elementwise_sum==1

@Ivsxk I think she means not use leverage in portfolio

@Ivsxk
Copy link
Owner

Ivsxk commented Apr 2, 2021

Sorry about that I misunderstood your question. The final portfolio vector has no need to be scaled by 1.6. Someone borrows 0.3 for reinvesting, which does not mean she/he owns 1.6. The total asset volume belongs to she/he is 1.

@hanseul-jeong
Copy link
Author

Abs(A_t) = 0.8 + -(-0.3) + 0.5 = 1.6.

In that case, i think, ignoring the 0.3 (borrowed ratio), the volume of total assets is 1.3.

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

3 participants