@finatic/client 0.0.140 → 0.0.141

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1409,6 +1409,155 @@ class ApiClient {
1409
1409
  },
1410
1410
  });
1411
1411
  }
1412
+ /**
1413
+ * Get order fills for a specific order
1414
+ * @param orderId - The order ID
1415
+ * @param filter - Optional filter parameters
1416
+ * @returns Promise with order fills response
1417
+ */
1418
+ async getOrderFills(orderId, filter) {
1419
+ const accessToken = await this.getValidAccessToken();
1420
+ const params = {};
1421
+ if (filter?.connection_id) {
1422
+ params.connection_id = filter.connection_id;
1423
+ }
1424
+ if (filter?.limit) {
1425
+ params.limit = filter.limit.toString();
1426
+ }
1427
+ if (filter?.offset) {
1428
+ params.offset = filter.offset.toString();
1429
+ }
1430
+ return this.request(`/brokers/data/orders/${orderId}/fills`, {
1431
+ method: 'GET',
1432
+ headers: {
1433
+ Authorization: `Bearer ${accessToken}`,
1434
+ },
1435
+ params,
1436
+ });
1437
+ }
1438
+ /**
1439
+ * Get order events for a specific order
1440
+ * @param orderId - The order ID
1441
+ * @param filter - Optional filter parameters
1442
+ * @returns Promise with order events response
1443
+ */
1444
+ async getOrderEvents(orderId, filter) {
1445
+ const accessToken = await this.getValidAccessToken();
1446
+ const params = {};
1447
+ if (filter?.connection_id) {
1448
+ params.connection_id = filter.connection_id;
1449
+ }
1450
+ if (filter?.limit) {
1451
+ params.limit = filter.limit.toString();
1452
+ }
1453
+ if (filter?.offset) {
1454
+ params.offset = filter.offset.toString();
1455
+ }
1456
+ return this.request(`/brokers/data/orders/${orderId}/events`, {
1457
+ method: 'GET',
1458
+ headers: {
1459
+ Authorization: `Bearer ${accessToken}`,
1460
+ },
1461
+ params,
1462
+ });
1463
+ }
1464
+ /**
1465
+ * Get order groups
1466
+ * @param filter - Optional filter parameters
1467
+ * @returns Promise with order groups response
1468
+ */
1469
+ async getOrderGroups(filter) {
1470
+ const accessToken = await this.getValidAccessToken();
1471
+ const params = {};
1472
+ if (filter?.broker_id) {
1473
+ params.broker_id = filter.broker_id;
1474
+ }
1475
+ if (filter?.connection_id) {
1476
+ params.connection_id = filter.connection_id;
1477
+ }
1478
+ if (filter?.limit) {
1479
+ params.limit = filter.limit.toString();
1480
+ }
1481
+ if (filter?.offset) {
1482
+ params.offset = filter.offset.toString();
1483
+ }
1484
+ if (filter?.created_after) {
1485
+ params.created_after = filter.created_after;
1486
+ }
1487
+ if (filter?.created_before) {
1488
+ params.created_before = filter.created_before;
1489
+ }
1490
+ return this.request('/brokers/data/orders/groups', {
1491
+ method: 'GET',
1492
+ headers: {
1493
+ Authorization: `Bearer ${accessToken}`,
1494
+ },
1495
+ params,
1496
+ });
1497
+ }
1498
+ /**
1499
+ * Get position lots (tax lots for positions)
1500
+ * @param filter - Optional filter parameters
1501
+ * @returns Promise with position lots response
1502
+ */
1503
+ async getPositionLots(filter) {
1504
+ const accessToken = await this.getValidAccessToken();
1505
+ const params = {};
1506
+ if (filter?.broker_id) {
1507
+ params.broker_id = filter.broker_id;
1508
+ }
1509
+ if (filter?.connection_id) {
1510
+ params.connection_id = filter.connection_id;
1511
+ }
1512
+ if (filter?.account_id) {
1513
+ params.account_id = filter.account_id;
1514
+ }
1515
+ if (filter?.symbol) {
1516
+ params.symbol = filter.symbol;
1517
+ }
1518
+ if (filter?.position_id) {
1519
+ params.position_id = filter.position_id;
1520
+ }
1521
+ if (filter?.limit) {
1522
+ params.limit = filter.limit.toString();
1523
+ }
1524
+ if (filter?.offset) {
1525
+ params.offset = filter.offset.toString();
1526
+ }
1527
+ return this.request('/brokers/data/positions/lots', {
1528
+ method: 'GET',
1529
+ headers: {
1530
+ Authorization: `Bearer ${accessToken}`,
1531
+ },
1532
+ params,
1533
+ });
1534
+ }
1535
+ /**
1536
+ * Get position lot fills for a specific lot
1537
+ * @param lotId - The position lot ID
1538
+ * @param filter - Optional filter parameters
1539
+ * @returns Promise with position lot fills response
1540
+ */
1541
+ async getPositionLotFills(lotId, filter) {
1542
+ const accessToken = await this.getValidAccessToken();
1543
+ const params = {};
1544
+ if (filter?.connection_id) {
1545
+ params.connection_id = filter.connection_id;
1546
+ }
1547
+ if (filter?.limit) {
1548
+ params.limit = filter.limit.toString();
1549
+ }
1550
+ if (filter?.offset) {
1551
+ params.offset = filter.offset.toString();
1552
+ }
1553
+ return this.request(`/brokers/data/positions/lots/${lotId}/fills`, {
1554
+ method: 'GET',
1555
+ headers: {
1556
+ Authorization: `Bearer ${accessToken}`,
1557
+ },
1558
+ params,
1559
+ });
1560
+ }
1412
1561
  }
