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
Broader support for online update of securities #1908
Broader support for online update of securities #1908
Conversation
Hi @MrMarvin, thanks for taking the time for your contribution. 😄 I check the terms and conditions of etf-data.com. The terms are actually about the subscription case. If the users subscribes, then all looks okay. The "The client shall not use, store, or access any ZuriAnalytics’ Data & Services, ETF Data API or Vattly after the termination of this Agreement" is something that the user could implement by deleting the securities and/or attributes. There is almost nothing writing about the free tier. It says "Nevertheless, it should always be enough for someone just exploring the API and doing small individual research." where one could see PP as small individual research. Anyway, as you added the name "PortfolioPerformance" to the header, it would be fairly easy to track usage back to this project. Do you happen to have contact with those folks? The code itself looks okay. I cannot test it at the moment because the SSL certificate of eft-data has expired. That is a change I can fairly quickly merge. About the change - maybe we should not hit the eft-data server if we know the search term is not a ISIN. Just to keep the free limit safe. We could use a simply regex to see if it is an ISIN.
I am not sure that is the case at the moment. The attributes that search provider currently sets are simply lost. Unfortunately, the design of the attributes is not really intuitive nor is it good (but hard to change because it is out). Today, it works like this:
In short, there is not yet a solution to dynamically add new attributes which have a particular meaning. Then the next point: I like the regions and sector information for each product. For this, I would like to see a etf-data just needs the ISIN, nothing special such as an onlineId. Do you think the user should "mark" the securities somehow for which PP then retrieves additional attributes? What do you think about syncing into the taxonomy? |
Hi @buchen, thanks a lot for your comments!
Not yet. If this PR's direction is something we agree on pursuing, I can definitely reach out to them and clarify our usage patterns. I agree that PP should fall into "small individual research", but let's see.
Yeah, that's unfortunate. Almost ironic that after finding this service, implementing a client against their API, opening a PR stating "[third party providers] vary in accuracy and consistency unfortunately" and the next morning their service breaks with an expired certificate 😅
Yep, good point. I'll add a check before calling out to the API in the SearchProvider.
To my understanding those attributes are not in fact lost, they continue to exist, but are just never displayed. All UI components do look up from the ClientSettings list and map to values on the security model, so they cant "know" that there are more.
I'd tried to avoid changing the model itself so far. Looking into tweaking the
This was my initial reason to start working on security searching / importing. I believe this becomes much easier to get by once we settled on a mechanism to import attributes. It's basically the same thing, needs the same understanding of what exists on the ClientSettings etc. How do you feel about wrapping up this PRs with the basic flow with security info and attributes and then add the Taxonomy import/update in a secondary PR on top? |
Regarding "some small-ish UI logic that forcefully adds "unknown" attributes that exists on a security to the list in ClientSettings": Please see the commit I just pushed. It's a first idea how to do that, currently only supporting the initial 'create Security after search' case, not updating or connecting an existing Secuity with an online update source.
|
e29366e
to
7389253
Compare
Okay, I took another swing at linking existing Securities. User facing changes so far:
This all with the caveat that the 'Link to' mechanism currently has no way to add the new AttributeTypes to the ClientSettings list, as the initial import via search does. A workaround is to search and import at least one other Security from ETF-Data.com. This will populate the AttributeTypes. All other (linked) Securities will then show their attribute just fine. |
8815abf
to
7d2b65d
Compare
Hi @MrMarvin, as I said, I like the idea of getting more attributes from such sites as etf-data. Looking at your proposal, the first thing I am thinking about whether it makes sense to use the "link to provider" approach. For example, it should be possible to retrieve historical prices from portfolio report but at the same time retrieve attributes from etf-data (which has no historical prices to my understanding). Plus: the unique identifier on etf-data is the ISIN (which is great) so we could sync the attributes on all securities that happen to have a ISIN. My thinking right now is:
If you don't mind, I will cherry pick your changes and re-assemble them along these lines. I have a couple more comments on the code:
|
- search etf-data if search string is an ISIN - add new attributes if user chooses security - added new attribute type filed 'source' to identify mapped fields - update default fields Co-authored-by: Marvin Frick <marvin.frick@shopify.com> Co-authored-by: Andreas Buchen <andreas.buchen@gmail.com> Issue: #1908
I have no cherry-picked your changes and extracted the "search" functionality as a first starting point. The branch is here: The major change is that I determine the attribute based on a new "source" attribute. This should allow to attach it also to existing attributes where I cannot change the Id. Next, I will take your sync functionality and wrap it into a menu item. It looks already nice. Thanks for your contribution. I added you to the about text. |
Co-authored-by: Marvin Frick <marvin.frick@shopify.com> Co-authored-by: Andreas Buchen <andreas.buchen@gmail.com> Issue: #1908
Merged into master |
Thank you @buchen! The cherry-picked and enhanced solution you chose is great. I agree that the whole linking a Security to an online service i.e. portfolio-report.net seemed odd to me. I think generally I'm in in favour of a more neutral stance on online services, like we do with the multiple Quote providers. Not having a single one "own" certain or all securities. Please not that I'm missing a lot of context on the decisions made around that. |
- search etf-data if search string is an ISIN - add new attributes if user chooses security - added new attribute type filed 'source' to identify mapped fields - update default fields Co-authored-by: Marvin Frick <marvin.frick@shopify.com> Co-authored-by: Andreas Buchen <andreas.buchen@gmail.com> Issue: portfolio-performance#1908
Co-authored-by: Marvin Frick <marvin.frick@shopify.com> Co-authored-by: Andreas Buchen <andreas.buchen@gmail.com> Issue: portfolio-performance#1908
- search etf-data if search string is an ISIN - add new attributes if user chooses security - added new attribute type filed 'source' to identify mapped fields - update default fields Co-authored-by: Marvin Frick <marvin.frick@shopify.com> Co-authored-by: Andreas Buchen <andreas.buchen@gmail.com> Issue: portfolio-performance#1908
Co-authored-by: Marvin Frick <marvin.frick@shopify.com> Co-authored-by: Andreas Buchen <andreas.buchen@gmail.com> Issue: portfolio-performance#1908
Broader support for online update of securities
Some types of investment vehicles receive updates to their base information and attributes. Especially funds tend to get re balanced on their constituents (often), change their TER according to market shifts (occasionally) or even switch the index they tracks (rarely).
Currently there is no extendable way to automate the process of updating those information on a security in Portfolio-Performance.
Use of etf-data.com
While I personally would prefer to get those pieces of information from the funds respective vendors directly, this has been proven difficult. A lack of consistent public APIs from their side forces us to rely on third party aggregation services. Those vary in accuracy and consistency unfortunately.
The suggested https://etf-data.com/ is such an independent API provider. It offers both free (without any additional authentication or registration) and paid access. I've personally used their service over the last few days without issues on the free plan. Hoping this will stay available for the foreseeable future 🤞. One downside is that it currently focuses on ETFs only.
Features
Design decisions:
Security
can have one of many online updates sources. Currently we only support Portfolio-Report.net.2.1. The existing
SecuritySearchProvider
should be in the call chain to do update as well, introducing this interface to also abstract away for updates inSyncOnlineSecuritiesJob
.2.2. The
onlineId
field should be used to indicate which online updater to use, if any.2.1 If an attribute that is received via online sources is not currently configured in the
clientSettings
list of Security attributes, it will be added and therefore appear in the security's edit view / wizard. A user may change the display naming of the attribute at any point.Future work
Importing/update Taxonomies such as Region and Sector distribution, potentially guarded by if the user has
Regions (MSCI)
and/orIndustries (GICS)
enabled