-
Notifications
You must be signed in to change notification settings - Fork 224
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
Example request - Margin in a different currency #135
Comments
Hello, and thanks. Example strategies in other (non-US) markets are in the works (PR #127), main issue is improving cleaning logic of Yahoo Finance historical data (I encountered issues on a few FTSE100 names with phony old open prices, ...). Regarding cost of financing (interest rates) FRED provides data at least for EUR, JPY, GBP, and these can already be used as PS If you have a specific example strategy in mind feel free to open a PR, even if it includes a user-defined subclass of |
Thank you @enzbus ! much appreciated. I do have one in mind. Let me try and through something together and open a PR. |
Hi @enzbus I hope your well. I am not sure if this is the best place to ask this question, but setting up a static portfolio - so a portfolio with fixed weights. leveraged with a cross currency - so borrowing jpy to invest in say us stocks - keeping track of interest rate, fees, margin calls (say 1.1 times the borrowed amount), currency exchange and re-balancing monthly to maintain the the leverage ratio is quite challenging and is (surprisingly) non trivial. I am having a bit trouble pulling together a working solutions. |
That sounds interesting @andrewcz ; apologies if I repeat it but I would suggest that you put together your current code in a prototype example, open a PR, and we take it from there. Of course don't include any IP you wish to keep private. It sounds like the |
PS this is the series currently used as interest rate for JPY, expressed in annualized percentage. Is that right? |
Thank you @enzbus !! Will put together a code example by the end of the week,as well as further details |
Hi @enzbus just advise created a pull request with my attempt. |
Thanks! Looks great, I added a few comments. Give me write permission to your branch if you wish, happy to help. Looks like we can use that MarketData subclass to prototype future extension of MarketData to handle multi-currency portfolios :) |
@enzbus !!! amazing!! you legend! I think i have successfully added you as a collaborator. |
Sure, I can clean up the way |
Hi @enzbus I have done some further thinking, curious on your thoughts on the below. Main strategy Risks and costs. |
OK, this looks reasonable. Let's take an example.
Remember that in Cvxportfolio weights always sum to 1, because of the self-financing condition. The above has leverage 1.5, leverage is just the sum of absolute values of non-cash weights. If we want to leverage up the above to, say, leverage 3, you would get
Which is obtained by simply multiplying the non-cash part and adjusting the cash account accordingly. So, the subclass of
|
Amazing @enzbus !! Im just heading home from work. Will jump on and build an example.im pretty sure we should be able to close this tonight. |
Hi @enzbus , I have made a new file names leverage_strategy.py - i am getting an error and hence im a little stuck. |
Hi @enzbus,
Amazing project! really interesting.
Would it be possible to add an example where you've used margin from multiple currencies, accounting for both interest rates and fees? Additionally, showcasing the daily margin call amount based on currency fluctuations. I think this would be interesting from a risk perspective.
Best regards,
Andrew
The text was updated successfully, but these errors were encountered: