etherdelta / etherdelta.github.io

https://etherdelta.com
555 stars 688 forks source link

How to use `/myOrders` endpoint? #121

Open Sajjon opened 7 years ago

Sajjon commented 7 years ago

Using the orders endpoint we can see all orders for a particular token: E.g. for the rather new token GGS ( https://etherscan.io/token/0x68db10ecc599d9f5e657acdafdbf6449d658bb2d )

We can see some buy orders, but no sell orders yet (as of 2017-09-19)

https://api.etherdelta.com/orders/0x68db10ecc599d9f5e657acdafdbf6449d658bb2d/0

This returns:

{
    "buys": [
        {
            "id": "3258f73aa9be18d92f95a090631c3fc08abce46e95c5abb13274cbd6696b5310_buy",
            "amount": "1e+23",
            "price": "0.000001",
            "tokenGet": "0x68db10ecc599d9f5e657acdafdbf6449d658bb2d",
            "amountGet": "1e+23",
            "tokenGive": "0x0000000000000000000000000000000000000000",
            "amountGive": "100000000000000000",
            "expires": "5290088",
            "nonce": "2197548769",
            "v": 27,
            "r": "0xb6766ab193aae5c9318eb78fd4a7d90d0754ebcb7ebdf6033139fb439a68c3b9",
            "s": "0x4a60b4820611c21c24ac1c2aa48259c3e3e4f76724f28cf84c581ba02b1a6f02",
            "user": "0x66a4e99923Ff534c41936D0B28a13980B0a942f0",
            "updated": "2017-09-19T18:33:00.720Z",
            "availableVolume": "1e+23",
            "ethAvailableVolume": "100000",
            "availableVolumeBase": "100000000000000000",
            "ethAvailableVolumeBase": "0.1",
            "amountFilled": null
        },
        {
            "id": "2ef0f8baa3055b9e759c3c056de2d0b1b49dff0328dc2365d855c4713b2759fc_buy",
            "amount": "1e+23",
            "price": "0.0000002",
            "tokenGet": "0x68db10ecc599d9f5e657acdafdbf6449d658bb2d",
            "amountGet": "1e+23",
            "tokenGive": "0x0000000000000000000000000000000000000000",
            "amountGive": "20000000000000000",
            "expires": "4390584",
            "nonce": "1045984712",
            "v": 27,
            "r": "0x94c04aebea39d49b2b4b753bbf8f1eb6a96bf1a80d150cdb0ebd48a067b0bc63",
            "s": "0x36bb9c953d8bb7e72ae23ea27be2e46fe61005f17437bdea4c8aae4703d5340e",
            "user": "0xed518de3D26f89F6612416fE42888e4205F7D88a",
            "updated": "2017-09-19T15:43:18.501Z",
            "availableVolume": "1e+23",
            "ethAvailableVolume": "100000",
            "availableVolumeBase": "20000000000000000",
            "ethAvailableVolumeBase": "0.02",
            "amountFilled": null
        }
    ],
    "sells": []
}

Here we see some users public ETH address, e.g. user 0x66a4e99923Ff534c41936D0B28a13980B0a942f0

I thought I was going to be able to see some users other orders using the /myOrders endpoint, as described here: https://github.com/etherdelta/etherdelta.github.io/blob/master/docs/API.md#get-httpsapietherdeltacommyordersuser-addresstoken-addresspage

https://api.etherdelta.com/myOrders/[USER ADDRESS]/[TOKEN ADDRESS]/[PAGE] is the format.

Lets use the same token, GGS with address 0x68db10ecc599d9f5e657acdafdbf6449d658bb2d for said user we KNOW have a buy order: 0x66a4e99923Ff534c41936D0B28a13980B0a942f0

But sending a GET request with url: https://api.etherdelta.com/myOrders/0x66a4e99923Ff534c41936D0B28a13980B0a942f0/0x68db10ecc599d9f5e657acdafdbf6449d658bb2d/0 we get nothing. I get a HTTP status code 200 but no reply. I am sending Content-Type application/json but it does not matter. Nor does Accept.

So what is up? Is there such and API endpoint or not? :)

zackcoburn commented 7 years ago

I don't think GGS is transferrable yet (thus no deposits and no sell orders), but I can't tell for sure because their code isn't verified on Etherscan.

The other thing is due to caching and load balancing. I'll have a solution for this at some point.

On Tue, Sep 19, 2017 at 2:32 PM, Alexander Cyon notifications@github.com wrote:

