mcintyre94 / Jupalyse

A tool to view and download Jupiter DCA data
https://jupalyse.vercel.app
MIT License
9 stars 5 forks source link

Add Limit Order trades #3

Open mcintyre94 opened 1 month ago

mcintyre94 commented 1 month ago

Limit Orders are different because they only resolve to a single trade. So open orders wouldn't be useful, just historic

I haven't really used this much, so will need to find a wallet with more LO activity to test with.

Looks like the Jupiter API for this is (curl):

curl 'https://jup.ag/api/trpc/orderWithTradeHistoryWithItemsCount?batch=1&input=%7B%220%22%3A%7B%22json%22%3A%7B%22wallet%22%3A%22CtWERMNKhsMy2SX564sCPWVMd9LND8aa4jL3YJzdurbp%22%2C%22pageIndex%22%3A0%7D%7D%7D' \
  -H 'content-type: application/json' \

Input URL decodes to {"0":{"json":{"wallet":"CtWERMNKhsMy2SX564sCPWVMd9LND8aa4jL3YJzdurbp","pageIndex":0}}}

Example output:

[
    {
        "result": {
            "data": {
                "json": {
                    "orders": [
                        {
                            "id": 5453010,
                            "orderKey": "BQ3SuuPHUrssc4v9i8Nd9oAvevSx2r9EV36t4BYFb2PC",
                            "maker": "CtWERMNKhsMy2SX564sCPWVMd9LND8aa4jL3YJzdurbp",
                            "inputMint": "UxxvnMnUGoXJig9wc8phE1mYJZMFq3hpfr259zMWcq4",
                            "outputMint": "JxxWsvm9jHt4ah7DT9NuLyVLYZcZLUdPD93PcPQ71Ka",
                            "inAmount": "0",
                            "oriInAmount": "10000000",
                            "outAmount": "0",
                            "oriOutAmount": "15384615384",
                            "expiredAt": null,
                            "state": "Completed",
                            "createTxid": "61mfdxvWe8ku7EbmZygbbar5P8p3HLz9H9zZkKNjgL7z2zimpH3rxkYonv4ADoXvwBA6gGsAmeGwpHzUDFGgJS7s",
                            "cancelTxid": null,
                            "updatedAt": "2024-01-16T15:48:47.499Z",
                            "createdAt": "2024-01-16T15:47:24.000Z",
                            "trades": [
                                {
                                    "id": 21764462,
                                    "orderId": 5453010,
                                    "taker": "AfQ1oaudsGjvznX4JNEw671hi57JfWo4CWqhtkdgoVHU",
                                    "inAmount": "10000000",
                                    "outAmount": "15384615384",
                                    "txid": "uLkPHiAqBEYZ61AkrUKb7ZPNyT9SS1nqxzVHMBM8MEShEmPr8wc8gv7tUJYvPQjYZworkdVCU6ufWuRZRt9Poju",
                                    "ixIndex": 1,
                                    "feeAmount": "30769230",
                                    "usdValue": 0,
                                    "updatedAt": "2024-01-16T15:48:47.401Z",
                                    "createdAt": "2024-01-16T15:48:08.000Z"
                                }
                            ]
                        },
                        {
                            "id": 5451689,
                            "orderKey": "GerSnKCVGN7NiVUPs9ebsHYFSazZGBAXbG8ZDbL4sD4w",
                            "maker": "CtWERMNKhsMy2SX564sCPWVMd9LND8aa4jL3YJzdurbp",
                            "inputMint": "JxxWsvm9jHt4ah7DT9NuLyVLYZcZLUdPD93PcPQ71Ka",
                            "outputMint": "UxxvnMnUGoXJig9wc8phE1mYJZMFq3hpfr259zMWcq4",
                            "inAmount": "0",
                            "oriInAmount": "100000000000",
                            "outAmount": "0",
                            "oriOutAmount": "166666666",
                            "expiredAt": null,
                            "state": "Completed",
                            "createTxid": "26kZGoV7RULJt3eeDchErmQXd788Nvw4U7RvBsL15Nu7cxxG3TL4qQcviJWHTVjcc4igByMJ8XcUxL62exNNpJxZ",
                            "cancelTxid": null,
                            "updatedAt": "2024-01-16T17:48:04.108Z",
                            "createdAt": "2024-01-16T15:43:51.000Z",
                            "trades": [
                                {
                                    "id": 21804891,
                                    "orderId": 5451689,
                                    "taker": "AfQ1oaudsGjvznX4JNEw671hi57JfWo4CWqhtkdgoVHU",
                                    "inAmount": "100000000000",
                                    "outAmount": "166666666",
                                    "txid": "48JVAKdv7Kqziwv6UBYLt9G3frkdrvVBf49AZ8tPRzVJnkq2RGCh5WGHpAuVftyxYXJMyvSbAwpAhnx17MD7dbbE",
                                    "ixIndex": 1,
                                    "feeAmount": "333333",
                                    "usdValue": 0,
                                    "updatedAt": "2024-01-16T17:48:04.066Z",
                                    "createdAt": "2024-01-16T17:48:00.000Z"
                                }
                            ]
                        }
                    ],
                    "itemsCount": 2
                },
                "meta": {
                    "values": {
                        "orders.0.inAmount": [
                            "bigint"
                        ],
                        "orders.0.oriInAmount": [
                            "bigint"
                        ],
                        "orders.0.outAmount": [
                            "bigint"
                        ],
                        "orders.0.oriOutAmount": [
                            "bigint"
                        ],
                        "orders.0.updatedAt": [
                            "Date"
                        ],
                        "orders.0.createdAt": [
                            "Date"
                        ],
                        "orders.0.trades.0.inAmount": [
                            "bigint"
                        ],
                        "orders.0.trades.0.outAmount": [
                            "bigint"
                        ],
                        "orders.0.trades.0.feeAmount": [
                            "bigint"
                        ],
                        "orders.0.trades.0.updatedAt": [
                            "Date"
                        ],
                        "orders.0.trades.0.createdAt": [
                            "Date"
                        ],
                        "orders.1.inAmount": [
                            "bigint"
                        ],
                        "orders.1.oriInAmount": [
                            "bigint"
                        ],
                        "orders.1.outAmount": [
                            "bigint"
                        ],
                        "orders.1.oriOutAmount": [
                            "bigint"
                        ],
                        "orders.1.updatedAt": [
                            "Date"
                        ],
                        "orders.1.createdAt": [
                            "Date"
                        ],
                        "orders.1.trades.0.inAmount": [
                            "bigint"
                        ],
                        "orders.1.trades.0.outAmount": [
                            "bigint"
                        ],
                        "orders.1.trades.0.feeAmount": [
                            "bigint"
                        ],
                        "orders.1.trades.0.updatedAt": [
                            "Date"
                        ],
                        "orders.1.trades.0.createdAt": [
                            "Date"
                        ]
                    },
                    "referentialEqualities": {
                        "orders.0.inAmount": [
                            "orders.0.outAmount",
                            "orders.1.inAmount",
                            "orders.1.outAmount"
                        ],
                        "orders.0.oriInAmount": [
                            "orders.0.trades.0.inAmount"
                        ],
                        "orders.0.oriOutAmount": [
                            "orders.0.trades.0.outAmount"
                        ],
                        "orders.1.oriInAmount": [
                            "orders.1.trades.0.inAmount"
                        ],
                        "orders.1.oriOutAmount": [
                            "orders.1.trades.0.outAmount"
                        ]
                    }
                }
            }
        }
    }
]

There's enough info here to add them