Quickstart
Three steps, in whichever interface you prefer: read the regime, quote a swap, plan a DCA order. Nothing here sends a transaction.
Set up
The SDK and the MCP server are on npm under @poincaretrade; the HTTP API needs nothing at all.
npm i @poincaretrade/sdk viemTry it
- 1Read the regime: is there a confirmed trend, and which side pays?
import { createPoincareClient } from "@poincaretrade/sdk"; const poincare = createPoincareClient(); const r = await poincare.regime(); console.log(r.trend, r.level, r.chargedSide, r.spread); // "down" "engaged" "sell" { buy: 0, sell: 0.0431 } - 2Quote a swap, to the wei of what the router will execute in this block.
const q = await poincare.quote("buy", "100"); // 100 USDC -> WETH // { amountIn, amountOut, price, spread, fee } - 3Plan a DCA order: validated exactly like the contract, with a preview of the first fill.
import { buildOrderParams, recurringOrder } from "@poincaretrade/sdk"; const input = recurringOrder({ side: "buy", amountPerBuy: "100", frequency: "1h", count: 10 }); const params = buildOrderParams(input); // throws DcaParamError with the contract's reason const txs = await poincare.dca.build.create(owner, input); // [approve, createOrder], unsigned
Next: how the regime works, then DCA orders.