@cranberry-money/shared-services 1.4.0 → 1.6.0
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.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/services/cash_accounts/constants.d.ts +7 -0
- package/dist/services/cash_accounts/constants.d.ts.map +1 -0
- package/dist/services/cash_accounts/constants.js +7 -0
- package/dist/services/cash_accounts/index.d.ts +5 -0
- package/dist/services/cash_accounts/index.d.ts.map +1 -0
- package/dist/services/cash_accounts/index.js +6 -0
- package/dist/services/cash_accounts/service.d.ts +8 -0
- package/dist/services/cash_accounts/service.d.ts.map +1 -0
- package/dist/services/cash_accounts/service.js +32 -0
- package/dist/services/cash_accounts/transactions/constants.d.ts +18 -0
- package/dist/services/cash_accounts/transactions/constants.d.ts.map +1 -0
- package/dist/services/cash_accounts/transactions/constants.js +25 -0
- package/dist/services/cash_accounts/transactions/index.d.ts +4 -0
- package/dist/services/cash_accounts/transactions/index.d.ts.map +1 -0
- package/dist/services/cash_accounts/transactions/index.js +4 -0
- package/dist/services/cash_accounts/transactions/service.d.ts +12 -0
- package/dist/services/cash_accounts/transactions/service.d.ts.map +1 -0
- package/dist/services/cash_accounts/transactions/service.js +66 -0
- package/dist/services/cash_accounts/transactions/types.d.ts +38 -0
- package/dist/services/cash_accounts/transactions/types.d.ts.map +1 -0
- package/dist/services/cash_accounts/transactions/types.js +11 -0
- package/dist/services/cash_accounts/types.d.ts +24 -0
- package/dist/services/cash_accounts/types.d.ts.map +1 -0
- package/dist/services/cash_accounts/types.js +4 -0
- package/dist/services/trades/constants.d.ts +47 -0
- package/dist/services/trades/constants.d.ts.map +1 -0
- package/dist/services/trades/constants.js +61 -0
- package/dist/services/trades/index.d.ts +4 -0
- package/dist/services/trades/index.d.ts.map +1 -0
- package/dist/services/trades/index.js +12 -0
- package/dist/services/trades/service.d.ts +19 -0
- package/dist/services/trades/service.d.ts.map +1 -0
- package/dist/services/trades/service.js +177 -0
- package/dist/services/trades/types.d.ts +114 -0
- package/dist/services/trades/types.d.ts.map +1 -0
- package/dist/services/trades/types.js +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,8 +14,10 @@ export * from './services/AuthService';
|
|
|
14
14
|
export * from './services/PortfolioService';
|
|
15
15
|
export * as AccountsService from './services/accounts';
|
|
16
16
|
export * as AuthService from './services/auth';
|
|
17
|
+
export * as CashAccountsService from './services/cash_accounts';
|
|
17
18
|
export * as PortfoliosService from './services/portfolios';
|
|
18
19
|
export * as UsersService from './services/users';
|
|
20
|
+
export * as TradesService from './services/trades';
|
|
19
21
|
export * from './query/QueryClient';
|
|
20
22
|
export * from './query/useAuth';
|
|
21
23
|
export * from './query/usePortfolios';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAG3C,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAGrB,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAG5C,OAAO,KAAK,eAAe,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,WAAW,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,iBAAiB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAG3C,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAGrB,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAG5C,OAAO,KAAK,eAAe,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,WAAW,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,iBAAiB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,aAAa,MAAM,mBAAmB,CAAC;AAGnD,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -18,8 +18,10 @@ export * from './services/PortfolioService';
|
|
|
18
18
|
// New functional domain services
|
|
19
19
|
export * as AccountsService from './services/accounts';
|
|
20
20
|
export * as AuthService from './services/auth';
|
|
21
|
+
export * as CashAccountsService from './services/cash_accounts';
|
|
21
22
|
export * as PortfoliosService from './services/portfolios';
|
|
22
23
|
export * as UsersService from './services/users';
|
|
24
|
+
export * as TradesService from './services/trades';
|
|
23
25
|
// React Query integration
|
|
24
26
|
export * from './query/QueryClient';
|
|
25
27
|
export * from './query/useAuth';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/services/cash_accounts/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,aAAa;;CAEhB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { CashAccount, CashAccountQueryParams, CurrencyCode, PaginatedCashAccounts, } from './types';
|
|
2
|
+
export { getCashAccounts, getCashAccountByUuid, getAccountCashAccounts, } from './service';
|
|
3
|
+
export { API_ENDPOINTS } from './constants';
|
|
4
|
+
export * as Transactions from './transactions';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/cash_accounts/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,WAAW,EACX,sBAAsB,EACtB,YAAY,EACZ,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Export service functions
|
|
2
|
+
export { getCashAccounts, getCashAccountByUuid, getAccountCashAccounts, } from './service';
|
|
3
|
+
// Export constants
|
|
4
|
+
export { API_ENDPOINTS } from './constants';
|
|
5
|
+
// Export transactions sub-service as namespace
|
|
6
|
+
export * as Transactions from './transactions';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cash account API service functions.
|
|
3
|
+
*/
|
|
4
|
+
import type { CashAccount, CashAccountQueryParams, PaginatedCashAccounts } from './types';
|
|
5
|
+
export declare const getCashAccounts: (params?: CashAccountQueryParams) => Promise<import("axios").AxiosResponse<PaginatedCashAccounts, any>>;
|
|
6
|
+
export declare const getCashAccountByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<CashAccount, any>>;
|
|
7
|
+
export declare const getAccountCashAccounts: (accountUuid: string) => Promise<import("axios").AxiosResponse<PaginatedCashAccounts, any>>;
|
|
8
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/services/cash_accounts/service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE1F,eAAO,MAAM,eAAe,GAAI,SAAS,sBAAsB,uEAsB9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,6DAEhD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,aAAa,MAAM,uEAEzD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cash account API service functions.
|
|
3
|
+
*/
|
|
4
|
+
import { webApiClient } from '../../api/apiClient';
|
|
5
|
+
import { API_ENDPOINTS } from './constants';
|
|
6
|
+
export const getCashAccounts = (params) => {
|
|
7
|
+
const queryParams = {};
|
|
8
|
+
if (params?.account) {
|
|
9
|
+
queryParams.account = params.account;
|
|
10
|
+
}
|
|
11
|
+
if (params?.currency) {
|
|
12
|
+
queryParams.currency = params.currency;
|
|
13
|
+
}
|
|
14
|
+
if (params?.minBalance !== undefined) {
|
|
15
|
+
queryParams.min_balance = params.minBalance.toString();
|
|
16
|
+
}
|
|
17
|
+
if (params?.maxBalance !== undefined) {
|
|
18
|
+
queryParams.max_balance = params.maxBalance.toString();
|
|
19
|
+
}
|
|
20
|
+
if (params?.ordering) {
|
|
21
|
+
queryParams.ordering = params.ordering;
|
|
22
|
+
}
|
|
23
|
+
return webApiClient.get(API_ENDPOINTS.CASH_ACCOUNTS, {
|
|
24
|
+
params: queryParams,
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
export const getCashAccountByUuid = (uuid) => {
|
|
28
|
+
return webApiClient.get(`${API_ENDPOINTS.CASH_ACCOUNTS}${uuid}/`);
|
|
29
|
+
};
|
|
30
|
+
export const getAccountCashAccounts = (accountUuid) => {
|
|
31
|
+
return getCashAccounts({ account: accountUuid });
|
|
32
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cash account transaction constants.
|
|
3
|
+
*/
|
|
4
|
+
export declare const TRANSACTION_TYPE_LABEL_DEPOSIT = "Deposit";
|
|
5
|
+
export declare const TRANSACTION_TYPE_LABEL_WITHDRAWAL = "Withdrawal";
|
|
6
|
+
export declare const TRANSACTION_TYPE_LABEL_TRADE_SETTLEMENT = "Trade Settlement";
|
|
7
|
+
export declare const TRANSACTION_TYPE_LABEL_DISTRIBUTION = "Distribution";
|
|
8
|
+
export declare const TRANSACTION_TYPE_LABEL_FEE = "Fee";
|
|
9
|
+
export declare const TRANSACTION_TYPE_LABEL_INTEREST = "Interest";
|
|
10
|
+
export declare const TRANSACTION_TYPE_LABEL_OTHER = "Adjustment";
|
|
11
|
+
export declare const TRANSACTION_TYPE_OPTIONS: {
|
|
12
|
+
value: string;
|
|
13
|
+
label: string;
|
|
14
|
+
}[];
|
|
15
|
+
export declare const API_ENDPOINTS: {
|
|
16
|
+
readonly CASH_ACCOUNT_TRANSACTIONS: "/api/cash-account-transactions/";
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/services/cash_accounts/transactions/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,8BAA8B,YAAY,CAAC;AACxD,eAAO,MAAM,iCAAiC,eAAe,CAAC;AAC9D,eAAO,MAAM,uCAAuC,qBAAqB,CAAC;AAC1E,eAAO,MAAM,mCAAmC,iBAAiB,CAAC;AAClE,eAAO,MAAM,0BAA0B,QAAQ,CAAC;AAChD,eAAO,MAAM,+BAA+B,aAAa,CAAC;AAC1D,eAAO,MAAM,4BAA4B,eAAe,CAAC;AAGzD,eAAO,MAAM,wBAAwB;;;GAQpC,CAAC;AAGF,eAAO,MAAM,aAAa;;CAEhB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cash account transaction constants.
|
|
3
|
+
*/
|
|
4
|
+
// Transaction Type label constants
|
|
5
|
+
export const TRANSACTION_TYPE_LABEL_DEPOSIT = 'Deposit';
|
|
6
|
+
export const TRANSACTION_TYPE_LABEL_WITHDRAWAL = 'Withdrawal';
|
|
7
|
+
export const TRANSACTION_TYPE_LABEL_TRADE_SETTLEMENT = 'Trade Settlement';
|
|
8
|
+
export const TRANSACTION_TYPE_LABEL_DISTRIBUTION = 'Distribution';
|
|
9
|
+
export const TRANSACTION_TYPE_LABEL_FEE = 'Fee';
|
|
10
|
+
export const TRANSACTION_TYPE_LABEL_INTEREST = 'Interest';
|
|
11
|
+
export const TRANSACTION_TYPE_LABEL_OTHER = 'Adjustment';
|
|
12
|
+
// Transaction Type options
|
|
13
|
+
export const TRANSACTION_TYPE_OPTIONS = [
|
|
14
|
+
{ value: 'DEPOSIT', label: TRANSACTION_TYPE_LABEL_DEPOSIT },
|
|
15
|
+
{ value: 'WITHDRAWAL', label: TRANSACTION_TYPE_LABEL_WITHDRAWAL },
|
|
16
|
+
{ value: 'TRADE_SETTLEMENT', label: TRANSACTION_TYPE_LABEL_TRADE_SETTLEMENT },
|
|
17
|
+
{ value: 'DISTRIBUTION', label: TRANSACTION_TYPE_LABEL_DISTRIBUTION },
|
|
18
|
+
{ value: 'FEE', label: TRANSACTION_TYPE_LABEL_FEE },
|
|
19
|
+
{ value: 'INTEREST', label: TRANSACTION_TYPE_LABEL_INTEREST },
|
|
20
|
+
{ value: 'OTHER', label: TRANSACTION_TYPE_LABEL_OTHER },
|
|
21
|
+
];
|
|
22
|
+
// API Endpoints
|
|
23
|
+
export const API_ENDPOINTS = {
|
|
24
|
+
CASH_ACCOUNT_TRANSACTIONS: '/api/cash-account-transactions/',
|
|
25
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { CashAccountTransaction, CashAccountTransactionQueryParams, TransactionSummary, TransactionType, PaginatedCashAccountTransactions, TRANSACTION_TYPE_DEPOSIT, TRANSACTION_TYPE_WITHDRAWAL, TRANSACTION_TYPE_TRADE_SETTLEMENT, TRANSACTION_TYPE_DISTRIBUTION, TRANSACTION_TYPE_FEE, TRANSACTION_TYPE_INTEREST, TRANSACTION_TYPE_OTHER, } from './types';
|
|
2
|
+
export { getCashAccountTransactions, getCashAccountTransactionByUuid, getCashAccountTransactionsByAccount, getTransactionsByDateRange, getRecentTransactions, getTransactionTypeLabel, } from './service';
|
|
3
|
+
export { TRANSACTION_TYPE_LABEL_DEPOSIT, TRANSACTION_TYPE_LABEL_WITHDRAWAL, TRANSACTION_TYPE_LABEL_TRADE_SETTLEMENT, TRANSACTION_TYPE_LABEL_DISTRIBUTION, TRANSACTION_TYPE_LABEL_FEE, TRANSACTION_TYPE_LABEL_INTEREST, TRANSACTION_TYPE_LABEL_OTHER, TRANSACTION_TYPE_OPTIONS, } from './constants';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/cash_accounts/transactions/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,sBAAsB,EACtB,iCAAiC,EACjC,kBAAkB,EAClB,eAAe,EACf,gCAAgC,EAChC,wBAAwB,EACxB,2BAA2B,EAC3B,iCAAiC,EACjC,6BAA6B,EAC7B,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,EAC/B,mCAAmC,EACnC,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,8BAA8B,EAC9B,iCAAiC,EACjC,uCAAuC,EACvC,mCAAmC,EACnC,0BAA0B,EAC1B,+BAA+B,EAC/B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Export service functions
|
|
2
|
+
export { getCashAccountTransactions, getCashAccountTransactionByUuid, getCashAccountTransactionsByAccount, getTransactionsByDateRange, getRecentTransactions, getTransactionTypeLabel, } from './service';
|
|
3
|
+
// Export constants
|
|
4
|
+
export { TRANSACTION_TYPE_LABEL_DEPOSIT, TRANSACTION_TYPE_LABEL_WITHDRAWAL, TRANSACTION_TYPE_LABEL_TRADE_SETTLEMENT, TRANSACTION_TYPE_LABEL_DISTRIBUTION, TRANSACTION_TYPE_LABEL_FEE, TRANSACTION_TYPE_LABEL_INTEREST, TRANSACTION_TYPE_LABEL_OTHER, TRANSACTION_TYPE_OPTIONS, } from './constants';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cash account transaction API service functions.
|
|
3
|
+
*/
|
|
4
|
+
import type { CashAccountTransaction, CashAccountTransactionQueryParams, PaginatedCashAccountTransactions, TransactionType } from './types';
|
|
5
|
+
export declare const getCashAccountTransactions: (params?: CashAccountTransactionQueryParams) => Promise<import("axios").AxiosResponse<PaginatedCashAccountTransactions, any>>;
|
|
6
|
+
export declare const getCashAccountTransactionByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<CashAccountTransaction, any>>;
|
|
7
|
+
export declare const getCashAccountTransactionsByAccount: (cashAccountUuid: string, params?: Omit<CashAccountTransactionQueryParams, "cashAccount">) => Promise<import("axios").AxiosResponse<PaginatedCashAccountTransactions, any>>;
|
|
8
|
+
export declare const getTransactionsByDateRange: (startDate: string, endDate: string, params?: Omit<CashAccountTransactionQueryParams, "startDate" | "endDate">) => Promise<import("axios").AxiosResponse<PaginatedCashAccountTransactions, any>>;
|
|
9
|
+
export declare const getRecentTransactions: (days?: number, // Default to 30 days for recent transactions
|
|
10
|
+
params?: CashAccountTransactionQueryParams) => Promise<import("axios").AxiosResponse<PaginatedCashAccountTransactions, any>>;
|
|
11
|
+
export declare const getTransactionTypeLabel: (transactionType: TransactionType) => string;
|
|
12
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/cash_accounts/transactions/service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EACV,sBAAsB,EACtB,iCAAiC,EACjC,gCAAgC,EAChC,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,0BAA0B,GAAI,SAAS,iCAAiC,kFA4BpF,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,MAAM,MAAM,wEAE3D,CAAC;AAEF,eAAO,MAAM,mCAAmC,GAC9C,iBAAiB,MAAM,EACvB,SAAS,IAAI,CAAC,iCAAiC,EAAE,aAAa,CAAC,kFAMhE,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,WAAW,MAAM,EACjB,SAAS,MAAM,EACf,SAAS,IAAI,CAAC,iCAAiC,EAAE,WAAW,GAAG,SAAS,CAAC,kFAO1E,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,OAAM,MAAW,EAAE,6CAA6C;AAChE,SAAS,iCAAiC,kFAM3C,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,iBAAiB,eAAe,KAAG,MAY1E,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cash account transaction API service functions.
|
|
3
|
+
*/
|
|
4
|
+
import { webApiClient } from '../../../api/apiClient';
|
|
5
|
+
import { API_ENDPOINTS } from './constants';
|
|
6
|
+
export const getCashAccountTransactions = (params) => {
|
|
7
|
+
const queryParams = {};
|
|
8
|
+
if (params?.cashAccount) {
|
|
9
|
+
queryParams.cash_account = params.cashAccount;
|
|
10
|
+
}
|
|
11
|
+
if (params?.transactionType) {
|
|
12
|
+
queryParams.transaction_type = params.transactionType;
|
|
13
|
+
}
|
|
14
|
+
if (params?.startDate) {
|
|
15
|
+
queryParams.start_date = params.startDate;
|
|
16
|
+
}
|
|
17
|
+
if (params?.endDate) {
|
|
18
|
+
queryParams.end_date = params.endDate;
|
|
19
|
+
}
|
|
20
|
+
if (params?.minAmount !== undefined) {
|
|
21
|
+
queryParams.min_amount = params.minAmount.toString();
|
|
22
|
+
}
|
|
23
|
+
if (params?.maxAmount !== undefined) {
|
|
24
|
+
queryParams.max_amount = params.maxAmount.toString();
|
|
25
|
+
}
|
|
26
|
+
if (params?.orderBy) {
|
|
27
|
+
queryParams.order_by = params.orderBy;
|
|
28
|
+
}
|
|
29
|
+
return webApiClient.get(API_ENDPOINTS.CASH_ACCOUNT_TRANSACTIONS, {
|
|
30
|
+
params: queryParams,
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
export const getCashAccountTransactionByUuid = (uuid) => {
|
|
34
|
+
return webApiClient.get(`${API_ENDPOINTS.CASH_ACCOUNT_TRANSACTIONS}${uuid}/`);
|
|
35
|
+
};
|
|
36
|
+
export const getCashAccountTransactionsByAccount = (cashAccountUuid, params) => {
|
|
37
|
+
return getCashAccountTransactions({
|
|
38
|
+
...params,
|
|
39
|
+
cashAccount: cashAccountUuid,
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
export const getTransactionsByDateRange = (startDate, endDate, params) => {
|
|
43
|
+
return getCashAccountTransactions({
|
|
44
|
+
...params,
|
|
45
|
+
startDate,
|
|
46
|
+
endDate,
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
export const getRecentTransactions = (days = 30, // Default to 30 days for recent transactions
|
|
50
|
+
params) => {
|
|
51
|
+
const endDate = new Date().toISOString().split('T')[0];
|
|
52
|
+
const startDate = new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString().split('T')[0];
|
|
53
|
+
return getTransactionsByDateRange(startDate, endDate, params);
|
|
54
|
+
};
|
|
55
|
+
export const getTransactionTypeLabel = (transactionType) => {
|
|
56
|
+
const labels = {
|
|
57
|
+
DEPOSIT: 'Deposit',
|
|
58
|
+
WITHDRAWAL: 'Withdrawal',
|
|
59
|
+
TRADE_SETTLEMENT: 'Trade Settlement',
|
|
60
|
+
DISTRIBUTION: 'Distribution',
|
|
61
|
+
FEE: 'Fee',
|
|
62
|
+
INTEREST: 'Interest',
|
|
63
|
+
OTHER: 'Adjustment',
|
|
64
|
+
};
|
|
65
|
+
return labels[transactionType];
|
|
66
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cash account transaction types and interfaces.
|
|
3
|
+
*/
|
|
4
|
+
import type { PaginatedResponse } from '../../../api/types';
|
|
5
|
+
export type { PaginatedResponse } from '../../../api/types';
|
|
6
|
+
export declare const TRANSACTION_TYPE_DEPOSIT = "DEPOSIT";
|
|
7
|
+
export declare const TRANSACTION_TYPE_WITHDRAWAL = "WITHDRAWAL";
|
|
8
|
+
export declare const TRANSACTION_TYPE_TRADE_SETTLEMENT = "TRADE_SETTLEMENT";
|
|
9
|
+
export declare const TRANSACTION_TYPE_DISTRIBUTION = "DISTRIBUTION";
|
|
10
|
+
export declare const TRANSACTION_TYPE_FEE = "FEE";
|
|
11
|
+
export declare const TRANSACTION_TYPE_INTEREST = "INTEREST";
|
|
12
|
+
export declare const TRANSACTION_TYPE_OTHER = "OTHER";
|
|
13
|
+
export type TransactionType = typeof TRANSACTION_TYPE_DEPOSIT | typeof TRANSACTION_TYPE_WITHDRAWAL | typeof TRANSACTION_TYPE_TRADE_SETTLEMENT | typeof TRANSACTION_TYPE_DISTRIBUTION | typeof TRANSACTION_TYPE_FEE | typeof TRANSACTION_TYPE_INTEREST | typeof TRANSACTION_TYPE_OTHER;
|
|
14
|
+
export interface CashAccountTransaction {
|
|
15
|
+
uuid: string;
|
|
16
|
+
cashAccount: string;
|
|
17
|
+
amount: string;
|
|
18
|
+
date: string;
|
|
19
|
+
transactionType: TransactionType;
|
|
20
|
+
reference: string;
|
|
21
|
+
}
|
|
22
|
+
export interface CashAccountTransactionQueryParams {
|
|
23
|
+
cashAccount?: string;
|
|
24
|
+
transactionType?: TransactionType;
|
|
25
|
+
startDate?: string;
|
|
26
|
+
endDate?: string;
|
|
27
|
+
minAmount?: number;
|
|
28
|
+
maxAmount?: number;
|
|
29
|
+
orderBy?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface TransactionSummary {
|
|
32
|
+
totalDeposits: number;
|
|
33
|
+
totalWithdrawals: number;
|
|
34
|
+
netAmount: number;
|
|
35
|
+
transactionCount: number;
|
|
36
|
+
}
|
|
37
|
+
export type PaginatedCashAccountTransactions = PaginatedResponse<CashAccountTransaction>;
|
|
38
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/services/cash_accounts/transactions/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,eAAO,MAAM,wBAAwB,YAAY,CAAC;AAClD,eAAO,MAAM,2BAA2B,eAAe,CAAC;AACxD,eAAO,MAAM,iCAAiC,qBAAqB,CAAC;AACpE,eAAO,MAAM,6BAA6B,iBAAiB,CAAC;AAC5D,eAAO,MAAM,oBAAoB,QAAQ,CAAC;AAC1C,eAAO,MAAM,yBAAyB,aAAa,CAAC;AACpD,eAAO,MAAM,sBAAsB,UAAU,CAAC;AAE9C,MAAM,MAAM,eAAe,GACvB,OAAO,wBAAwB,GAC/B,OAAO,2BAA2B,GAClC,OAAO,iCAAiC,GACxC,OAAO,6BAA6B,GACpC,OAAO,oBAAoB,GAC3B,OAAO,yBAAyB,GAChC,OAAO,sBAAsB,CAAC;AAElC,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,eAAe,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iCAAiC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAGD,MAAM,MAAM,gCAAgC,GAAG,iBAAiB,CAAC,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cash account transaction types and interfaces.
|
|
3
|
+
*/
|
|
4
|
+
// Transaction type constants
|
|
5
|
+
export const TRANSACTION_TYPE_DEPOSIT = 'DEPOSIT';
|
|
6
|
+
export const TRANSACTION_TYPE_WITHDRAWAL = 'WITHDRAWAL';
|
|
7
|
+
export const TRANSACTION_TYPE_TRADE_SETTLEMENT = 'TRADE_SETTLEMENT';
|
|
8
|
+
export const TRANSACTION_TYPE_DISTRIBUTION = 'DISTRIBUTION';
|
|
9
|
+
export const TRANSACTION_TYPE_FEE = 'FEE';
|
|
10
|
+
export const TRANSACTION_TYPE_INTEREST = 'INTEREST';
|
|
11
|
+
export const TRANSACTION_TYPE_OTHER = 'OTHER';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cash account types and interfaces.
|
|
3
|
+
*/
|
|
4
|
+
import type { PaginatedResponse } from '../../api/types';
|
|
5
|
+
export type { PaginatedResponse } from '../../api/types';
|
|
6
|
+
export type CurrencyCode = 'AUD' | 'USD' | 'EUR' | 'GBP' | 'CAD' | 'NZD' | 'SGD' | 'HKD' | 'JPY';
|
|
7
|
+
export interface CashAccount {
|
|
8
|
+
uuid: string;
|
|
9
|
+
account: string;
|
|
10
|
+
accountNumber: string;
|
|
11
|
+
bsb?: string;
|
|
12
|
+
payid?: string;
|
|
13
|
+
currency: CurrencyCode;
|
|
14
|
+
balance: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CashAccountQueryParams {
|
|
17
|
+
account?: string;
|
|
18
|
+
currency?: CurrencyCode;
|
|
19
|
+
minBalance?: number;
|
|
20
|
+
maxBalance?: number;
|
|
21
|
+
ordering?: string;
|
|
22
|
+
}
|
|
23
|
+
export type PaginatedCashAccounts = PaginatedResponse<CashAccount>;
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/cash_accounts/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAEjG,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trade-related constants for the shared services package.
|
|
3
|
+
*
|
|
4
|
+
* These constants should match the backend constants in bilberry/trades/constants.py
|
|
5
|
+
* to ensure consistency across the application stack.
|
|
6
|
+
*/
|
|
7
|
+
export declare const TARGET_TRADE_STATUS_PENDING = "PENDING";
|
|
8
|
+
export declare const TARGET_TRADE_STATUS_APPROVED = "APPROVED";
|
|
9
|
+
export declare const TARGET_TRADE_STATUS_SUBMITTED = "SUBMITTED";
|
|
10
|
+
export declare const TARGET_TRADE_STATUS_CANCELLED = "CANCELLED";
|
|
11
|
+
export declare const TARGET_TRADE_STATUS_EXPIRED = "EXPIRED";
|
|
12
|
+
export declare const TARGET_TRADE_STATUS_LABEL_PENDING = "Pending Submission";
|
|
13
|
+
export declare const TARGET_TRADE_STATUS_LABEL_APPROVED = "Approved";
|
|
14
|
+
export declare const TARGET_TRADE_STATUS_LABEL_SUBMITTED = "Submitted to Broker";
|
|
15
|
+
export declare const TARGET_TRADE_STATUS_LABEL_CANCELLED = "Cancelled";
|
|
16
|
+
export declare const TARGET_TRADE_STATUS_LABEL_EXPIRED = "Expired";
|
|
17
|
+
export declare const TARGET_TRADE_STATUS_OPTIONS: {
|
|
18
|
+
value: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}[];
|
|
21
|
+
export declare const TRADE_ACTION_BUY = "BUY";
|
|
22
|
+
export declare const TRADE_ACTION_SELL = "SELL";
|
|
23
|
+
export declare const TRADE_ACTION_LABEL_BUY = "Buy";
|
|
24
|
+
export declare const TRADE_ACTION_LABEL_SELL = "Sell";
|
|
25
|
+
export declare const TRADE_ACTION_OPTIONS: {
|
|
26
|
+
value: string;
|
|
27
|
+
label: string;
|
|
28
|
+
}[];
|
|
29
|
+
export declare const TRADE_STATUS_EXECUTED = "EXECUTED";
|
|
30
|
+
export declare const TRADE_STATUS_SETTLED = "SETTLED";
|
|
31
|
+
export declare const TRADE_STATUS_CANCELLED = "CANCELLED";
|
|
32
|
+
export declare const TRADE_STATUS_FAILED = "FAILED";
|
|
33
|
+
export declare const TRADE_STATUS_LABEL_EXECUTED = "Executed";
|
|
34
|
+
export declare const TRADE_STATUS_LABEL_SETTLED = "Settled";
|
|
35
|
+
export declare const TRADE_STATUS_LABEL_CANCELLED = "Cancelled";
|
|
36
|
+
export declare const TRADE_STATUS_LABEL_FAILED = "Failed";
|
|
37
|
+
export declare const TRADE_STATUS_OPTIONS: {
|
|
38
|
+
value: string;
|
|
39
|
+
label: string;
|
|
40
|
+
}[];
|
|
41
|
+
export declare const API_ENDPOINTS: {
|
|
42
|
+
readonly TRADES: "/api/trades/";
|
|
43
|
+
readonly TARGET_TRADES: "/api/target-trades/";
|
|
44
|
+
readonly TRADE_SHEETS: "/api/trade-sheets/";
|
|
45
|
+
readonly TARGET_TRADE_SHEETS: "/api/target-trade-sheets/";
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/services/trades/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,eAAO,MAAM,2BAA2B,YAAY,CAAC;AACrD,eAAO,MAAM,4BAA4B,aAAa,CAAC;AACvD,eAAO,MAAM,6BAA6B,cAAc,CAAC;AACzD,eAAO,MAAM,6BAA6B,cAAc,CAAC;AACzD,eAAO,MAAM,2BAA2B,YAAY,CAAC;AAGrD,eAAO,MAAM,iCAAiC,uBAAuB,CAAC;AACtE,eAAO,MAAM,kCAAkC,aAAa,CAAC;AAC7D,eAAO,MAAM,mCAAmC,wBAAwB,CAAC;AACzE,eAAO,MAAM,mCAAmC,cAAc,CAAC;AAC/D,eAAO,MAAM,iCAAiC,YAAY,CAAC;AAG3D,eAAO,MAAM,2BAA2B;;;GAMvC,CAAC;AAGF,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AACtC,eAAO,MAAM,iBAAiB,SAAS,CAAC;AAGxC,eAAO,MAAM,sBAAsB,QAAQ,CAAC;AAC5C,eAAO,MAAM,uBAAuB,SAAS,CAAC;AAG9C,eAAO,MAAM,oBAAoB;;;GAGhC,CAAC;AAGF,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAChD,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,sBAAsB,cAAc,CAAC;AAClD,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAG5C,eAAO,MAAM,2BAA2B,aAAa,CAAC;AACtD,eAAO,MAAM,0BAA0B,YAAY,CAAC;AACpD,eAAO,MAAM,4BAA4B,cAAc,CAAC;AACxD,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAGlD,eAAO,MAAM,oBAAoB;;;GAKhC,CAAC;AAGF,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trade-related constants for the shared services package.
|
|
3
|
+
*
|
|
4
|
+
* These constants should match the backend constants in bilberry/trades/constants.py
|
|
5
|
+
* to ensure consistency across the application stack.
|
|
6
|
+
*/
|
|
7
|
+
// Target Trade Status constants - matching backend constants
|
|
8
|
+
export const TARGET_TRADE_STATUS_PENDING = 'PENDING';
|
|
9
|
+
export const TARGET_TRADE_STATUS_APPROVED = 'APPROVED';
|
|
10
|
+
export const TARGET_TRADE_STATUS_SUBMITTED = 'SUBMITTED';
|
|
11
|
+
export const TARGET_TRADE_STATUS_CANCELLED = 'CANCELLED';
|
|
12
|
+
export const TARGET_TRADE_STATUS_EXPIRED = 'EXPIRED';
|
|
13
|
+
// Target Trade Status label constants
|
|
14
|
+
export const TARGET_TRADE_STATUS_LABEL_PENDING = 'Pending Submission';
|
|
15
|
+
export const TARGET_TRADE_STATUS_LABEL_APPROVED = 'Approved';
|
|
16
|
+
export const TARGET_TRADE_STATUS_LABEL_SUBMITTED = 'Submitted to Broker';
|
|
17
|
+
export const TARGET_TRADE_STATUS_LABEL_CANCELLED = 'Cancelled';
|
|
18
|
+
export const TARGET_TRADE_STATUS_LABEL_EXPIRED = 'Expired';
|
|
19
|
+
// Target Trade Status options
|
|
20
|
+
export const TARGET_TRADE_STATUS_OPTIONS = [
|
|
21
|
+
{ value: TARGET_TRADE_STATUS_PENDING, label: TARGET_TRADE_STATUS_LABEL_PENDING },
|
|
22
|
+
{ value: TARGET_TRADE_STATUS_APPROVED, label: TARGET_TRADE_STATUS_LABEL_APPROVED },
|
|
23
|
+
{ value: TARGET_TRADE_STATUS_SUBMITTED, label: TARGET_TRADE_STATUS_LABEL_SUBMITTED },
|
|
24
|
+
{ value: TARGET_TRADE_STATUS_CANCELLED, label: TARGET_TRADE_STATUS_LABEL_CANCELLED },
|
|
25
|
+
{ value: TARGET_TRADE_STATUS_EXPIRED, label: TARGET_TRADE_STATUS_LABEL_EXPIRED },
|
|
26
|
+
];
|
|
27
|
+
// Trade Action constants
|
|
28
|
+
export const TRADE_ACTION_BUY = 'BUY';
|
|
29
|
+
export const TRADE_ACTION_SELL = 'SELL';
|
|
30
|
+
// Trade Action label constants
|
|
31
|
+
export const TRADE_ACTION_LABEL_BUY = 'Buy';
|
|
32
|
+
export const TRADE_ACTION_LABEL_SELL = 'Sell';
|
|
33
|
+
// Trade Action options
|
|
34
|
+
export const TRADE_ACTION_OPTIONS = [
|
|
35
|
+
{ value: TRADE_ACTION_BUY, label: TRADE_ACTION_LABEL_BUY },
|
|
36
|
+
{ value: TRADE_ACTION_SELL, label: TRADE_ACTION_LABEL_SELL },
|
|
37
|
+
];
|
|
38
|
+
// Trade Status constants (for executed trades)
|
|
39
|
+
export const TRADE_STATUS_EXECUTED = 'EXECUTED';
|
|
40
|
+
export const TRADE_STATUS_SETTLED = 'SETTLED';
|
|
41
|
+
export const TRADE_STATUS_CANCELLED = 'CANCELLED';
|
|
42
|
+
export const TRADE_STATUS_FAILED = 'FAILED';
|
|
43
|
+
// Trade Status label constants
|
|
44
|
+
export const TRADE_STATUS_LABEL_EXECUTED = 'Executed';
|
|
45
|
+
export const TRADE_STATUS_LABEL_SETTLED = 'Settled';
|
|
46
|
+
export const TRADE_STATUS_LABEL_CANCELLED = 'Cancelled';
|
|
47
|
+
export const TRADE_STATUS_LABEL_FAILED = 'Failed';
|
|
48
|
+
// Trade Status options
|
|
49
|
+
export const TRADE_STATUS_OPTIONS = [
|
|
50
|
+
{ value: TRADE_STATUS_EXECUTED, label: TRADE_STATUS_LABEL_EXECUTED },
|
|
51
|
+
{ value: TRADE_STATUS_SETTLED, label: TRADE_STATUS_LABEL_SETTLED },
|
|
52
|
+
{ value: TRADE_STATUS_CANCELLED, label: TRADE_STATUS_LABEL_CANCELLED },
|
|
53
|
+
{ value: TRADE_STATUS_FAILED, label: TRADE_STATUS_LABEL_FAILED },
|
|
54
|
+
];
|
|
55
|
+
// API Endpoints
|
|
56
|
+
export const API_ENDPOINTS = {
|
|
57
|
+
TRADES: '/api/trades/',
|
|
58
|
+
TARGET_TRADES: '/api/target-trades/',
|
|
59
|
+
TRADE_SHEETS: '/api/trade-sheets/',
|
|
60
|
+
TARGET_TRADE_SHEETS: '/api/target-trade-sheets/',
|
|
61
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { TargetTrade, TargetTradeSheet, Trade, TradeSheet, TargetTradePayload, TargetTradeSheetPayload, TargetTradeQueryParams, TargetTradeSheetQueryParams, TradeQueryParams, TradeSheetQueryParams, TargetTradeSheetApprovalResponse, TargetTradeSheetCleanResponse, PaginatedTargetTrades, PaginatedTargetTradeSheets, PaginatedTrades, PaginatedTradeSheets, TradeAction, TargetTradeStatus, TradeStatus, } from './types';
|
|
2
|
+
export { getTargetTrades, getTargetTradeByUuid, createTargetTrade, updateTargetTrade, deleteTargetTrade, getTargetTradeSheets, getTargetTradeSheetByUuid, createTargetTradeSheet, updateTargetTradeSheet, deleteTargetTradeSheet, approveTargetTradeSheet, cleanTargetTradeSheet, getOrCreateDraftTargetTradeSheet, getTrades, getTradeByUuid, getTradeSheets, getTradeSheetByUuid, } from './service';
|
|
3
|
+
export { TARGET_TRADE_STATUS_PENDING, TARGET_TRADE_STATUS_APPROVED, TARGET_TRADE_STATUS_SUBMITTED, TARGET_TRADE_STATUS_CANCELLED, TARGET_TRADE_STATUS_EXPIRED, TARGET_TRADE_STATUS_LABEL_PENDING, TARGET_TRADE_STATUS_LABEL_APPROVED, TARGET_TRADE_STATUS_LABEL_SUBMITTED, TARGET_TRADE_STATUS_LABEL_CANCELLED, TARGET_TRADE_STATUS_LABEL_EXPIRED, TARGET_TRADE_STATUS_OPTIONS, TRADE_ACTION_BUY, TRADE_ACTION_SELL, TRADE_ACTION_LABEL_BUY, TRADE_ACTION_LABEL_SELL, TRADE_ACTION_OPTIONS, TRADE_STATUS_EXECUTED, TRADE_STATUS_SETTLED, TRADE_STATUS_CANCELLED, TRADE_STATUS_FAILED, TRADE_STATUS_LABEL_EXECUTED, TRADE_STATUS_LABEL_SETTLED, TRADE_STATUS_LABEL_CANCELLED, TRADE_STATUS_LABEL_FAILED, TRADE_STATUS_OPTIONS, } from './constants';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/trades/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,gBAAgB,EAChB,qBAAqB,EACrB,gCAAgC,EAChC,6BAA6B,EAC7B,qBAAqB,EACrB,0BAA0B,EAC1B,eAAe,EACf,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,WAAW,GACZ,MAAM,SAAS,CAAC;AAGjB,OAAO,EAEL,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EAEjB,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,gCAAgC,EAEhC,SAAS,EACT,cAAc,EAEd,cAAc,EACd,mBAAmB,GACpB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,EAC7B,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,kCAAkC,EAClC,mCAAmC,EACnC,mCAAmC,EACnC,iCAAiC,EACjC,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Export service functions
|
|
2
|
+
export {
|
|
3
|
+
// Target Trades
|
|
4
|
+
getTargetTrades, getTargetTradeByUuid, createTargetTrade, updateTargetTrade, deleteTargetTrade,
|
|
5
|
+
// Target Trade Sheets
|
|
6
|
+
getTargetTradeSheets, getTargetTradeSheetByUuid, createTargetTradeSheet, updateTargetTradeSheet, deleteTargetTradeSheet, approveTargetTradeSheet, cleanTargetTradeSheet, getOrCreateDraftTargetTradeSheet,
|
|
7
|
+
// Trades (read-only)
|
|
8
|
+
getTrades, getTradeByUuid,
|
|
9
|
+
// Trade Sheets (read-only)
|
|
10
|
+
getTradeSheets, getTradeSheetByUuid, } from './service';
|
|
11
|
+
// Export constants
|
|
12
|
+
export { TARGET_TRADE_STATUS_PENDING, TARGET_TRADE_STATUS_APPROVED, TARGET_TRADE_STATUS_SUBMITTED, TARGET_TRADE_STATUS_CANCELLED, TARGET_TRADE_STATUS_EXPIRED, TARGET_TRADE_STATUS_LABEL_PENDING, TARGET_TRADE_STATUS_LABEL_APPROVED, TARGET_TRADE_STATUS_LABEL_SUBMITTED, TARGET_TRADE_STATUS_LABEL_CANCELLED, TARGET_TRADE_STATUS_LABEL_EXPIRED, TARGET_TRADE_STATUS_OPTIONS, TRADE_ACTION_BUY, TRADE_ACTION_SELL, TRADE_ACTION_LABEL_BUY, TRADE_ACTION_LABEL_SELL, TRADE_ACTION_OPTIONS, TRADE_STATUS_EXECUTED, TRADE_STATUS_SETTLED, TRADE_STATUS_CANCELLED, TRADE_STATUS_FAILED, TRADE_STATUS_LABEL_EXECUTED, TRADE_STATUS_LABEL_SETTLED, TRADE_STATUS_LABEL_CANCELLED, TRADE_STATUS_LABEL_FAILED, TRADE_STATUS_OPTIONS, } from './constants';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TargetTrade, TargetTradePayload, TargetTradeQueryParams, PaginatedTargetTrades, TargetTradeSheet, TargetTradeSheetPayload, TargetTradeSheetQueryParams, PaginatedTargetTradeSheets, TargetTradeSheetApprovalResponse, TargetTradeSheetCleanResponse, Trade, TradeQueryParams, PaginatedTrades, TradeSheet, TradeSheetQueryParams, PaginatedTradeSheets } from './types';
|
|
2
|
+
export declare const getTargetTrades: (params?: TargetTradeQueryParams) => Promise<import("axios").AxiosResponse<PaginatedTargetTrades, any>>;
|
|
3
|
+
export declare const getTargetTradeByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<TargetTrade, any>>;
|
|
4
|
+
export declare const createTargetTrade: (data: TargetTradePayload) => Promise<import("axios").AxiosResponse<TargetTrade, any>>;
|
|
5
|
+
export declare const updateTargetTrade: (uuid: string, data: Partial<TargetTradePayload>) => Promise<import("axios").AxiosResponse<TargetTrade, any>>;
|
|
6
|
+
export declare const deleteTargetTrade: (uuid: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
7
|
+
export declare const getTargetTradeSheets: (params?: TargetTradeSheetQueryParams) => Promise<import("axios").AxiosResponse<PaginatedTargetTradeSheets, any>>;
|
|
8
|
+
export declare const getTargetTradeSheetByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<TargetTradeSheet, any>>;
|
|
9
|
+
export declare const createTargetTradeSheet: (data: TargetTradeSheetPayload) => Promise<import("axios").AxiosResponse<TargetTradeSheet, any>>;
|
|
10
|
+
export declare const updateTargetTradeSheet: (uuid: string, data: Partial<TargetTradeSheetPayload>) => Promise<import("axios").AxiosResponse<TargetTradeSheet, any>>;
|
|
11
|
+
export declare const deleteTargetTradeSheet: (uuid: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
12
|
+
export declare const approveTargetTradeSheet: (uuid: string) => Promise<import("axios").AxiosResponse<TargetTradeSheetApprovalResponse, any>>;
|
|
13
|
+
export declare const cleanTargetTradeSheet: (uuid: string) => Promise<import("axios").AxiosResponse<TargetTradeSheetCleanResponse, any>>;
|
|
14
|
+
export declare const getOrCreateDraftTargetTradeSheet: (portfolioUuid: string) => Promise<string>;
|
|
15
|
+
export declare const getTrades: (params?: TradeQueryParams) => Promise<import("axios").AxiosResponse<PaginatedTrades, any>>;
|
|
16
|
+
export declare const getTradeByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<Trade, any>>;
|
|
17
|
+
export declare const getTradeSheets: (params?: TradeSheetQueryParams) => Promise<PaginatedTradeSheets>;
|
|
18
|
+
export declare const getTradeSheetByUuid: (uuid: string) => Promise<TradeSheet>;
|
|
19
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/services/trades/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,2BAA2B,EAC3B,0BAA0B,EAC1B,gCAAgC,EAChC,6BAA6B,EAC7B,KAAK,EACL,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAOjB,eAAO,MAAM,eAAe,GAAI,SAAS,sBAAsB,uEA+B9D,CAAC;AAGF,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,6DAEhD,CAAC;AAGF,eAAO,MAAM,iBAAiB,GAAI,MAAM,kBAAkB,6DAEzD,CAAC;AAGF,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,6DAEhF,CAAC;AAGF,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,qDAE7C,CAAC;AAOF,eAAO,MAAM,oBAAoB,GAAI,SAAS,2BAA2B,4EAgBxE,CAAC;AAGF,eAAO,MAAM,yBAAyB,GAAI,MAAM,MAAM,kEAErD,CAAC;AAGF,eAAO,MAAM,sBAAsB,GAAI,MAAM,uBAAuB,kEAEnE,CAAC;AAGF,eAAO,MAAM,sBAAsB,GAAI,MAAM,MAAM,EAAE,MAAM,OAAO,CAAC,uBAAuB,CAAC,kEAE1F,CAAC;AAGF,eAAO,MAAM,sBAAsB,GAAI,MAAM,MAAM,qDAElD,CAAC;AAGF,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,kFAEnD,CAAC;AAGF,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,+EAEjD,CAAC;AAGF,eAAO,MAAM,gCAAgC,GAAU,eAAe,MAAM,KAAG,OAAO,CAAC,MAAM,CAe5F,CAAC;AAUF,eAAO,MAAM,SAAS,GAAI,SAAS,gBAAgB,iEA8ClD,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,uDAE1C,CAAC;AAOF,eAAO,MAAM,cAAc,GAAU,SAAS,qBAAqB,KAAG,OAAO,CAAC,oBAAoB,CAGjG,CAAC;AAGF,eAAO,MAAM,mBAAmB,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,UAAU,CAG1E,CAAC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { webApiClient } from '../../api/apiClient';
|
|
2
|
+
import { API_ENDPOINTS } from './constants';
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// TARGET TRADES SERVICE
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// Fetch target trades with optional filtering
|
|
7
|
+
export const getTargetTrades = (params) => {
|
|
8
|
+
const queryParams = {};
|
|
9
|
+
if (params?.portfolio) {
|
|
10
|
+
queryParams.portfolio = params.portfolio;
|
|
11
|
+
}
|
|
12
|
+
if (params?.instrument) {
|
|
13
|
+
queryParams.instrument = params.instrument;
|
|
14
|
+
}
|
|
15
|
+
if (params?.action) {
|
|
16
|
+
queryParams.action = params.action;
|
|
17
|
+
}
|
|
18
|
+
if (params?.status) {
|
|
19
|
+
queryParams.status = params.status;
|
|
20
|
+
}
|
|
21
|
+
if (params?.start_date) {
|
|
22
|
+
queryParams.start_date = params.start_date;
|
|
23
|
+
}
|
|
24
|
+
if (params?.end_date) {
|
|
25
|
+
queryParams.end_date = params.end_date;
|
|
26
|
+
}
|
|
27
|
+
if (params?.min_price !== undefined) {
|
|
28
|
+
queryParams.min_price = params.min_price.toString();
|
|
29
|
+
}
|
|
30
|
+
if (params?.max_price !== undefined) {
|
|
31
|
+
queryParams.max_price = params.max_price.toString();
|
|
32
|
+
}
|
|
33
|
+
return webApiClient.get(API_ENDPOINTS.TARGET_TRADES, {
|
|
34
|
+
params: queryParams,
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
// Get target trade by UUID
|
|
38
|
+
export const getTargetTradeByUuid = (uuid) => {
|
|
39
|
+
return webApiClient.get(`${API_ENDPOINTS.TARGET_TRADES}${uuid}/`);
|
|
40
|
+
};
|
|
41
|
+
// Create a new target trade
|
|
42
|
+
export const createTargetTrade = (data) => {
|
|
43
|
+
return webApiClient.post(API_ENDPOINTS.TARGET_TRADES, data);
|
|
44
|
+
};
|
|
45
|
+
// Update an existing target trade by UUID
|
|
46
|
+
export const updateTargetTrade = (uuid, data) => {
|
|
47
|
+
return webApiClient.patch(`${API_ENDPOINTS.TARGET_TRADES}${uuid}/`, data);
|
|
48
|
+
};
|
|
49
|
+
// Delete a target trade by UUID
|
|
50
|
+
export const deleteTargetTrade = (uuid) => {
|
|
51
|
+
return webApiClient.delete(`${API_ENDPOINTS.TARGET_TRADES}${uuid}/`);
|
|
52
|
+
};
|
|
53
|
+
// =============================================================================
|
|
54
|
+
// TARGET TRADE SHEETS SERVICE
|
|
55
|
+
// =============================================================================
|
|
56
|
+
// Fetch target trade sheets with optional filtering
|
|
57
|
+
export const getTargetTradeSheets = (params) => {
|
|
58
|
+
const queryParams = {};
|
|
59
|
+
if (params?.portfolio) {
|
|
60
|
+
queryParams.portfolio = params.portfolio;
|
|
61
|
+
}
|
|
62
|
+
if (params?.startDate) {
|
|
63
|
+
queryParams.start_date = params.startDate;
|
|
64
|
+
}
|
|
65
|
+
if (params?.endDate) {
|
|
66
|
+
queryParams.end_date = params.endDate;
|
|
67
|
+
}
|
|
68
|
+
return webApiClient.get(API_ENDPOINTS.TARGET_TRADE_SHEETS, {
|
|
69
|
+
params: queryParams,
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
// Get target trade sheet by UUID
|
|
73
|
+
export const getTargetTradeSheetByUuid = (uuid) => {
|
|
74
|
+
return webApiClient.get(`${API_ENDPOINTS.TARGET_TRADE_SHEETS}${uuid}/`);
|
|
75
|
+
};
|
|
76
|
+
// Create a new target trade sheet
|
|
77
|
+
export const createTargetTradeSheet = (data) => {
|
|
78
|
+
return webApiClient.post(API_ENDPOINTS.TARGET_TRADE_SHEETS, data);
|
|
79
|
+
};
|
|
80
|
+
// Update an existing target trade sheet by UUID
|
|
81
|
+
export const updateTargetTradeSheet = (uuid, data) => {
|
|
82
|
+
return webApiClient.patch(`${API_ENDPOINTS.TARGET_TRADE_SHEETS}${uuid}/`, data);
|
|
83
|
+
};
|
|
84
|
+
// Delete a target trade sheet by UUID
|
|
85
|
+
export const deleteTargetTradeSheet = (uuid) => {
|
|
86
|
+
return webApiClient.delete(`${API_ENDPOINTS.TARGET_TRADE_SHEETS}${uuid}/`);
|
|
87
|
+
};
|
|
88
|
+
// Approve a target trade sheet
|
|
89
|
+
export const approveTargetTradeSheet = (uuid) => {
|
|
90
|
+
return webApiClient.post(`${API_ENDPOINTS.TARGET_TRADE_SHEETS}${uuid}/approve/`);
|
|
91
|
+
};
|
|
92
|
+
// Clean a target trade sheet (remove all target trades)
|
|
93
|
+
export const cleanTargetTradeSheet = (uuid) => {
|
|
94
|
+
return webApiClient.post(`${API_ENDPOINTS.TARGET_TRADE_SHEETS}${uuid}/clean/`);
|
|
95
|
+
};
|
|
96
|
+
// Get or create a draft target trade sheet for a portfolio
|
|
97
|
+
export const getOrCreateDraftTargetTradeSheet = async (portfolioUuid) => {
|
|
98
|
+
// Check if there's already a draft target trade sheet
|
|
99
|
+
const targetTradeSheetsResponse = await getTargetTradeSheets({ portfolio: portfolioUuid });
|
|
100
|
+
const draftTargetTradeSheet = targetTradeSheetsResponse.data.results.find((sheet) => sheet.status === 'DRAFT');
|
|
101
|
+
if (draftTargetTradeSheet) {
|
|
102
|
+
return draftTargetTradeSheet.uuid;
|
|
103
|
+
}
|
|
104
|
+
// Create new draft target trade sheet
|
|
105
|
+
const newTargetTradeSheetResponse = await createTargetTradeSheet({
|
|
106
|
+
portfolio: portfolioUuid,
|
|
107
|
+
});
|
|
108
|
+
return newTargetTradeSheetResponse.data.uuid;
|
|
109
|
+
};
|
|
110
|
+
// =============================================================================
|
|
111
|
+
// TRADES SERVICE (READ-ONLY)
|
|
112
|
+
// =============================================================================
|
|
113
|
+
// Note: Trades are read-only from the frontend
|
|
114
|
+
// Create, update, and delete operations are not available via the API
|
|
115
|
+
// Fetch trades with optional filtering
|
|
116
|
+
export const getTrades = (params) => {
|
|
117
|
+
const queryParams = {};
|
|
118
|
+
if (params?.portfolio) {
|
|
119
|
+
queryParams.portfolio = params.portfolio;
|
|
120
|
+
}
|
|
121
|
+
if (params?.instrument) {
|
|
122
|
+
queryParams.instrument = params.instrument;
|
|
123
|
+
}
|
|
124
|
+
if (params?.action) {
|
|
125
|
+
queryParams.action = params.action;
|
|
126
|
+
}
|
|
127
|
+
if (params?.status) {
|
|
128
|
+
queryParams.status = params.status;
|
|
129
|
+
}
|
|
130
|
+
if (params?.currency) {
|
|
131
|
+
queryParams.currency = params.currency;
|
|
132
|
+
}
|
|
133
|
+
if (params?.start_date) {
|
|
134
|
+
queryParams.start_date = params.start_date;
|
|
135
|
+
}
|
|
136
|
+
if (params?.end_date) {
|
|
137
|
+
queryParams.end_date = params.end_date;
|
|
138
|
+
}
|
|
139
|
+
if (params?.settlement_start_date) {
|
|
140
|
+
queryParams.settlement_start_date = params.settlement_start_date;
|
|
141
|
+
}
|
|
142
|
+
if (params?.settlement_end_date) {
|
|
143
|
+
queryParams.settlement_end_date = params.settlement_end_date;
|
|
144
|
+
}
|
|
145
|
+
if (params?.min_price !== undefined) {
|
|
146
|
+
queryParams.min_price = params.min_price.toString();
|
|
147
|
+
}
|
|
148
|
+
if (params?.max_price !== undefined) {
|
|
149
|
+
queryParams.max_price = params.max_price.toString();
|
|
150
|
+
}
|
|
151
|
+
if (params?.tradesheet) {
|
|
152
|
+
queryParams.tradesheet = params.tradesheet;
|
|
153
|
+
}
|
|
154
|
+
if (params?.target_trade) {
|
|
155
|
+
queryParams.target_trade = params.target_trade;
|
|
156
|
+
}
|
|
157
|
+
return webApiClient.get(API_ENDPOINTS.TRADES, {
|
|
158
|
+
params: queryParams,
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
// Get trade by UUID
|
|
162
|
+
export const getTradeByUuid = (uuid) => {
|
|
163
|
+
return webApiClient.get(`${API_ENDPOINTS.TRADES}${uuid}/`);
|
|
164
|
+
};
|
|
165
|
+
// =============================================================================
|
|
166
|
+
// TRADE SHEETS SERVICE (READ-ONLY)
|
|
167
|
+
// =============================================================================
|
|
168
|
+
// Get trade sheets with optional filtering and pagination
|
|
169
|
+
export const getTradeSheets = async (params) => {
|
|
170
|
+
const { data } = await webApiClient.get('/trade-sheets/', { params });
|
|
171
|
+
return data;
|
|
172
|
+
};
|
|
173
|
+
// Get a specific trade sheet by UUID
|
|
174
|
+
export const getTradeSheetByUuid = async (uuid) => {
|
|
175
|
+
const { data } = await webApiClient.get(`/trade-sheets/${uuid}/`);
|
|
176
|
+
return data;
|
|
177
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { PaginatedResponse } from '../../api/types';
|
|
2
|
+
export type { PaginatedResponse } from '../../api/types';
|
|
3
|
+
export type TradeAction = 'BUY' | 'SELL';
|
|
4
|
+
export type TargetTradeStatus = 'PENDING' | 'APPROVED' | 'SUBMITTED' | 'CANCELLED' | 'EXPIRED';
|
|
5
|
+
export type TradeStatus = 'EXECUTED' | 'SETTLED' | 'CANCELLED' | 'FAILED';
|
|
6
|
+
export interface TargetTrade {
|
|
7
|
+
uuid: string;
|
|
8
|
+
targetTradesheet: string;
|
|
9
|
+
instrument: string;
|
|
10
|
+
instrumentSymbol: string;
|
|
11
|
+
instrumentName: string;
|
|
12
|
+
quantity: number;
|
|
13
|
+
action: TradeAction;
|
|
14
|
+
targetPrice: string;
|
|
15
|
+
status: string;
|
|
16
|
+
expiresAt: string | null;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
}
|
|
20
|
+
export interface TargetTradeSheet {
|
|
21
|
+
uuid: string;
|
|
22
|
+
portfolio: string;
|
|
23
|
+
status: string;
|
|
24
|
+
submittedAt: string | null;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
}
|
|
28
|
+
export interface TradeSheet {
|
|
29
|
+
uuid: string;
|
|
30
|
+
portfolio: string;
|
|
31
|
+
target_sheet: string;
|
|
32
|
+
created_at: string;
|
|
33
|
+
updated_at: string;
|
|
34
|
+
}
|
|
35
|
+
export interface Trade {
|
|
36
|
+
uuid: string;
|
|
37
|
+
tradesheet: string;
|
|
38
|
+
targetTrade: string | null;
|
|
39
|
+
instrument: string;
|
|
40
|
+
instrumentSymbol: string;
|
|
41
|
+
instrumentName: string;
|
|
42
|
+
quantity: number;
|
|
43
|
+
action: TradeAction;
|
|
44
|
+
executedPrice: string;
|
|
45
|
+
executedDate: string;
|
|
46
|
+
status: string;
|
|
47
|
+
settlementDate: string | null;
|
|
48
|
+
currency: string | null;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
updatedAt: string;
|
|
51
|
+
}
|
|
52
|
+
export interface TargetTradePayload {
|
|
53
|
+
targetTradesheet: string;
|
|
54
|
+
instrument: string;
|
|
55
|
+
quantity: number;
|
|
56
|
+
action: TradeAction;
|
|
57
|
+
targetPrice: string | number;
|
|
58
|
+
}
|
|
59
|
+
export interface TargetTradeSheetPayload {
|
|
60
|
+
portfolio: string;
|
|
61
|
+
}
|
|
62
|
+
export interface TargetTradeQueryParams {
|
|
63
|
+
portfolio?: string;
|
|
64
|
+
instrument?: string;
|
|
65
|
+
action?: TradeAction;
|
|
66
|
+
status?: string;
|
|
67
|
+
start_date?: string;
|
|
68
|
+
end_date?: string;
|
|
69
|
+
min_price?: number;
|
|
70
|
+
max_price?: number;
|
|
71
|
+
}
|
|
72
|
+
export interface TargetTradeSheetQueryParams {
|
|
73
|
+
portfolio?: string;
|
|
74
|
+
startDate?: string;
|
|
75
|
+
endDate?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface TradeSheetQueryParams {
|
|
78
|
+
portfolio?: string;
|
|
79
|
+
start_date?: string;
|
|
80
|
+
end_date?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface TradeQueryParams {
|
|
83
|
+
portfolio?: string;
|
|
84
|
+
instrument?: string;
|
|
85
|
+
action?: TradeAction;
|
|
86
|
+
status?: TradeStatus;
|
|
87
|
+
currency?: string;
|
|
88
|
+
start_date?: string;
|
|
89
|
+
end_date?: string;
|
|
90
|
+
settlement_start_date?: string;
|
|
91
|
+
settlement_end_date?: string;
|
|
92
|
+
min_price?: number;
|
|
93
|
+
max_price?: number;
|
|
94
|
+
tradesheet?: string;
|
|
95
|
+
target_trade?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface TargetTradeSheetApprovalResponse {
|
|
98
|
+
uuid: string;
|
|
99
|
+
status: string;
|
|
100
|
+
approvedAt: string;
|
|
101
|
+
approvedTradesCount: number;
|
|
102
|
+
message?: string;
|
|
103
|
+
}
|
|
104
|
+
export interface TargetTradeSheetCleanResponse {
|
|
105
|
+
uuid: string;
|
|
106
|
+
status: string;
|
|
107
|
+
deletedTradesCount: number;
|
|
108
|
+
message?: string;
|
|
109
|
+
}
|
|
110
|
+
export type PaginatedTargetTrades = PaginatedResponse<TargetTrade>;
|
|
111
|
+
export type PaginatedTargetTradeSheets = PaginatedResponse<TargetTradeSheet>;
|
|
112
|
+
export type PaginatedTrades = PaginatedResponse<Trade>;
|
|
113
|
+
export type PaginatedTradeSheets = PaginatedResponse<TradeSheet>;
|
|
114
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/trades/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|