Using the orders endpoint we can see all orders for a particular token: E.g. for the rather new token GGS ( https://etherscan.io/token/ 0x68db10ecc599d9f5e657acdafdbf6449d658bb2d )

We can see some buy orders, but no sell orders yet (as of 2017-09-19)

https://api.etherdelta.com/orders/0x68db10ecc599d9f5e657acdafdbf 6449d658bb2d/0

This returns:

{ "buys": [ { "id": "3258f73aa9be18d92f95a090631c3fc08abce46e95c5abb13274cbd6696b5310_buy", "amount": "1e+23", "price": "0.000001", "tokenGet": "0x68db10ecc599d9f5e657acdafdbf6449d658bb2d", "amountGet": "1e+23", "tokenGive": "0x0000000000000000000000000000000000000000", "amountGive": "100000000000000000", "expires": "5290088", "nonce": "2197548769 <(219)%20754-8769>", "v": 27, "r": "0xb6766ab193aae5c9318eb78fd4a7d90d0754ebcb7ebdf6033139fb439a68c3b9", "s": "0x4a60b4820611c21c24ac1c2aa48259c3e3e4f76724f28cf84c581ba02b1a6f02", "user": "0x66a4e99923Ff534c41936D0B28a13980B0a942f0", "updated": "2017-09-19T18:33:00.720Z", "availableVolume": "1e+23", "ethAvailableVolume": "100000", "availableVolumeBase": "100000000000000000", "ethAvailableVolumeBase": "0.1", "amountFilled": null }, { "id": "2ef0f8baa3055b9e759c3c056de2d0b1b49dff0328dc2365d855c4713b2759fc_buy", "amount": "1e+23", "price": "0.0000002", "tokenGet": "0x68db10ecc599d9f5e657acdafdbf6449d658bb2d", "amountGet": "1e+23", "tokenGive": "0x0000000000000000000000000000000000000000", "amountGive": "20000000000000000", "expires": "4390584", "nonce": "1045984712", "v": 27, "r": "0x94c04aebea39d49b2b4b753bbf8f1eb6a96bf1a80d150cdb0ebd48a067b0bc63", "s": "0x36bb9c953d8bb7e72ae23ea27be2e46fe61005f17437bdea4c8aae4703d5340e", "user": "0xed518de3D26f89F6612416fE42888e4205F7D88a", "updated": "2017-09-19T15:43:18.501Z", "availableVolume": "1e+23", "ethAvailableVolume": "100000", "availableVolumeBase": "20000000000000000", "ethAvailableVolumeBase": "0.02", "amountFilled": null } ], "sells": [] }

Here we see some users public ETH address, e.g. user 0x66a4e99923Ff534c41936D0B28a13980B0a942f0

I thought I was going to be able to see some users other orders using the /myOrders endpoint, as described here: https://github.com/etherdelta/ etherdelta.github.io/blob/master/docs/API.md#get- httpsapietherdeltacommyordersuser-addresstoken-addresspage

https://api.etherdelta.com/myOrders/[USER ADDRESS]/[TOKEN ADDRESS]/[PAGE] is the format.

Lets use the same token, GGS with address 0x68db10ecc599d9f5e657acdafdbf 6449d658bb2d for said user we KNOW have a buy order: 0x66a4e99923Ff534c41936D0B28a13980B0a942f0

But sending a GET request with url: https://api.etherdelta.com/myOrders/ 0x66a4e99923Ff534c41936D0B28a13980B0a942f0/0x68db10ecc599d9f5e657acdafdbf 6449d658bb2d/0 we get nothing. I get a HTTP status code 200 but no reply. I am sending Content-Type application/json but it does not matter. Nor does Accept.

So what is up? Is there such and API endpoint or not? :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/etherdelta/etherdelta.github.io/issues/121, or mute the thread https://github.com/notifications/unsubscribe-auth/APEqPfSZRrseavoCFLMEVVXUWo7KbvQnks5skBbigaJpZM4Pc5sc .

testenship commented 7 years ago

Hi, [sorry for my english, guys, I never have occasions to practise it] I don't think that the problem is token-related; I had the same problem with "myOrders" endpoint, with more tokens. For the same API request, it doesn't return always the same result. Most of times you get an empty body in the response (with no error code, always 200!) but sometimes it gives the results you would expect. "funds" endpoint is working even worse, with the same malfunctioning AND wrong results when they appear.

EDIT: it seems the same problem that the webpage at etherdelta.com is suffering (I don't know if it uses the same set of API). A lot of the times, orders are in the book but not in mytransactions/orders. That is quite serious because you can see you orders there, but can't delete them.

zackcoburn commented 7 years ago

Noted, thanks.

On Tue, Sep 19, 2017 at 11:13 PM testenship notifications@github.com wrote:

Hi, [sorry for my english, guys, I never have occasions to practise it] I don't think that the problem is token-related; I had the same problem with "myOrders" endpoint, with more tokens. For the same API request, it doesn't return always the same result. Most of times you get an empty body in the response (with no error code, always 200!) but sometimes it gives the results you would expect. "funds" endpoint is working even worse, with the same malfunctioning AND wrong results when they appear.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/etherdelta/etherdelta.github.io/issues/121#issuecomment-330740190, or mute the thread https://github.com/notifications/unsubscribe-auth/APEqPfBcWhT04wtcN5WuTy5W9LC03iXqks5skJDIgaJpZM4Pc5sc .

-- Zack Coburn

NOTICE: This e-mail transmission (and/or the attachments accompanying it) may contain confidential information belonging to the sender which is protected by law. The information is intended only for the use of the intended recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this information is strictly prohibited. Any unauthorized interception of this transmission is illegal. If you have received this transmission in error, please promptly notify the sender by reply e-mail, and then destroy all copies of the transmission.

testenship commented 7 years ago

I'm writing the EDIT part again because you could have missed it (it's not in the quote in the email) and I feel that's the most important part because it's not only-API-related and a lot of people are complaining about this.

"EDIT: it seems the same problem that the webpage at etherdelta.com is suffering (I don't know if it uses the same set of API). A lot of the times, orders are in the book but not in mytransactions/orders. That is quite serious because you can see you orders there, but can't delete them."

You're welcome; solving this kind of problems would help a lot in improving liquidity on the platform ; )

kallero commented 7 years ago

I tried to reproduce this behaviour by navigating to the token orders page for this GGS token:

https://api.etherdelta.com/orders/0x68db10ecc599d9f5e657acdafdbf6449d658bb2d/0

And then picking some user addresses and attempting to display them in Chrome browser with for example: https://api.etherdelta.com/myOrders/0x9A5341003596899166A7382Ae0cd2243F7349f62/0x68db10ecc599d9f5e657acdafdbf6449d658bb2d/0

Sometimes this displays some user orders but sometimes there is a blank page and I need to refresh the page to get the order list. I have not tried to use other user agents besides Chrome but it looks like the response code is 200.

Sajjon commented 7 years ago

@kallero I think you wrote an incorrect URL? for /myOrdersyou wrote //, notice the lacking user address

Sajjon commented 7 years ago

So in general the API sometimes returns data and sometimes it does not?

Would it not be better if the API would return HTTP status code 500 if result was erroneously blank (if there actually should be data)?

When the API returns 200 but no data, even though there is data, that is misleading.

So step 1 should really be to return 500 instead and then resolve the underlying true bug?

kallero commented 7 years ago

@Sajjon Yes. I edited the address in my post to show some address.

Sajjon commented 7 years ago

@kallero now your hyperlink has a label with the correct URL, but pressing it takes you to the wrong page ;)

kallero commented 7 years ago

@Sajjon I finally learned how to use the markdown :)

chengloy commented 7 years ago

if I download the codes from the repository and run the website locally, and where the order books will reside in?

zackcoburn commented 7 years ago

The order book would still be on the off-chain order book server that everyone connects to.

Zack Coburn

NOTICE: This e-mail transmission (and/or the attachments accompanying it) may contain confidential information belonging to the sender which is protected by law. The information is intended only for the use of the intended recipient. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this information is strictly prohibited. Any unauthorized interception of this transmission is illegal. If you have received this transmission in error, please promptly notify the sender by reply e-mail, and then destroy all copies of the transmission.

On Mon, Sep 25, 2017 at 9:38 PM, chengloy notifications@github.com wrote:

if I download the codes from the repository and run the website locally, and where the order books will reside in?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/etherdelta/etherdelta.github.io/issues/121#issuecomment-332069415, or mute the thread https://github.com/notifications/unsubscribe-auth/APEqPXs_niLKqLw3S6TBMLLZ_WGq4XKSks5smGPCgaJpZM4Pc5sc .