Skip to content
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

Extend getTradeJournal request by adding a status filter #721

Open
ipr0310 opened this issue Feb 14, 2023 · 5 comments
Open

Extend getTradeJournal request by adding a status filter #721

ipr0310 opened this issue Feb 14, 2023 · 5 comments
Labels
API Issues related to the Node's API enhancement New feature or request

Comments

@ipr0310
Copy link
Member

ipr0310 commented Feb 14, 2023

Motivation
While trying to show a summary of open orders in Signumswap i came up with an "accuracy" problem of fetching journal of trades for a given account. Due to some filtering limitations.

Proposal
The request getTradeJournal should have a new query string parameter called status which its purpose is just to filter the trades/orders returned by the API endpoint.

The options for this query parameter will be limited to the following:

  • open
  • filled
  • cancelled

This query parameter should be optional

Example of how it would look like on API Docs:
image

@ipr0310 ipr0310 added enhancement New feature or request API Issues related to the Node's API labels Feb 14, 2023
@ipr0310
Copy link
Member Author

ipr0310 commented Feb 14, 2023

Additionally, it helps to make more efficient queries because you will just get the trades that you really want to see!

Example: I just want to fetch the open trades of a certain account
Not all of its trades

@frankTheTank72
Copy link
Member

Would that still work with pagination?

@ipr0310
Copy link
Member Author

ipr0310 commented Mar 3, 2023

Pagination is already added, filtering is needed

@ipr0310
Copy link
Member Author

ipr0310 commented Mar 3, 2023

Pagination is already added, what is needed is filtering

{
  "account": "8929712165307955075",
  "accountRS": "TS-NFW5-WWDU-Y3BE-9P7VR",
  "tradeJournal": [
    {
      "order": "12137482780163274653",
      "asset": "6589512152275040401",
      "account": "8929712165307955075",
      "accountRS": "TS-NFW5-WWDU-Y3BE-9P7VR",
      "quantityQNT": "100000",
      "priceNQT": "30",
      "height": 480139,
      "name": "myonetoken",
      "decimals": 1,
      "price": "300",
      "timestamp": 260371746,
      "executedQuantityQNT": "0",
      "executedVolumeNQT": "0",
      "type": "bid",
      "status": "cancelled",
      "trades": []
    },
    {
      "order": "2600843465838802073",
      "asset": "15784340403242018732",
      "account": "8929712165307955075",
      "accountRS": "TS-NFW5-WWDU-Y3BE-9P7VR",
      "quantityQNT": "15000000000",
      "priceNQT": "250",
      "height": 475416,
      "name": "TK8",
      "decimals": 8,
      "price": "25000000000",
      "timestamp": 259233220,
      "executedQuantityQNT": "1737429816",
      "executedVolumeNQT": "434357454000",
      "type": "ask",
      "status": "cancelled",
      "trades": [
        {
          "timestamp": 259804495,
          "quantityQNT": "1500000000",
          "priceNQT": "250",
          "asset": "15784340403242018732",
          "askOrder": "2600843465838802073",
          "bidOrder": "135389358966331573",
          "askOrderHeight": 477791,
          "seller": "8929712165307955075",
          "sellerRS": "TS-NFW5-WWDU-Y3BE-9P7VR",
          "buyer": "12892566484214586041",
          "buyerRS": "TS-H8PT-X5HD-V5U4-DSWU7",
          "block": "12446588116028768990",
          "height": 477791,
          "tradeType": "buy",
          "price": "25000000000"
        },
        {
          "timestamp": 259804495,
          "quantityQNT": "237429816",
          "priceNQT": "250",
          "asset": "15784340403242018732",
          "askOrder": "2600843465838802073",
          "bidOrder": "2096241056156122884",
          "askOrderHeight": 477791,
          "seller": "8929712165307955075",
          "sellerRS": "TS-NFW5-WWDU-Y3BE-9P7VR",
          "buyer": "8629824288351884182",
          "buyerRS": "TS-36WQ-GYQN-D856-9DUJH",
          "block": "12446588116028768990",
          "height": 477791,
          "tradeType": "buy",
          "price": "25000000000"
        }
      ]
    },
    {
      "order": "6981912161304512875",
      "asset": "13868324881938171674",
      "account": "8929712165307955075",
      "accountRS": "TS-NFW5-WWDU-Y3BE-9P7VR",
      "quantityQNT": "100000",
      "priceNQT": "5400",
      "height": 474787,
      "name": "TEST",
      "decimals": 4,
      "price": "54000000",
      "timestamp": 259082416,
      "executedQuantityQNT": "0",
      "executedVolumeNQT": "0",
      "type": "bid",
      "status": "cancelled",
      "trades": []
    },
    {
      "order": "6304692069553441032",
      "asset": "13868324881938171674",
      "account": "8929712165307955075",
      "accountRS": "TS-NFW5-WWDU-Y3BE-9P7VR",
      "quantityQNT": "250000",
      "priceNQT": "5500",
      "height": 474787,
      "name": "TEST",
      "decimals": 4,
      "price": "55000000",
      "timestamp": 259082479,
      "executedQuantityQNT": "0",
      "executedVolumeNQT": "0",
      "type": "bid",
      "status": "cancelled",
      "trades": []
    }
  ],
  "nextIndex": 4,
  "requestProcessingTime": 57
}

@ohager
Copy link
Member

ohager commented Apr 17, 2024

The status is a computed value and not inside the database.... so,

  1. filtering on db level is not possible
  2. pagination is partially an issue....in the sense that page sizes are not always 500. ANyways the nextIndex field always helps here

thinking of a solution here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Issues related to the Node's API enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants