Getting Data
Learn how to retrieve accounts, orders, positions, and other data from connected brokerages.
Once the session is initialized and the user has approved read permissions on a broker connection, you can retrieve accounts, orders, and positions with a consistent API shape.
Overview
The most common read methods are:
getAccounts()getOrders()getPositions()
Each returns a standard response object. On success, result.success.data contains a PaginatedData collection that you can use like an array.
Get Accounts
Retrieve accounts across connected brokers:
1const result = await finatic.getAccounts();
2
3if (result.success) {
4 const accounts = result.success.data;
5 console.log(`Found ${accounts.length} account(s)`);
6} else {
7 console.error('Failed to get accounts:', result.error);
8}Get Orders
Retrieve orders from connected brokers:
1const result = await finatic.getOrders();
2
3if (result.success) {
4 const orders = result.success.data;
5 console.log(`Found ${orders.length} order(s)`);
6} else {
7 console.error('Failed to get orders:', result.error);
8}Get Positions
Retrieve positions from connected brokers:
1const result = await finatic.getPositions();
2
3if (result.success) {
4 const positions = result.success.data;
5 console.log(`Found ${positions.length} position(s)`);
6} else {
7 console.error('Failed to get positions:', result.error);
8}Pagination
getAccounts(), getOrders(), and getPositions() return paginated data. On success:
result.success.data:PaginatedDatacollection (array-like)result.success.data.hasMore: Whether additional pages existresult.success.data.nextPage(): Fetch the next pageresult.success.data.prevPage(): Fetch the previous pageresult.success.data.firstPage(): Jump to the first pageresult.success.data.lastPage(): Jump to the last page
Navigation methods example
1const result = await finatic.getOrders({ limit: 50 });
2
3if (result.success) {
4 const page1 = result.success.data;
5 console.log(`Page 1: ${page1.length} order(s)`);
6
7 if (page1.hasMore) {
8 const page2 = await page1.nextPage();
9 console.log(`Page 2: ${page2.length} order(s)`);
10
11 const page1Again = await page2.prevPage();
12 console.log(`Back to page 1: ${page1Again.length} order(s)`);
13 }
14}Manual pagination example
1const page1 = await finatic.getOrders({ limit: 50, offset: 0 });
2const page2 = await finatic.getOrders({ limit: 50, offset: 50 });Note: Each method also has a "get all" version (
getAllAccounts(),getAllOrders(),getAllPositions()) that fetches all pages and returns a single array. Use those methods when you need the full dataset without manual pagination.
Response Format
All methods in this guide return the standard response object. Always check result.success or result.error before reading data:
1const result = await finatic.getAccounts();
2
3if (result.success) {
4 const accounts = result.success.data;
5 // Process accounts
6} else if (result.error) {
7 console.error('Error:', result.error.message);
8 // Handle error
9}
10For detailed response and error semantics, see:
- Standard Response Object - Understand the shared response contract.
- Error Handling - Handle failures and edge cases safely.
Next Steps
Now that you've retrieved your data:
- Standard Response Object - Understand the response format used by all methods.
- Connecting Brokers - Learn how to connect brokerages to access real data.
- Error Handling - Review error handling patterns for robust applications.
- Explore the API Reference - See all available methods in the API Reference.
- Try the Interactive Playground - Test the SDK in your browser with our Interactive Playground.
