ok24601 / etoro-api

etoro trading REST API
ISC License
101 stars 47 forks source link

Docker image build and push failing #15

Open jpdom opened 4 years ago

jpdom commented 4 years ago

The automatic action to build and push the docker image to the docker repository is failing.

ashalliants commented 3 years ago

The dockerfile from the fork doesnt actually work - took me a while but did eventually manage to get it running in headless mode for docker - but can confirm, was a giant ballache

ok24601 commented 3 years ago

Cool, great job.I tried to make it work but failed. Would you share your solution for headless mode?

ashalliants commented 3 years ago

I did tweak some stuff in the actual code but I don't think its needed, but let me know if this bombs out for you

FROM markhobson/maven-chrome:jdk-11
RUN apt update && apt install -y xvfb/stable google-chrome-stable

WORKDIR /artifact/app
COPY . .
RUN ./gradlew build

EXPOSE 8088
CMD xvfb-run -l -a -e /dev/stdout java -jar /artifact/app/build/libs/etoro-api-0.1.3.jar

Note that you'll need to run it with extra space given to shm when running it, so something like this: docker run --shm-size=1g -p 8088:8088 -e LOGIN=xxx -e PASSWORD=xxx etoro-api

ashalliants commented 3 years ago

whilst you're here actually, do you know what I'm doing wrong with opening positions? literally everything bombs out saying it couldnt find the asset with ID xxx when making a buy order on demo

ashalliants commented 3 years ago

heres using the demo code from the readme (same result in swagger ui, even with profit and stop loss enabled)

image

Note it must be doing something as its always able to resolve the name to an asset ID

ok24601 commented 3 years ago

Hi, you probably didn‘t added asset to your whatchlist, try to remove whatchlist.json and do again

ashalliants commented 3 years ago

Perfect, sorry I'm an idiot who didn't read the readme properly! Many thanks! Only remaining question is can you set a takeprofit / set a stop loss based on percentage like in the real api, ie take profit of 5% - or do you need to calculate the TL rate manually? Promise I checked the docs first this time :)

ashalliants commented 3 years ago

and I guess for bonus points, is there a way to place an order rather than 'at market'? - might even be worth opening up a proxy that u can just jam requests at and it adds the necessary headers. happy to offer some help making any of this possible if it isnt already :)

ok24601 commented 3 years ago

hi, at the moment you can only set SL or TP ("takeProfitRate" or "stopLossRate") as a price and not in %, it's possible to rebuild this logic you can modify method "openPosition()" in EtoroHttpClient class

about place order API I don't have this at the time, you can try to implement it just like openPosition method. But first you have to find out which REST API etoro uses for that.

JustinGuese commented 3 years ago

Hey @ashalliants, I tried to copy your dockerfile, but it fails for me... does it still work for you even with the newest Chrome? I feel like the newest chrome broke it

ashalliants commented 3 years ago

I mean you can try just using an older version of the chrome image then, but it's been 100% working for me and I truly like in the last couple of weeks. Make sure you use the shg param or whatever it is. (Sorry I'm not at my computer right now)

On Mon, 1 Feb 2021, 8:54 am Justin Güse, notifications@github.com wrote:

Hey @ashalliants https://github.com/ashalliants, I tried to copy your dockerfile, but it fails for me... does it still work for you even with the newest Chrome? I feel like the newest chrome broke it

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ok24601/etoro-api/issues/15#issuecomment-770688806, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHP3JGSS6S47OK4K5VVPA5LS4ZT5HANCNFSM4TXDLYUA .

JustinGuese commented 3 years ago

I mean you can try just using an older version of the chrome image then, but it's been 100% working for me and I truly like in the last couple of weeks. Make sure you use the shg param or whatever it is. (Sorry I'm not at my computer right now) On Mon, 1 Feb 2021, 8:54 am Justin Güse, @.***> wrote: Hey @ashalliants https://github.com/ashalliants, I tried to copy your dockerfile, but it fails for me... does it still work for you even with the newest Chrome? I feel like the newest chrome broke it — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#15 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHP3JGSS6S47OK4K5VVPA5LS4ZT5HANCNFSM4TXDLYUA .

Alright, thanks! I will try around and post it here if I have a solution!

JustinGuese commented 3 years ago

Alright, with a little tweaking I got it to work and published the image to dockerhub: https://hub.docker.com/repository/docker/guestros/etoroapi

ashalliants commented 3 years ago

think someone might have beaten you to it :)

https://hub.docker.com/r/yitelee/etoroapi

On Mon, 1 Feb 2021 at 09:38, Justin Güse notifications@github.com wrote:

Alright, with a little tweaking I got it to work and published the image to dockerhub: https://hub.docker.com/repository/docker/guestros/etoroapi

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ok24601/etoro-api/issues/15#issuecomment-770718793, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHP3JGUOP3RE2JOZ7RPXCJTS4ZZCHANCNFSM4TXDLYUA .