@cranberry-money/shared-services 1.13.0 → 3.0.1
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/CHANGELOG.md +240 -0
- package/README.md +464 -190
- package/dist/api/functional-client.d.ts +66 -0
- package/dist/api/functional-client.d.ts.map +1 -0
- package/dist/api/functional-client.js +165 -0
- package/dist/auth/functional/auth-operations.d.ts +116 -0
- package/dist/auth/functional/auth-operations.d.ts.map +1 -0
- package/dist/auth/functional/auth-operations.js +246 -0
- package/dist/auth/functional/auth-state.d.ts +38 -0
- package/dist/auth/functional/auth-state.d.ts.map +1 -0
- package/dist/auth/functional/auth-state.js +87 -0
- package/dist/auth/functional/token-storage.d.ts +44 -0
- package/dist/auth/functional/token-storage.d.ts.map +1 -0
- package/dist/auth/functional/token-storage.js +178 -0
- package/dist/auth/react/AuthProvider.d.ts +92 -0
- package/dist/auth/react/AuthProvider.d.ts.map +1 -0
- package/dist/auth/react/AuthProvider.js +207 -0
- package/dist/index.d.ts +25 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +114 -42
- package/dist/integration/blueberry-integration.d.ts +21 -0
- package/dist/integration/blueberry-integration.d.ts.map +1 -0
- package/dist/integration/blueberry-integration.js +109 -0
- package/dist/integration/index.d.ts +8 -0
- package/dist/integration/index.d.ts.map +1 -0
- package/dist/integration/index.js +18 -0
- package/dist/services/accounts.d.ts +220 -0
- package/dist/services/accounts.d.ts.map +1 -0
- package/dist/services/accounts.js +175 -0
- package/dist/services/banks.d.ts +123 -0
- package/dist/services/banks.d.ts.map +1 -0
- package/dist/services/banks.js +151 -0
- package/dist/services/cash-accounts.d.ts +112 -0
- package/dist/services/cash-accounts.d.ts.map +1 -0
- package/dist/services/cash-accounts.js +222 -0
- package/dist/services/documents.d.ts +143 -0
- package/dist/services/documents.d.ts.map +1 -0
- package/dist/services/documents.js +253 -0
- package/dist/services/factories/account-factory.d.ts +16 -0
- package/dist/services/factories/account-factory.d.ts.map +1 -0
- package/dist/services/factories/account-factory.js +79 -0
- package/dist/services/factories/auth-factory.d.ts +23 -0
- package/dist/services/factories/auth-factory.d.ts.map +1 -0
- package/dist/services/factories/auth-factory.js +75 -0
- package/dist/services/factories/bank-factory.d.ts +16 -0
- package/dist/services/factories/bank-factory.d.ts.map +1 -0
- package/dist/services/factories/bank-factory.js +72 -0
- package/dist/services/factories/cash-account-factory.d.ts +16 -0
- package/dist/services/factories/cash-account-factory.d.ts.map +1 -0
- package/dist/services/factories/cash-account-factory.js +74 -0
- package/dist/services/factories/document-factory.d.ts +16 -0
- package/dist/services/factories/document-factory.d.ts.map +1 -0
- package/dist/services/factories/document-factory.js +85 -0
- package/dist/services/factories/index.d.ts +21 -0
- package/dist/services/factories/index.d.ts.map +1 -0
- package/dist/services/factories/index.js +40 -0
- package/dist/services/factories/instrument-factory.d.ts +16 -0
- package/dist/services/factories/instrument-factory.d.ts.map +1 -0
- package/dist/services/factories/instrument-factory.js +68 -0
- package/dist/services/factories/master-factory.d.ts +74 -0
- package/dist/services/factories/master-factory.d.ts.map +1 -0
- package/dist/services/factories/master-factory.js +183 -0
- package/dist/services/factories/portfolio-factory.d.ts +16 -0
- package/dist/services/factories/portfolio-factory.d.ts.map +1 -0
- package/dist/services/factories/portfolio-factory.js +74 -0
- package/dist/services/factories/portfolio-template-factory.d.ts +16 -0
- package/dist/services/factories/portfolio-template-factory.d.ts.map +1 -0
- package/dist/services/factories/portfolio-template-factory.js +76 -0
- package/dist/services/factories/reference-data-factory.d.ts +16 -0
- package/dist/services/factories/reference-data-factory.d.ts.map +1 -0
- package/dist/services/factories/reference-data-factory.js +86 -0
- package/dist/services/factories/tax-residency-factory.d.ts +16 -0
- package/dist/services/factories/tax-residency-factory.d.ts.map +1 -0
- package/dist/services/factories/tax-residency-factory.js +73 -0
- package/dist/services/factories/trade-factory.d.ts +16 -0
- package/dist/services/factories/trade-factory.d.ts.map +1 -0
- package/dist/services/factories/trade-factory.js +79 -0
- package/dist/services/factories/types.d.ts +250 -0
- package/dist/services/factories/types.d.ts.map +1 -0
- package/dist/services/factories/types.js +32 -0
- package/dist/services/factories/withdrawal-factory.d.ts +16 -0
- package/dist/services/factories/withdrawal-factory.d.ts.map +1 -0
- package/dist/services/factories/withdrawal-factory.js +78 -0
- package/dist/services/instruments.d.ts +138 -0
- package/dist/services/instruments.d.ts.map +1 -0
- package/dist/services/instruments.js +178 -0
- package/dist/services/portfolio-templates.d.ts +142 -0
- package/dist/services/portfolio-templates.d.ts.map +1 -0
- package/dist/services/portfolio-templates.js +201 -0
- package/dist/services/portfolios.d.ts +157 -0
- package/dist/services/portfolios.d.ts.map +1 -0
- package/dist/services/portfolios.js +144 -0
- package/dist/services/reference-data.d.ts +185 -0
- package/dist/services/reference-data.d.ts.map +1 -0
- package/dist/services/reference-data.js +245 -0
- package/dist/services/tax-residencies.d.ts +83 -0
- package/dist/services/tax-residencies.d.ts.map +1 -0
- package/dist/services/tax-residencies.js +179 -0
- package/dist/services/trades.d.ts +190 -0
- package/dist/services/trades.d.ts.map +1 -0
- package/dist/services/trades.js +207 -0
- package/dist/services/withdrawals.d.ts +236 -0
- package/dist/services/withdrawals.d.ts.map +1 -0
- package/dist/services/withdrawals.js +345 -0
- package/package.json +39 -16
- package/dist/adapters/MobileApiClient.d.ts +0 -68
- package/dist/adapters/MobileApiClient.d.ts.map +0 -1
- package/dist/adapters/MobileApiClient.js +0 -240
- package/dist/adapters/MobileTokenStorage.d.ts +0 -43
- package/dist/adapters/MobileTokenStorage.d.ts.map +0 -1
- package/dist/adapters/MobileTokenStorage.js +0 -128
- package/dist/adapters/WebApiClient.d.ts +0 -28
- package/dist/adapters/WebApiClient.d.ts.map +0 -1
- package/dist/adapters/WebApiClient.js +0 -119
- package/dist/adapters/WebTokenStorage.d.ts +0 -38
- package/dist/adapters/WebTokenStorage.d.ts.map +0 -1
- package/dist/adapters/WebTokenStorage.js +0 -86
- package/dist/api/apiClient.d.ts +0 -31
- package/dist/api/apiClient.d.ts.map +0 -1
- package/dist/api/apiClient.js +0 -49
- package/dist/api/types.d.ts +0 -51
- package/dist/api/types.d.ts.map +0 -1
- package/dist/api/types.js +0 -4
- package/dist/auth/AuthManager.d.ts +0 -81
- package/dist/auth/AuthManager.d.ts.map +0 -1
- package/dist/auth/AuthManager.js +0 -223
- package/dist/auth/createAuthManager.d.ts +0 -63
- package/dist/auth/createAuthManager.d.ts.map +0 -1
- package/dist/auth/createAuthManager.js +0 -103
- package/dist/auth/useAuthManager.d.ts +0 -66
- package/dist/auth/useAuthManager.d.ts.map +0 -1
- package/dist/auth/useAuthManager.js +0 -133
- package/dist/config/serviceConfig.d.ts +0 -37
- package/dist/config/serviceConfig.d.ts.map +0 -1
- package/dist/config/serviceConfig.js +0 -70
- package/dist/core/BaseApiClient.d.ts +0 -82
- package/dist/core/BaseApiClient.d.ts.map +0 -1
- package/dist/core/BaseApiClient.js +0 -89
- package/dist/core/TokenStorage.d.ts +0 -45
- package/dist/core/TokenStorage.d.ts.map +0 -1
- package/dist/core/TokenStorage.js +0 -23
- package/dist/query/QueryClient.d.ts +0 -82
- package/dist/query/QueryClient.d.ts.map +0 -1
- package/dist/query/QueryClient.js +0 -136
- package/dist/query/useAuth.d.ts +0 -64
- package/dist/query/useAuth.d.ts.map +0 -1
- package/dist/query/useAuth.js +0 -144
- package/dist/query/usePortfolios.d.ts +0 -79
- package/dist/query/usePortfolios.d.ts.map +0 -1
- package/dist/query/usePortfolios.js +0 -172
- package/dist/services/AuthService.d.ts +0 -75
- package/dist/services/AuthService.d.ts.map +0 -1
- package/dist/services/AuthService.js +0 -83
- package/dist/services/BaseService.d.ts +0 -48
- package/dist/services/BaseService.d.ts.map +0 -1
- package/dist/services/BaseService.js +0 -51
- package/dist/services/PortfolioService.d.ts +0 -100
- package/dist/services/PortfolioService.d.ts.map +0 -1
- package/dist/services/PortfolioService.js +0 -68
- package/dist/services/accounts/constants.d.ts +0 -24
- package/dist/services/accounts/constants.d.ts.map +0 -1
- package/dist/services/accounts/constants.js +0 -30
- package/dist/services/accounts/index.d.ts +0 -7
- package/dist/services/accounts/index.d.ts.map +0 -1
- package/dist/services/accounts/index.js +0 -6
- package/dist/services/accounts/service.d.ts +0 -11
- package/dist/services/accounts/service.d.ts.map +0 -1
- package/dist/services/accounts/service.js +0 -19
- package/dist/services/accounts/types.d.ts +0 -15
- package/dist/services/accounts/types.d.ts.map +0 -1
- package/dist/services/accounts/types.js +0 -4
- package/dist/services/auth/constants.d.ts +0 -30
- package/dist/services/auth/constants.d.ts.map +0 -1
- package/dist/services/auth/constants.js +0 -37
- package/dist/services/auth/index.d.ts +0 -8
- package/dist/services/auth/index.d.ts.map +0 -1
- package/dist/services/auth/index.js +0 -7
- package/dist/services/auth/service.d.ts +0 -8
- package/dist/services/auth/service.d.ts.map +0 -1
- package/dist/services/auth/service.js +0 -23
- package/dist/services/auth/types.d.ts +0 -38
- package/dist/services/auth/types.d.ts.map +0 -1
- package/dist/services/auth/types.js +0 -1
- package/dist/services/auth/utils.d.ts +0 -46
- package/dist/services/auth/utils.d.ts.map +0 -1
- package/dist/services/auth/utils.js +0 -113
- package/dist/services/banks/constants.d.ts +0 -47
- package/dist/services/banks/constants.d.ts.map +0 -1
- package/dist/services/banks/constants.js +0 -98
- package/dist/services/banks/index.d.ts +0 -8
- package/dist/services/banks/index.d.ts.map +0 -1
- package/dist/services/banks/index.js +0 -7
- package/dist/services/banks/service.d.ts +0 -9
- package/dist/services/banks/service.d.ts.map +0 -1
- package/dist/services/banks/service.js +0 -38
- package/dist/services/banks/types.d.ts +0 -36
- package/dist/services/banks/types.d.ts.map +0 -1
- package/dist/services/banks/types.js +0 -4
- package/dist/services/cash_accounts/constants.d.ts +0 -7
- package/dist/services/cash_accounts/constants.d.ts.map +0 -1
- package/dist/services/cash_accounts/constants.js +0 -7
- package/dist/services/cash_accounts/index.d.ts +0 -5
- package/dist/services/cash_accounts/index.d.ts.map +0 -1
- package/dist/services/cash_accounts/index.js +0 -6
- package/dist/services/cash_accounts/service.d.ts +0 -8
- package/dist/services/cash_accounts/service.d.ts.map +0 -1
- package/dist/services/cash_accounts/service.js +0 -32
- package/dist/services/cash_accounts/transactions/constants.d.ts +0 -18
- package/dist/services/cash_accounts/transactions/constants.d.ts.map +0 -1
- package/dist/services/cash_accounts/transactions/constants.js +0 -25
- package/dist/services/cash_accounts/transactions/index.d.ts +0 -5
- package/dist/services/cash_accounts/transactions/index.d.ts.map +0 -1
- package/dist/services/cash_accounts/transactions/index.js +0 -6
- package/dist/services/cash_accounts/transactions/service.d.ts +0 -13
- package/dist/services/cash_accounts/transactions/service.d.ts.map +0 -1
- package/dist/services/cash_accounts/transactions/service.js +0 -75
- package/dist/services/cash_accounts/transactions/types.d.ts +0 -38
- package/dist/services/cash_accounts/transactions/types.d.ts.map +0 -1
- package/dist/services/cash_accounts/transactions/types.js +0 -11
- package/dist/services/cash_accounts/types.d.ts +0 -24
- package/dist/services/cash_accounts/types.d.ts.map +0 -1
- package/dist/services/cash_accounts/types.js +0 -4
- package/dist/services/countries/constants.d.ts +0 -9
- package/dist/services/countries/constants.d.ts.map +0 -1
- package/dist/services/countries/constants.js +0 -10
- package/dist/services/countries/index.d.ts +0 -5
- package/dist/services/countries/index.d.ts.map +0 -1
- package/dist/services/countries/index.js +0 -6
- package/dist/services/countries/service.d.ts +0 -18
- package/dist/services/countries/service.d.ts.map +0 -1
- package/dist/services/countries/service.js +0 -32
- package/dist/services/countries/types.d.ts +0 -24
- package/dist/services/countries/types.d.ts.map +0 -1
- package/dist/services/countries/types.js +0 -1
- package/dist/services/countries/utils.d.ts +0 -38
- package/dist/services/countries/utils.d.ts.map +0 -1
- package/dist/services/countries/utils.js +0 -62
- package/dist/services/documents/constants.d.ts +0 -55
- package/dist/services/documents/constants.d.ts.map +0 -1
- package/dist/services/documents/constants.js +0 -50
- package/dist/services/documents/index.d.ts +0 -6
- package/dist/services/documents/index.d.ts.map +0 -1
- package/dist/services/documents/index.js +0 -6
- package/dist/services/documents/service.d.ts +0 -50
- package/dist/services/documents/service.d.ts.map +0 -1
- package/dist/services/documents/service.js +0 -116
- package/dist/services/documents/types.d.ts +0 -47
- package/dist/services/documents/types.d.ts.map +0 -1
- package/dist/services/documents/types.js +0 -1
- package/dist/services/documents/utils.d.ts +0 -26
- package/dist/services/documents/utils.d.ts.map +0 -1
- package/dist/services/documents/utils.js +0 -37
- package/dist/services/industries/constants.d.ts +0 -8
- package/dist/services/industries/constants.d.ts.map +0 -1
- package/dist/services/industries/constants.js +0 -9
- package/dist/services/industries/index.d.ts +0 -6
- package/dist/services/industries/index.d.ts.map +0 -1
- package/dist/services/industries/index.js +0 -6
- package/dist/services/industries/service.d.ts +0 -18
- package/dist/services/industries/service.d.ts.map +0 -1
- package/dist/services/industries/service.js +0 -43
- package/dist/services/industries/types.d.ts +0 -21
- package/dist/services/industries/types.d.ts.map +0 -1
- package/dist/services/industries/types.js +0 -1
- package/dist/services/industries/utils.d.ts +0 -47
- package/dist/services/industries/utils.d.ts.map +0 -1
- package/dist/services/industries/utils.js +0 -86
- package/dist/services/instruments/constants.d.ts +0 -38
- package/dist/services/instruments/constants.d.ts.map +0 -1
- package/dist/services/instruments/constants.js +0 -36
- package/dist/services/instruments/index.d.ts +0 -5
- package/dist/services/instruments/index.d.ts.map +0 -1
- package/dist/services/instruments/index.js +0 -6
- package/dist/services/instruments/service.d.ts +0 -54
- package/dist/services/instruments/service.d.ts.map +0 -1
- package/dist/services/instruments/service.js +0 -106
- package/dist/services/instruments/types.d.ts +0 -83
- package/dist/services/instruments/types.d.ts.map +0 -1
- package/dist/services/instruments/types.js +0 -1
- package/dist/services/instruments/utils.d.ts +0 -50
- package/dist/services/instruments/utils.d.ts.map +0 -1
- package/dist/services/instruments/utils.js +0 -111
- package/dist/services/portfolio_templates/constants.d.ts +0 -8
- package/dist/services/portfolio_templates/constants.d.ts.map +0 -1
- package/dist/services/portfolio_templates/constants.js +0 -8
- package/dist/services/portfolio_templates/index.d.ts +0 -5
- package/dist/services/portfolio_templates/index.d.ts.map +0 -1
- package/dist/services/portfolio_templates/index.js +0 -5
- package/dist/services/portfolio_templates/service.d.ts +0 -6
- package/dist/services/portfolio_templates/service.d.ts.map +0 -1
- package/dist/services/portfolio_templates/service.js +0 -14
- package/dist/services/portfolio_templates/types.d.ts +0 -49
- package/dist/services/portfolio_templates/types.d.ts.map +0 -1
- package/dist/services/portfolio_templates/types.js +0 -1
- package/dist/services/portfolio_templates/utils.d.ts +0 -8
- package/dist/services/portfolio_templates/utils.d.ts.map +0 -1
- package/dist/services/portfolio_templates/utils.js +0 -13
- package/dist/services/portfolios/allocations/index.d.ts +0 -7
- package/dist/services/portfolios/allocations/index.d.ts.map +0 -1
- package/dist/services/portfolios/allocations/index.js +0 -6
- package/dist/services/portfolios/allocations/service.d.ts +0 -6
- package/dist/services/portfolios/allocations/service.d.ts.map +0 -1
- package/dist/services/portfolios/allocations/service.js +0 -19
- package/dist/services/portfolios/allocations/types.d.ts +0 -17
- package/dist/services/portfolios/allocations/types.d.ts.map +0 -1
- package/dist/services/portfolios/allocations/types.js +0 -4
- package/dist/services/portfolios/allocations/utils.d.ts +0 -3
- package/dist/services/portfolios/allocations/utils.d.ts.map +0 -1
- package/dist/services/portfolios/allocations/utils.js +0 -7
- package/dist/services/portfolios/constants.d.ts +0 -45
- package/dist/services/portfolios/constants.d.ts.map +0 -1
- package/dist/services/portfolios/constants.js +0 -57
- package/dist/services/portfolios/holdings/index.d.ts +0 -7
- package/dist/services/portfolios/holdings/index.d.ts.map +0 -1
- package/dist/services/portfolios/holdings/index.js +0 -6
- package/dist/services/portfolios/holdings/service.d.ts +0 -10
- package/dist/services/portfolios/holdings/service.d.ts.map +0 -1
- package/dist/services/portfolios/holdings/service.js +0 -53
- package/dist/services/portfolios/holdings/types.d.ts +0 -42
- package/dist/services/portfolios/holdings/types.d.ts.map +0 -1
- package/dist/services/portfolios/holdings/types.js +0 -4
- package/dist/services/portfolios/holdings/utils.d.ts +0 -8
- package/dist/services/portfolios/holdings/utils.d.ts.map +0 -1
- package/dist/services/portfolios/holdings/utils.js +0 -82
- package/dist/services/portfolios/index.d.ts +0 -10
- package/dist/services/portfolios/index.d.ts.map +0 -1
- package/dist/services/portfolios/index.js +0 -10
- package/dist/services/portfolios/service.d.ts +0 -7
- package/dist/services/portfolios/service.d.ts.map +0 -1
- package/dist/services/portfolios/service.js +0 -19
- package/dist/services/portfolios/types.d.ts +0 -29
- package/dist/services/portfolios/types.d.ts.map +0 -1
- package/dist/services/portfolios/types.js +0 -1
- package/dist/services/portfolios/utils.d.ts +0 -5
- package/dist/services/portfolios/utils.d.ts.map +0 -1
- package/dist/services/portfolios/utils.js +0 -26
- package/dist/services/sectors/constants.d.ts +0 -7
- package/dist/services/sectors/constants.d.ts.map +0 -1
- package/dist/services/sectors/constants.js +0 -7
- package/dist/services/sectors/index.d.ts +0 -6
- package/dist/services/sectors/index.d.ts.map +0 -1
- package/dist/services/sectors/index.js +0 -6
- package/dist/services/sectors/service.d.ts +0 -14
- package/dist/services/sectors/service.d.ts.map +0 -1
- package/dist/services/sectors/service.js +0 -32
- package/dist/services/sectors/types.d.ts +0 -19
- package/dist/services/sectors/types.d.ts.map +0 -1
- package/dist/services/sectors/types.js +0 -1
- package/dist/services/sectors/utils.d.ts +0 -31
- package/dist/services/sectors/utils.d.ts.map +0 -1
- package/dist/services/sectors/utils.js +0 -54
- package/dist/services/stock_exchanges/constants.d.ts +0 -7
- package/dist/services/stock_exchanges/constants.d.ts.map +0 -1
- package/dist/services/stock_exchanges/constants.js +0 -7
- package/dist/services/stock_exchanges/index.d.ts +0 -6
- package/dist/services/stock_exchanges/index.d.ts.map +0 -1
- package/dist/services/stock_exchanges/index.js +0 -6
- package/dist/services/stock_exchanges/service.d.ts +0 -4
- package/dist/services/stock_exchanges/service.d.ts.map +0 -1
- package/dist/services/stock_exchanges/service.js +0 -26
- package/dist/services/stock_exchanges/types.d.ts +0 -28
- package/dist/services/stock_exchanges/types.d.ts.map +0 -1
- package/dist/services/stock_exchanges/types.js +0 -1
- package/dist/services/stock_exchanges/utils.d.ts +0 -8
- package/dist/services/stock_exchanges/utils.d.ts.map +0 -1
- package/dist/services/stock_exchanges/utils.js +0 -37
- package/dist/services/tax_residencies/constants.d.ts +0 -7
- package/dist/services/tax_residencies/constants.d.ts.map +0 -1
- package/dist/services/tax_residencies/constants.js +0 -7
- package/dist/services/tax_residencies/index.d.ts +0 -10
- package/dist/services/tax_residencies/index.d.ts.map +0 -1
- package/dist/services/tax_residencies/index.js +0 -11
- package/dist/services/tax_residencies/service.d.ts +0 -6
- package/dist/services/tax_residencies/service.d.ts.map +0 -1
- package/dist/services/tax_residencies/service.js +0 -20
- package/dist/services/tax_residencies/types.d.ts +0 -26
- package/dist/services/tax_residencies/types.d.ts.map +0 -1
- package/dist/services/tax_residencies/types.js +0 -4
- package/dist/services/tax_residencies/utils.d.ts +0 -9
- package/dist/services/tax_residencies/utils.d.ts.map +0 -1
- package/dist/services/tax_residencies/utils.js +0 -19
- package/dist/services/trades/constants.d.ts +0 -47
- package/dist/services/trades/constants.d.ts.map +0 -1
- package/dist/services/trades/constants.js +0 -61
- package/dist/services/trades/index.d.ts +0 -4
- package/dist/services/trades/index.d.ts.map +0 -1
- package/dist/services/trades/index.js +0 -12
- package/dist/services/trades/service.d.ts +0 -19
- package/dist/services/trades/service.d.ts.map +0 -1
- package/dist/services/trades/service.js +0 -177
- package/dist/services/trades/types.d.ts +0 -114
- package/dist/services/trades/types.d.ts.map +0 -1
- package/dist/services/trades/types.js +0 -1
- package/dist/services/users/constants.d.ts +0 -7
- package/dist/services/users/constants.d.ts.map +0 -1
- package/dist/services/users/constants.js +0 -8
- package/dist/services/users/index.d.ts +0 -9
- package/dist/services/users/index.d.ts.map +0 -1
- package/dist/services/users/index.js +0 -9
- package/dist/services/users/investment_preferences/constants.d.ts +0 -7
- package/dist/services/users/investment_preferences/constants.d.ts.map +0 -1
- package/dist/services/users/investment_preferences/constants.js +0 -7
- package/dist/services/users/investment_preferences/index.d.ts +0 -7
- package/dist/services/users/investment_preferences/index.d.ts.map +0 -1
- package/dist/services/users/investment_preferences/index.js +0 -6
- package/dist/services/users/investment_preferences/service.d.ts +0 -5
- package/dist/services/users/investment_preferences/service.d.ts.map +0 -1
- package/dist/services/users/investment_preferences/service.js +0 -12
- package/dist/services/users/investment_preferences/types.d.ts +0 -23
- package/dist/services/users/investment_preferences/types.d.ts.map +0 -1
- package/dist/services/users/investment_preferences/types.js +0 -1
- package/dist/services/users/service.d.ts +0 -6
- package/dist/services/users/service.d.ts.map +0 -1
- package/dist/services/users/service.js +0 -15
- package/dist/services/users/types.d.ts +0 -32
- package/dist/services/users/types.d.ts.map +0 -1
- package/dist/services/users/types.js +0 -1
- package/dist/services/users/utils.d.ts +0 -2
- package/dist/services/users/utils.d.ts.map +0 -1
- package/dist/services/users/utils.js +0 -6
- package/dist/services/withdrawals/constants.d.ts +0 -67
- package/dist/services/withdrawals/constants.d.ts.map +0 -1
- package/dist/services/withdrawals/constants.js +0 -91
- package/dist/services/withdrawals/index.d.ts +0 -6
- package/dist/services/withdrawals/index.d.ts.map +0 -1
- package/dist/services/withdrawals/index.js +0 -7
- package/dist/services/withdrawals/service.d.ts +0 -4
- package/dist/services/withdrawals/service.d.ts.map +0 -1
- package/dist/services/withdrawals/service.js +0 -5
- package/dist/services/withdrawals/types.d.ts +0 -81
- package/dist/services/withdrawals/types.d.ts.map +0 -1
- package/dist/services/withdrawals/types.js +0 -1
- package/dist/services/withdrawals/utils.d.ts +0 -20
- package/dist/services/withdrawals/utils.d.ts.map +0 -1
- package/dist/services/withdrawals/utils.js +0 -110
- package/dist/services/withdrawals/withdrawal_liquidations/index.d.ts +0 -3
- package/dist/services/withdrawals/withdrawal_liquidations/index.d.ts.map +0 -1
- package/dist/services/withdrawals/withdrawal_liquidations/index.js +0 -2
- package/dist/services/withdrawals/withdrawal_liquidations/service.d.ts +0 -8
- package/dist/services/withdrawals/withdrawal_liquidations/service.d.ts.map +0 -1
- package/dist/services/withdrawals/withdrawal_liquidations/service.js +0 -68
- package/dist/services/withdrawals/withdrawal_liquidations/types.d.ts +0 -2
- package/dist/services/withdrawals/withdrawal_liquidations/types.d.ts.map +0 -1
- package/dist/services/withdrawals/withdrawal_liquidations/types.js +0 -1
- package/dist/services/withdrawals/withdrawal_requests/index.d.ts +0 -3
- package/dist/services/withdrawals/withdrawal_requests/index.d.ts.map +0 -1
- package/dist/services/withdrawals/withdrawal_requests/index.js +0 -2
- package/dist/services/withdrawals/withdrawal_requests/service.d.ts +0 -7
- package/dist/services/withdrawals/withdrawal_requests/service.d.ts.map +0 -1
- package/dist/services/withdrawals/withdrawal_requests/service.js +0 -55
- package/dist/services/withdrawals/withdrawal_requests/types.d.ts +0 -2
- package/dist/services/withdrawals/withdrawal_requests/types.d.ts.map +0 -1
- package/dist/services/withdrawals/withdrawal_requests/types.js +0 -1
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { webApiClient } from '../../api/apiClient';
|
|
2
|
-
import { API_ENDPOINTS } from './constants';
|
|
3
|
-
/**
|
|
4
|
-
* Fetch list of instruments with optional filtering
|
|
5
|
-
*/
|
|
6
|
-
export const getInstruments = (params) => {
|
|
7
|
-
// Transform parameters for the API
|
|
8
|
-
const transformedParams = { ...params };
|
|
9
|
-
// Handle boolean values
|
|
10
|
-
if (params?.is_etf !== undefined) {
|
|
11
|
-
transformedParams.is_etf = params.is_etf;
|
|
12
|
-
}
|
|
13
|
-
if (params?.is_fund !== undefined) {
|
|
14
|
-
transformedParams.is_fund = params.is_fund;
|
|
15
|
-
}
|
|
16
|
-
// Handle price parameters - convert to strings for API
|
|
17
|
-
const apiParams = { ...transformedParams };
|
|
18
|
-
if (params?.min_price !== undefined) {
|
|
19
|
-
apiParams.min_price = params.min_price.toString();
|
|
20
|
-
}
|
|
21
|
-
if (params?.max_price !== undefined) {
|
|
22
|
-
apiParams.max_price = params.max_price.toString();
|
|
23
|
-
}
|
|
24
|
-
return webApiClient.get(API_ENDPOINTS.INSTRUMENTS, {
|
|
25
|
-
params: apiParams,
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Get instrument details by UUID
|
|
30
|
-
*/
|
|
31
|
-
export const getInstrumentByUuid = (uuid) => {
|
|
32
|
-
return webApiClient.get(`${API_ENDPOINTS.INSTRUMENTS}${uuid}/`);
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Get instrument historical data/snapshots
|
|
36
|
-
*/
|
|
37
|
-
export const getInstrumentSnapshots = (instrumentUuid) => {
|
|
38
|
-
return webApiClient.get(`${API_ENDPOINTS.INSTRUMENTS}${instrumentUuid}/snapshots/`);
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Get instrument historical data/snapshots with date filtering
|
|
42
|
-
*/
|
|
43
|
-
export const getInstrumentSnapshotsFiltered = (instrumentUuid, params) => {
|
|
44
|
-
return webApiClient.get(`${API_ENDPOINTS.INSTRUMENTS}${instrumentUuid}/snapshots/`, {
|
|
45
|
-
params,
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Batch fetch snapshots for multiple instruments with date filtering
|
|
50
|
-
* This optimizes API calls by using Promise.all with proper error handling
|
|
51
|
-
*/
|
|
52
|
-
export const getBatchInstrumentSnapshots = async (requests) => {
|
|
53
|
-
const promises = requests.map(async ({ instrumentUuid, ...params }) => {
|
|
54
|
-
try {
|
|
55
|
-
const response = await getInstrumentSnapshotsFiltered(instrumentUuid, params);
|
|
56
|
-
return {
|
|
57
|
-
instrumentUuid,
|
|
58
|
-
data: response.data,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
console.error(`Failed to fetch snapshots for instrument ${instrumentUuid}:`, error);
|
|
63
|
-
return {
|
|
64
|
-
instrumentUuid,
|
|
65
|
-
error: error instanceof Error ? error.message : 'Failed to fetch data',
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
return Promise.all(promises);
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Search instruments by symbol or name
|
|
73
|
-
*/
|
|
74
|
-
export const searchInstruments = (searchTerm, params) => {
|
|
75
|
-
return getInstruments({
|
|
76
|
-
...params,
|
|
77
|
-
search: searchTerm,
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* Get instruments by exchange
|
|
82
|
-
*/
|
|
83
|
-
export const getInstrumentsByExchange = (exchangeUuid, params) => {
|
|
84
|
-
return getInstruments({
|
|
85
|
-
...params,
|
|
86
|
-
exchange_uuid: exchangeUuid,
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Get ETFs only
|
|
91
|
-
*/
|
|
92
|
-
export const getETFs = (params) => {
|
|
93
|
-
return getInstruments({
|
|
94
|
-
...params,
|
|
95
|
-
is_etf: true,
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Get mutual funds only
|
|
100
|
-
*/
|
|
101
|
-
export const getFunds = (params) => {
|
|
102
|
-
return getInstruments({
|
|
103
|
-
...params,
|
|
104
|
-
is_fund: true,
|
|
105
|
-
});
|
|
106
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type { PaginatedResponse, PaginationParams, OrderingParams } from '../../api/types';
|
|
2
|
-
/**
|
|
3
|
-
* Core instrument entity
|
|
4
|
-
*/
|
|
5
|
-
export interface Instrument {
|
|
6
|
-
uuid: string;
|
|
7
|
-
exchange: string;
|
|
8
|
-
exchangeName: string;
|
|
9
|
-
country: string;
|
|
10
|
-
countryName: string;
|
|
11
|
-
industry: string;
|
|
12
|
-
industryName: string;
|
|
13
|
-
sector: string;
|
|
14
|
-
sectorName: string;
|
|
15
|
-
symbol: string;
|
|
16
|
-
name: string;
|
|
17
|
-
currentPrice: string;
|
|
18
|
-
currency: string | null;
|
|
19
|
-
isEtf: boolean;
|
|
20
|
-
isFund: boolean;
|
|
21
|
-
isActive: boolean;
|
|
22
|
-
isActivelyTrading: boolean;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Market data for instruments
|
|
26
|
-
*/
|
|
27
|
-
export interface MarketData {
|
|
28
|
-
pe: string | null;
|
|
29
|
-
eps: string | null;
|
|
30
|
-
volume: number;
|
|
31
|
-
dayLow: string | null;
|
|
32
|
-
dayHigh: string | null;
|
|
33
|
-
yearLow: string | null;
|
|
34
|
-
yearHigh: string | null;
|
|
35
|
-
avgVolume: number | null;
|
|
36
|
-
marketCap: string | null;
|
|
37
|
-
openPrice: string | null;
|
|
38
|
-
priceAvg50: string | null;
|
|
39
|
-
priceAvg200: string | null;
|
|
40
|
-
previousClose: string | null;
|
|
41
|
-
sharesOutstanding: number | null;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Instrument snapshot with historical price data
|
|
45
|
-
*/
|
|
46
|
-
export interface InstrumentSnapshot {
|
|
47
|
-
uuid: string;
|
|
48
|
-
price: string;
|
|
49
|
-
change: string;
|
|
50
|
-
changePercent: string;
|
|
51
|
-
marketData: MarketData;
|
|
52
|
-
sourceTimestamp: string;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Lightweight instrument reference used in some contexts
|
|
56
|
-
*/
|
|
57
|
-
export interface InstrumentReference {
|
|
58
|
-
uuid: string;
|
|
59
|
-
symbol: string;
|
|
60
|
-
name: string;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Query parameters for filtering instruments
|
|
64
|
-
*/
|
|
65
|
-
export interface InstrumentsQueryParams extends PaginationParams, OrderingParams {
|
|
66
|
-
uuid?: string;
|
|
67
|
-
symbol?: string;
|
|
68
|
-
name?: string;
|
|
69
|
-
exchange_uuid?: string;
|
|
70
|
-
exchange_short_name?: string;
|
|
71
|
-
portfolio_uuid?: string;
|
|
72
|
-
is_etf?: boolean;
|
|
73
|
-
is_fund?: boolean;
|
|
74
|
-
sector_uuid?: string;
|
|
75
|
-
industry_uuid?: string;
|
|
76
|
-
country_uuid?: string;
|
|
77
|
-
min_price?: number;
|
|
78
|
-
max_price?: number;
|
|
79
|
-
search?: string;
|
|
80
|
-
}
|
|
81
|
-
export type PaginatedInstruments = PaginatedResponse<Instrument>;
|
|
82
|
-
export type { InstrumentType, InstrumentStatus, TradingStatus, } from './constants';
|
|
83
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/instruments/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB,EAAE,cAAc;IAC9E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAGD,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAGjE,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,aAAa,GACd,MAAM,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { Instrument, InstrumentSnapshot, MarketData } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Format instrument price with currency symbol
|
|
4
|
-
*/
|
|
5
|
-
export declare const formatInstrumentPrice: (price: string, currency?: string | null) => string;
|
|
6
|
-
/**
|
|
7
|
-
* Get currency symbol for display
|
|
8
|
-
*/
|
|
9
|
-
export declare const getCurrencySymbol: (currency?: string | null) => string;
|
|
10
|
-
/**
|
|
11
|
-
* Determine instrument type based on flags
|
|
12
|
-
*/
|
|
13
|
-
export declare const getInstrumentType: (instrument: Instrument) => string;
|
|
14
|
-
/**
|
|
15
|
-
* Format instrument display name with symbol
|
|
16
|
-
*/
|
|
17
|
-
export declare const formatInstrumentName: (instrument: Instrument) => string;
|
|
18
|
-
/**
|
|
19
|
-
* Calculate price change from snapshot
|
|
20
|
-
*/
|
|
21
|
-
export declare const calculatePriceChange: (snapshot: InstrumentSnapshot) => {
|
|
22
|
-
change: number;
|
|
23
|
-
changePercent: number;
|
|
24
|
-
isPositive: boolean;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Format price change with appropriate color class
|
|
28
|
-
*/
|
|
29
|
-
export declare const formatPriceChange: (snapshot: InstrumentSnapshot) => {
|
|
30
|
-
changeText: string;
|
|
31
|
-
changePercentText: string;
|
|
32
|
-
colorClass: string;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Check if instrument is actively tradeable
|
|
36
|
-
*/
|
|
37
|
-
export declare const isInstrumentTradeable: (instrument: Instrument) => boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Format market cap value
|
|
40
|
-
*/
|
|
41
|
-
export declare const formatMarketCap: (marketData: MarketData) => string;
|
|
42
|
-
/**
|
|
43
|
-
* Format trading volume
|
|
44
|
-
*/
|
|
45
|
-
export declare const formatVolume: (volume: number) => string;
|
|
46
|
-
/**
|
|
47
|
-
* Check if market data is available
|
|
48
|
-
*/
|
|
49
|
-
export declare const hasMarketData: (marketData: MarketData) => boolean;
|
|
50
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/services/instruments/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAS1E;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,MAAM,EAAE,WAAW,MAAM,GAAG,IAAI,KAAG,MAM/E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,GAAG,IAAI,KAAG,MAa5D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,YAAY,UAAU,KAAG,MAI1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,YAAY,UAAU,KAAG,MAE7D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,kBAAkB,KAC3B;IACD,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;CAUrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,kBAAkB,KAC3B;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CAapB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,YAAY,UAAU,KAAG,OAE9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,YAAY,UAAU,KAAG,MAUxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,KAAG,MAK7C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,YAAY,UAAU,KAAG,OAEtD,CAAC"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { INSTRUMENT_TYPE_ETF, INSTRUMENT_TYPE_FUND, INSTRUMENT_TYPE_STOCK, CURRENCY_USD, CURRENCY_AUD, } from './constants';
|
|
2
|
-
/**
|
|
3
|
-
* Format instrument price with currency symbol
|
|
4
|
-
*/
|
|
5
|
-
export const formatInstrumentPrice = (price, currency) => {
|
|
6
|
-
const numericPrice = parseFloat(price);
|
|
7
|
-
if (isNaN(numericPrice))
|
|
8
|
-
return price;
|
|
9
|
-
const currencySymbol = getCurrencySymbol(currency);
|
|
10
|
-
return `${currencySymbol}${numericPrice.toFixed(2)}`;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Get currency symbol for display
|
|
14
|
-
*/
|
|
15
|
-
export const getCurrencySymbol = (currency) => {
|
|
16
|
-
switch (currency) {
|
|
17
|
-
case CURRENCY_USD:
|
|
18
|
-
return '$';
|
|
19
|
-
case CURRENCY_AUD:
|
|
20
|
-
return 'A$';
|
|
21
|
-
case 'EUR':
|
|
22
|
-
return '€';
|
|
23
|
-
case 'GBP':
|
|
24
|
-
return '£';
|
|
25
|
-
default:
|
|
26
|
-
return '$'; // Default to USD symbol
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Determine instrument type based on flags
|
|
31
|
-
*/
|
|
32
|
-
export const getInstrumentType = (instrument) => {
|
|
33
|
-
if (instrument.isEtf)
|
|
34
|
-
return INSTRUMENT_TYPE_ETF;
|
|
35
|
-
if (instrument.isFund)
|
|
36
|
-
return INSTRUMENT_TYPE_FUND;
|
|
37
|
-
return INSTRUMENT_TYPE_STOCK;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Format instrument display name with symbol
|
|
41
|
-
*/
|
|
42
|
-
export const formatInstrumentName = (instrument) => {
|
|
43
|
-
return `${instrument.symbol} - ${instrument.name}`;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Calculate price change from snapshot
|
|
47
|
-
*/
|
|
48
|
-
export const calculatePriceChange = (snapshot) => {
|
|
49
|
-
const change = parseFloat(snapshot.change);
|
|
50
|
-
const changePercent = parseFloat(snapshot.changePercent);
|
|
51
|
-
return {
|
|
52
|
-
change,
|
|
53
|
-
changePercent,
|
|
54
|
-
isPositive: change >= 0,
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Format price change with appropriate color class
|
|
59
|
-
*/
|
|
60
|
-
export const formatPriceChange = (snapshot) => {
|
|
61
|
-
const { change, changePercent, isPositive } = calculatePriceChange(snapshot);
|
|
62
|
-
const changeText = `${isPositive ? '+' : ''}${change.toFixed(2)}`;
|
|
63
|
-
const changePercentText = `${isPositive ? '+' : ''}${changePercent.toFixed(2)}%`;
|
|
64
|
-
const colorClass = isPositive ? 'text-positive' : 'text-negative';
|
|
65
|
-
return {
|
|
66
|
-
changeText,
|
|
67
|
-
changePercentText,
|
|
68
|
-
colorClass,
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Check if instrument is actively tradeable
|
|
73
|
-
*/
|
|
74
|
-
export const isInstrumentTradeable = (instrument) => {
|
|
75
|
-
return instrument.isActive && instrument.isActivelyTrading;
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* Format market cap value
|
|
79
|
-
*/
|
|
80
|
-
export const formatMarketCap = (marketData) => {
|
|
81
|
-
if (!marketData.marketCap)
|
|
82
|
-
return 'N/A';
|
|
83
|
-
const marketCap = parseFloat(marketData.marketCap);
|
|
84
|
-
if (isNaN(marketCap))
|
|
85
|
-
return 'N/A';
|
|
86
|
-
if (marketCap >= 1e12)
|
|
87
|
-
return `$${(marketCap / 1e12).toFixed(1)}T`;
|
|
88
|
-
if (marketCap >= 1e9)
|
|
89
|
-
return `$${(marketCap / 1e9).toFixed(1)}B`;
|
|
90
|
-
if (marketCap >= 1e6)
|
|
91
|
-
return `$${(marketCap / 1e6).toFixed(1)}M`;
|
|
92
|
-
return `$${marketCap.toFixed(0)}`;
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Format trading volume
|
|
96
|
-
*/
|
|
97
|
-
export const formatVolume = (volume) => {
|
|
98
|
-
if (volume >= 1e9)
|
|
99
|
-
return `${(volume / 1e9).toFixed(1)}B`;
|
|
100
|
-
if (volume >= 1e6)
|
|
101
|
-
return `${(volume / 1e6).toFixed(1)}M`;
|
|
102
|
-
if (volume >= 1e3)
|
|
103
|
-
return `${(volume / 1e3).toFixed(1)}K`;
|
|
104
|
-
return volume.toString();
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Check if market data is available
|
|
108
|
-
*/
|
|
109
|
-
export const hasMarketData = (marketData) => {
|
|
110
|
-
return Boolean(marketData.openPrice || marketData.dayHigh || marketData.dayLow || marketData.volume);
|
|
111
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Portfolio templates API constants
|
|
3
|
-
*/
|
|
4
|
-
export declare const API_ENDPOINTS: {
|
|
5
|
-
readonly PORTFOLIO_TEMPLATES: "/api/portfolio-templates/";
|
|
6
|
-
readonly PORTFOLIO_TEMPLATES_RECOMMENDED: "/api/portfolio-templates/recommended/";
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/services/portfolio_templates/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,aAAa;;;CAGhB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/portfolio_templates/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { PortfolioTemplate, TargetAssetAllocation, ApplyTemplateResponse, PaginatedPortfolioTemplates } from './types';
|
|
2
|
-
export declare const getPortfolioTemplates: () => Promise<import("axios").AxiosResponse<PaginatedPortfolioTemplates, any>>;
|
|
3
|
-
export declare const getRecommendedPortfolioTemplate: () => Promise<import("axios").AxiosResponse<PortfolioTemplate, any>>;
|
|
4
|
-
export declare const getPortfolioTemplateAllocations: (templateUuid: string) => Promise<import("axios").AxiosResponse<TargetAssetAllocation[], any>>;
|
|
5
|
-
export declare const applyPortfolioTemplate: (templateUuid: string) => Promise<import("axios").AxiosResponse<ApplyTemplateResponse, any>>;
|
|
6
|
-
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/services/portfolio_templates/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,qBAAqB,gFAEjC,CAAC;AAEF,eAAO,MAAM,+BAA+B,sEAE3C,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,cAAc,MAAM,yEAEnE,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,cAAc,MAAM,uEAE1D,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { webApiClient } from '../../api/apiClient';
|
|
2
|
-
import { API_ENDPOINTS } from './constants';
|
|
3
|
-
export const getPortfolioTemplates = () => {
|
|
4
|
-
return webApiClient.get(API_ENDPOINTS.PORTFOLIO_TEMPLATES);
|
|
5
|
-
};
|
|
6
|
-
export const getRecommendedPortfolioTemplate = () => {
|
|
7
|
-
return webApiClient.get(API_ENDPOINTS.PORTFOLIO_TEMPLATES_RECOMMENDED);
|
|
8
|
-
};
|
|
9
|
-
export const getPortfolioTemplateAllocations = (templateUuid) => {
|
|
10
|
-
return webApiClient.get(`${API_ENDPOINTS.PORTFOLIO_TEMPLATES}${templateUuid}/allocations/`);
|
|
11
|
-
};
|
|
12
|
-
export const applyPortfolioTemplate = (templateUuid) => {
|
|
13
|
-
return webApiClient.post(`${API_ENDPOINTS.PORTFOLIO_TEMPLATES}${templateUuid}/apply/`, {});
|
|
14
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { PaginatedResponse } from '../../api/types';
|
|
2
|
-
export interface Instrument {
|
|
3
|
-
uuid: string;
|
|
4
|
-
symbol: string;
|
|
5
|
-
name: string;
|
|
6
|
-
instrumentType: string;
|
|
7
|
-
sector?: string;
|
|
8
|
-
stockExchange?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface Portfolio {
|
|
11
|
-
uuid: string;
|
|
12
|
-
name: string;
|
|
13
|
-
description: string;
|
|
14
|
-
isActive: boolean;
|
|
15
|
-
createdAt?: string;
|
|
16
|
-
updatedAt?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface PortfolioTemplate {
|
|
19
|
-
uuid: string;
|
|
20
|
-
name: string;
|
|
21
|
-
description: string;
|
|
22
|
-
isActive: boolean;
|
|
23
|
-
riskLevel: string;
|
|
24
|
-
createdAt?: string;
|
|
25
|
-
updatedAt?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface TargetAssetAllocation {
|
|
28
|
-
uuid: string;
|
|
29
|
-
instrument: Instrument;
|
|
30
|
-
percentage: string;
|
|
31
|
-
}
|
|
32
|
-
export interface AssetAllocation {
|
|
33
|
-
instrument: {
|
|
34
|
-
symbol: string;
|
|
35
|
-
name: string;
|
|
36
|
-
};
|
|
37
|
-
percentage: string;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Response when applying a portfolio template
|
|
41
|
-
*/
|
|
42
|
-
export interface ApplyTemplateResponse {
|
|
43
|
-
success: boolean;
|
|
44
|
-
message: string;
|
|
45
|
-
portfolio: Portfolio;
|
|
46
|
-
allocations: AssetAllocation[];
|
|
47
|
-
}
|
|
48
|
-
export type PaginatedPortfolioTemplates = PaginatedResponse<PortfolioTemplate>;
|
|
49
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/portfolio_templates/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE;QACV,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,eAAe,EAAE,CAAC;CAChC;AAGD,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const calculateTotalAllocation: (allocations: {
|
|
2
|
-
percentage: string;
|
|
3
|
-
}[]) => number;
|
|
4
|
-
export declare const validateAllocationPercentages: (allocations: {
|
|
5
|
-
percentage: string;
|
|
6
|
-
}[]) => boolean;
|
|
7
|
-
export declare const formatRiskLevel: (riskLevel: string) => string;
|
|
8
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/services/portfolio_templates/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,GAAI,aAAa;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,EAAE,KAAG,MAIhF,CAAC;AAEF,eAAO,MAAM,6BAA6B,GAAI,aAAa;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,EAAE,KAAG,OAGrF,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,WAAW,MAAM,KAAG,MAEnD,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Portfolio template utilities and helper functions
|
|
2
|
-
export const calculateTotalAllocation = (allocations) => {
|
|
3
|
-
return allocations.reduce((total, allocation) => {
|
|
4
|
-
return total + parseFloat(allocation.percentage || '0');
|
|
5
|
-
}, 0);
|
|
6
|
-
};
|
|
7
|
-
export const validateAllocationPercentages = (allocations) => {
|
|
8
|
-
const total = calculateTotalAllocation(allocations);
|
|
9
|
-
return Math.abs(total - 100) < 0.01; // Allow for small floating point differences
|
|
10
|
-
};
|
|
11
|
-
export const formatRiskLevel = (riskLevel) => {
|
|
12
|
-
return riskLevel.charAt(0).toUpperCase() + riskLevel.slice(1).toLowerCase();
|
|
13
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/portfolios/allocations/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { AssetAllocation, AssetAllocationPayload } from './types';
|
|
2
|
-
export declare const getPortfolioAllocations: (portfolioUuid: string) => Promise<import("axios").AxiosResponse<AssetAllocation[], any>>;
|
|
3
|
-
export declare const createAssetAllocation: (data: AssetAllocationPayload) => Promise<import("axios").AxiosResponse<AssetAllocation, any>>;
|
|
4
|
-
export declare const updateAssetAllocation: (uuid: string, data: Partial<AssetAllocationPayload>) => Promise<import("axios").AxiosResponse<AssetAllocation, any>>;
|
|
5
|
-
export declare const deleteAssetAllocation: (uuid: string) => Promise<import("axios").AxiosResponse<void, any>>;
|
|
6
|
-
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/portfolios/allocations/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAKvE,eAAO,MAAM,uBAAuB,GAAI,eAAe,MAAM,mEAK5D,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,MAAM,sBAAsB,iEAEjE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,EAAE,MAAM,OAAO,CAAC,sBAAsB,CAAC,iEAExF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,sDAEjD,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { webApiClient } from '../../../api/apiClient';
|
|
2
|
-
import { API_ENDPOINTS } from '../constants';
|
|
3
|
-
// ASSET ALLOCATIONS API FUNCTIONS
|
|
4
|
-
// Fetch allocations for a specific portfolio
|
|
5
|
-
export const getPortfolioAllocations = (portfolioUuid) => {
|
|
6
|
-
// Always sort by created_at to show allocations in their creation order
|
|
7
|
-
return webApiClient.get(`${API_ENDPOINTS.PORTFOLIOS}${portfolioUuid}/allocations/`, {
|
|
8
|
-
params: { order_by: 'created_at' },
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
export const createAssetAllocation = (data) => {
|
|
12
|
-
return webApiClient.post(API_ENDPOINTS.ASSET_ALLOCATIONS, data);
|
|
13
|
-
};
|
|
14
|
-
export const updateAssetAllocation = (uuid, data) => {
|
|
15
|
-
return webApiClient.patch(`${API_ENDPOINTS.ASSET_ALLOCATIONS}${uuid}/`, data);
|
|
16
|
-
};
|
|
17
|
-
export const deleteAssetAllocation = (uuid) => {
|
|
18
|
-
return webApiClient.delete(`${API_ENDPOINTS.ASSET_ALLOCATIONS}${uuid}/`);
|
|
19
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Asset Allocations types and interfaces
|
|
3
|
-
*/
|
|
4
|
-
export interface AssetAllocation {
|
|
5
|
-
uuid: string;
|
|
6
|
-
portfolio: string;
|
|
7
|
-
instrument: string;
|
|
8
|
-
instrumentName: string;
|
|
9
|
-
instrumentSymbol: string;
|
|
10
|
-
percentage: string;
|
|
11
|
-
}
|
|
12
|
-
export interface AssetAllocationPayload {
|
|
13
|
-
portfolio: string;
|
|
14
|
-
instrument: string;
|
|
15
|
-
percentage: string | number;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/services/portfolios/allocations/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB;AAGD,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/services/portfolios/allocations/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK/C,eAAO,MAAM,mBAAmB,GAAI,aAAa,eAAe,EAAE,KAAG,OAKpE,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// ASSET ALLOCATIONS UTILITY FUNCTIONS
|
|
2
|
-
// Utility function to validate if allocation percentages sum to 100%
|
|
3
|
-
export const validateAllocations = (allocations) => {
|
|
4
|
-
const totalPercentage = allocations.reduce((sum, allocation) => sum + parseFloat(allocation.percentage), 0);
|
|
5
|
-
// Allow for small floating point errors (e.g., 99.99 or 100.01)
|
|
6
|
-
return Math.abs(totalPercentage - 100) < 0.01;
|
|
7
|
-
};
|