ok24601 / etoro-api

etoro trading REST API
ISC License
100 stars 48 forks source link

Not able to open position #51

Open dangalea opened 2 years ago

dangalea commented 2 years ago

Hi,

I am new to this piece of software, but I am trying to open a new position on Demo mode. I have followed the tutorial on the README, but I'm getting an error when trying to open any position.

My watchlist is as follows:

[{"id":"28","name":"nsdq100","fullName":"NASDAQ100","buy":null,"sell":null,"marketOpen":null,"askDiscounted":0.0,"bidDiscounted":0.0},{"id":"100000","name":"btc","fullName":"Bitcoin","buy":null,"sell":null,"marketOpen":null,"askDiscounted":0.0,"bidDiscounted":0.0},{"id":"18","name":"gold","fullName":"Gold","buy":null,"sell":null,"marketOpen":null,"askDiscounted":0.0,"bidDiscounted":0.0}]

however, when I try to open a NSDQ100 position via:

curl -X POST \
  http://localhost:8088/etoro-api/positions/open \
  -H 'Content-Type: application/json' \
  -H 'mode: Demo' \
  -d '{
    "name": "nsdq100",
    "type": "BUY",
    "amount": 200,
    "leverage": 20
}'

I get the following error:

{"timestamp":1653989576442,"status":500,"error":"Internal Server Error","message":"None BUY price available for id 28","path":"/etoro-api/positions/open"}

Would anyone know what I am doing wrong? Thanks.

pedroestima-sgg commented 2 years ago

I don't know what you are doing wrong, but if you add something to your watchlist, does it work? Do you get updates?

dangalea commented 2 years ago

As you can see from my post, my watchlist returns null for each item I added. I should note that I did the changes suggested in #50 due to an error during installation.