1413
1562
 
1414
1563
  class EventEmitter {
@@ -5883,6 +6032,69 @@ class FinaticConnect extends EventEmitter {
5883
6032
  }
5884
6033
  return this.apiClient.disconnectCompany(connectionId);
5885
6034
  }
6035
+ /**
6036
+ * Get order fills for a specific order
6037
+ * @param orderId - The order ID
6038
+ * @param filter - Optional filter parameters
6039
+ * @returns Promise with order fills response
6040
+ */
6041
+ async getOrderFills(orderId, filter) {
6042
+ if (!(await this.isAuthenticated())) {
6043
+ throw new AuthenticationError('User is not authenticated');
6044
+ }
6045
+ const response = await this.apiClient.getOrderFills(orderId, filter);
6046
+ return response.response_data;
6047
+ }
6048
+ /**
6049
+ * Get order events for a specific order
6050
+ * @param orderId - The order ID
6051
+ * @param filter - Optional filter parameters
6052
+ * @returns Promise with order events response
6053
+ */
6054
+ async getOrderEvents(orderId, filter) {
6055
+ if (!(await this.isAuthenticated())) {
6056
+ throw new AuthenticationError('User is not authenticated');
6057
+ }
6058
+ const response = await this.apiClient.getOrderEvents(orderId, filter);
6059
+ return response.response_data;
6060
+ }
6061
+ /**
6062
+ * Get order groups
6063
+ * @param filter - Optional filter parameters
6064
+ * @returns Promise with order groups response
6065
+ */
6066
+ async getOrderGroups(filter) {
6067
+ if (!(await this.isAuthenticated())) {
6068
+ throw new AuthenticationError('User is not authenticated');
6069
+ }
6070
+ const response = await this.apiClient.getOrderGroups(filter);
6071
+ return response.response_data;
6072
+ }
6073
+ /**
6074
+ * Get position lots (tax lots for positions)
6075
+ * @param filter - Optional filter parameters
6076
+ * @returns Promise with position lots response
6077
+ */
6078
+ async getPositionLots(filter) {
6079
+ if (!(await this.isAuthenticated())) {
6080
+ throw new AuthenticationError('User is not authenticated');
6081
+ }
6082
+ const response = await this.apiClient.getPositionLots(filter);
6083
+ return response.response_data;
6084
+ }
6085
+ /**
6086
+ * Get position lot fills for a specific lot
6087
+ * @param lotId - The position lot ID
6088
+ * @param filter - Optional filter parameters
6089
+ * @returns Promise with position lot fills response
6090
+ */
6091
+ async getPositionLotFills(lotId, filter) {
6092
+ if (!(await this.isAuthenticated())) {
6093
+ throw new AuthenticationError('User is not authenticated');
6094
+ }
6095
+ const response = await this.apiClient.getPositionLotFills(lotId, filter);
6096
+ return response.response_data;
6097
+ }
5886
6098
  }
5887
6099
  FinaticConnect.instance = null;
5888
6100