@xstocker/agent-sdk
SDK for AI agents to trade tokenized U.S. stocks (xStocks) on Solana.
No account. No API key. No OAuth. This SDK only reads public data and builds
unsigned transactions — it never touches a private key. You (or your agent
framework's wallet adapter) are responsible for signing and broadcasting the
returned transaction.
Install
npm install @xstocker/agent-sdk
Usage
import { xstocker } from "@xstocker/agent-sdk";
const { assets, payTokens } = await xstocker.getAssets();
const order = await xstocker.buildOrder({
wallet: "USER_SOLANA_ADDRESS",
asset: "NVDAx",
amount: 100,
payToken: "USDC",
side: "buy",
});
console.log(order.details);
const status = await xstocker.getOrderStatus(signature);
console.log(status.status);
Selling
await xstocker.buildOrder({
wallet: "USER_SOLANA_ADDRESS",
asset: "NVDAx",
amount: 0.5,
payToken: "USDC",
side: "sell",
});
Custom client
import { XStockerAgentClient } from "@xstocker/agent-sdk";
const client = new XStockerAgentClient({ baseUrl: "https://api.xstocker.com" });
Error handling
import { XStockerAgentError } from "@xstocker/agent-sdk";
try {
await xstocker.buildOrder({ wallet, asset: "NVDAx", amount: 100 });
} catch (err) {
if (err instanceof XStockerAgentError) {
console.error(err.code, err.message);
}
}
Links
License
MIT