You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Problem: SDKs can't read market activity from the node #1443
The Goal below defines market activity, the filled volume and unique traders of one order book over a time window, as one SQL statement that each SDK carries and runs through the node's ad hoc query RPC.
That puts the definition in more than one place. sdk-go carries the statement, sdk-py reaches it through the Go bindings, and sdk-js carries its own copy. Changing what counts as volume then means changing and releasing every SDK, and a caller on an older SDK version keeps computing the old rule. Every other order book read is a node action (get_market_depth, get_full_market_depth, get_best_prices, get_order_events_by_wallet), so this would be the only definition kept outside the node.
The ad hoc path also costs more per call. A signed client asks the node for a challenge before each query, so a call is two requests. From my workstation in Indonesia that measured 615 ms median against the mainnet gateway, where an action call measured 266 ms. A node in private mode refuses an unsigned ad hoc query outright.
The Goal kept node changes out of scope. This Problem brings the action and its index in, for the reasons above.
What the node needs
A public view action, get_market_activity($query_id, $from_ts, $to_ts), that returns the Goal's twelve columns with the Goal's definition unchanged, so each SDK calls it the way it calls get_market_depth.
ob_order_events is indexed on id and block_height only, so every read scans the whole retained table. An index on (query_id, block_timestamp) makes a call cost what its window holds.
On a node that retains no order events, the statement returns NULL for coverage_from_block and coverage_complete. The action should return values every SDK can read as non-null.
Current state
The sdk-go method is open as a pull request that runs the statement ad hoc. It moves to the action once the action exists:
Activity