0.3.1 • Published 5 months ago
@afintech/sdk v0.3.1
Architect JavaScript SDK
Architect provides several options for programmatic access to marketdata, order entry, portfolio management, and execution algos. Learn more about our language SDKs at https://docs.architect.co/architect-api-and-sdk-guide.
Prereqs
- Ensure you have node@lts (v22.x preferred)
npm install
Environment Setup
- Create your API key. Guidelines: Creating an API key.
- Create a
.env
file with the following keys:
ARCHITECT_API_KEY=<your-api-key>
ARCHITECT_API_SECRET=<your-api-secret>
# Paper trading only available for GraphQL endpoints at this time
ARCHITECT_TRADING_MODE=paper|live
ARCHITECT_HOST=https://app.architect.co/
Examples
For further examples, see docs at https://docs.architect.co/architect-api-and-sdk-guide.
GraphQL Example
Run with `node --env-file=.env example.mjs
// example.mjs
import { create } from '@afintech/sdk';
const client = create({
host: /** @type {string} */ (process.env.ARCHITECT_HOST),
apiKey: /** @type {string} */ (process.env.ARCHITECT_API_KEY),
apiSecret: /** @type {string} */ (process.env.ARCHITECT_API_SECRET),
tradingMode: /** @type {'paper' | 'live'} */ (
process.env.ARCHITECT_TRADING_MODE
),
});
const markets = await c.filterMarkets([], {
venue: 'CME',
searchString: 'Ether',
});
console.log('CME Ether markets', markets);
const accounts = await c.accounts([]);
console.log(
'Your FCM accounts:\n',
accounts.map('* %s', account.name').join('\n')
);
gRPC Example
!NOTE Available soon.