When developers build their own marketplace on top of the Living Assets platform, whether within a video game, a web browser, or a mobile app, they often use the trading API to build their own custom databases, optimising the specific functionalities that they need.
The allMarketAssetData query provides an off-the-shelf entry point to some of the most common operations to all marketplaces, including pagination and filters, to help developers bootstrap a custom marketplace until they integrate their own specific needs.
Query
allMarketAssetData( first: Int last: Int offset: Int before: Cursor after: Cursor orderBy: [MarketAssetDataOrderBy!] = [NATURAL] condition: MarketAssetDatumCondition filter: MarketAssetDatumFilter): MarketAssetDataConnection
This query returns a paginated list of asset data (more examples below). The parameters first, last, offset, before, and after are used for pagination. The orderBy parameter is used to specify the ordering of the results, and the condition and filter parameters are used to filter the results.
Query Input
Relevant query inputs are the MarketAssetDatumCondition and MarketAssetDatumFilter which allow filtering the received data.
The MarketAssetDatumCondition input is used to specify the condition to be used in determining which MarketAssetDatum objects should be returned by the query. All fields are tested for equality and combined via the logical operatorAND. It also contains the assetPropsFilter and marketMetaDataFilter inputs for filtering assets based on the contents of the props and metadata fields.
The AssetPropsFilterInput input is used to filter assets based on the contents of the props field. The key field specifies which key to filter on, and the exactValue and containedValue fields specify exact and partial matches, respectively.
The filter will only apply to the properties at the root level of the props JSON object.
The MarketMetadataFilterInput input is used to filter assets based on the contents of the metadata field. The key field specifies which key to filter on, and the exactValue and containedValue fields specify exact and partial matches, respectively.
The MarketAssetDatumFilter input is used to filter MarketAssetDatum objects based on their fields. All fields are combined via the logical operator AND. It also contains the AND, OR, and NOT inputs for combining and negating filter expressions.
Available filters are: equalTo, in, lessThan, isNull and greaterThan.
The MarketAssetDataConnection type represents a connection to a list of MarketAssetDatum objects. The nodes field is a list of the actual MarketAssetDatum objects, the edges field contains the MarketAssetDatum objects and cursors for pagination, the pageInfo field provides information about the current page, and the totalCount field provides the total number of MarketAssetDatum objects that match the query.
Query Response Fields
The relevant response field is MarketAssetDatum, which contains the returned information about the assets and their trades.
This query will return the 10 most recently sold assets, sorted by the date they were last sold. It filters by the lastSaleUpdatedAt field to only include assets that have been sold at least once.