CKS-Systems / manifest

The Unlimited Orderbook
https://www.manifest.trade
GNU General Public License v3.0
32 stars 17 forks source link

Fetching historical data #235

Open Robiquet opened 3 weeks ago

Robiquet commented 3 weeks ago

Are there any plans to build something to get historical data such as trade history, fill history, price history etc? Let me know if there is something already in the repo that I'm missing. I see you already have FillFeed.ts which could be a good starting point

brittcyr commented 3 weeks ago

That would require storing that data offchain and doing the indexing there. We are talking to teams about that, particularly for those that want to run their own UIs. But we do not plan on managing that indexing code ourselves.

Robiquet commented 3 weeks ago

Even if you don't run the infra it might still be nice to have an open source version that others can run. But would the general approach be to follow what in use what's in fillFeed.ts and deserialize using the various Log.ts files inside client/ts/src/manifest/accounts?

So for example if I wanted to index new orders I would replace:

const fillDiscriminant = genAccDiscriminator('manifest::logs::FillLog');

with:

const placeOrderDiscriminant = genAccDiscriminator('manifest::logs::PlaceOrderLog');

and:

const deserializedFillLog: FillLog = FillLog.deserialize(
  buffer.subarray(8),
)[0];      

with:

const deserializedPlaceOrder: FillLog = PlaceOrderLog.deserialize(
  buffer.subarray(8),
)[0];      

Though I'm a little confused about what this check is for, is that needed? https://github.com/CKS-Systems/manifest/blob/edb1ee7471e0e633dad57fc6db3e99c166822354/client/ts/src/fillFeed.ts#L150

brittcyr commented 3 weeks ago

Thats what the comment above is referring to. It probably is no longer needed after modifying the way we do testing. It is from when the local validator tests would deploy the program to a different address