I need to get a historical list of all asset transactions, preferably on a per asset basis.
Is getTrades or getAssetTransfers not enough? If you need the actual orders, not only the completed trades, those are indeed not kept after they are filled (or cancelled). Although you can still use getTrades and get the ask/bid order ids for each trade, which are the transaction ids of the orders, except probably not sorted the way you want.
for getTrades and getAssetTransfers it works fine as there is a list of tx sorted by time, but i do need to iterate through all 500+ assets. But what about the bids and asks? The reason this is needed is that I have the following logic:
1. if init, load entire list
2. if not, then iterate from 0 to N until an existing tx is found and then add from there back to index 0
what i need is a txlist with an increasing index. it is very problematic to have a tx that is index 0, until it becomes index 1, until it becomes index 2, etc. I need a static txid <-> index mapping
now the allopentrades is the only one that is reverse chronological and I can reverse that using the above logic, except of course when any open trade is closed, all the indices change.
without being able to map a txid to a static index, then i need to build one from scratch, which means rescanning the blockchain like I did last year.
Maybe it is easy for you to add a chronological getAssetTransaction? That would be ideal, as that is what my code needs to update its internal state in an event driven manner. If I can find out how many transactions assetid (with or without account) has, then I can iterate from 0 to there. Then to generate an event, I iterate through assets and find the number of total transactions, if more than last time, iterate from the last time to the current number as each of these are the new events that are not seen before.
As you can see to recreate this chronological by asset list is quite a chore with the way the current API is returning. I realize it is most important to provide a sorted orderbook, but when the txindex is not a constant, I cant use it as a reference, so that means I need to requery the DB each time.
this wouldnt be a problem, expect that the InstantDEX orderbook is propagating in tens of milliseconds, so even a couple HDD accesses from the DB is taking more time than sending the order across the entire network
James
P.S. even if it is possible to generate events from the current point forward, without being able to initialize state to the current point, I would need to resort to querying 1000 assets, bids, asks, trades, or just rescan the blockchain.