etoro-api icon indicating copy to clipboard operation
etoro-api copied to clipboard

Ability to list copied positions?

Open mortenscheel opened this issue 4 years ago • 8 comments

I copy a bunch of people on eToro, and I'm trying to create a summary containing all my currently copied positions.

By inspecting the requests, I've figured out that all the data I need is included in the response from the logindata endpoint. Would it be possible to add an endpoint to expose this data?

In case anyone is interested, this is where the data about "Mirrors" can be found in the response from logindata: List of Mirrors containing names and avatars: AggregatedResult.ApiResponses.MirrorsUserData.Content.users[] Lists of copied positions: AggregatedResult.ApiResponses.PrivatePortfolio.Content.ClientPortfolio.Mirrors[].Positions

mortenscheel avatar Feb 06 '21 09:02 mortenscheel

Just to follow up, I've forked the project and added the functionality I needed: https://github.com/mortenscheel/etoro-api.

Let me know if you'd be interested in a pull request. This is my first experience with Kotlin, so I'd probably need some help cleaning thigs up though.

mortenscheel avatar Feb 13 '21 16:02 mortenscheel

hi, thanks for your contribution, i'm going to merge your changes into master

ok24601 avatar Feb 13 '21 16:02 ok24601

it's merged now, thanks again

ok24601 avatar Feb 13 '21 17:02 ok24601

No problem. I've pushed a few changes to the fork, in case you want to get those as well. I assume you'll review the code before tagging a new release? Like I said, I've never worked with Kotlin before, and it's been years since I did anything in Java.

Also, I should mention that the Dockerfile is taken from https://github.com/JustinGuese/docker-etoro-api which was mentioned in #26

mortenscheel avatar Feb 13 '21 21:02 mortenscheel

btw i found issue with mirror controller, it fails if there is no mirrors in your login data, it also doen't work for 'Demo' mode

ok24601 avatar Feb 13 '21 21:02 ok24601

will commit fixes

ok24601 avatar Feb 13 '21 21:02 ok24601

Thanks. I don't know how to implement Demo mode for Mirrors. Should it just return an empty array?

I've pushed an update that simplifies a few thing. I've dropped caching of mirror data, and made mirror_id optional in /mirrors/positions.

Regarding code style, do you know how I can make Idea use the standard you're using?

mortenscheel avatar Feb 14 '21 12:02 mortenscheel

hi, i don't use any settings other than default for kotlin, just doint shift+ctrl+options+L with 3 checkboxes for code format. btw demo is already implemented in master

ok24601 avatar Feb 15 '21 14:02 ok24601