Get Trades
Fetch a paginated list of Stellar trades using the Blux core SDK.
The getTrades function returns a paginated list of Stellar trades.
The return value contains two properties:
response— the records you can use directlybuilder— exposesnext()andprev()to paginate through results
Type
export type CallBuilderOptions = {
cursor?: string;
limit?: number;
network?: string;
order?: "asc" | "desc";
};
type GetTradesOptions = CallBuilderOptions & {
forAssetPair?: [base: Asset, counter: Asset];
forOffer?: string;
forType?: Horizon.ServerApi.TradeType;
forAccount?: string;
forLiquidityPool?: string;
};
type GetTradesResult = {
builder: TradesCallBuilder;
response: Horizon.ServerApi.CollectionPage<Horizon.ServerApi.TradeRecord>;
};Usage
import { core } from "@bluxcc/core";
const result = await core.getTrades({});