|
|
@ -329,19 +329,39 @@ export class OrderService { |
|
|
* performance tracking based on exchange rate fluctuations. |
|
|
* performance tracking based on exchange rate fluctuations. |
|
|
* |
|
|
* |
|
|
* @param cashDetails - The cash balance details. |
|
|
* @param cashDetails - The cash balance details. |
|
|
|
|
|
* @param filters - Optional filters to apply. |
|
|
* @param userCurrency - The base currency of the user. |
|
|
* @param userCurrency - The base currency of the user. |
|
|
* @param userId - The ID of the user. |
|
|
* @param userId - The ID of the user. |
|
|
* @returns A response containing the list of synthetic cash activities. |
|
|
* @returns A response containing the list of synthetic cash activities. |
|
|
*/ |
|
|
*/ |
|
|
public async getCashOrders({ |
|
|
public async getCashOrders({ |
|
|
cashDetails, |
|
|
cashDetails, |
|
|
|
|
|
filters = [], |
|
|
userCurrency, |
|
|
userCurrency, |
|
|
userId |
|
|
userId |
|
|
}: { |
|
|
}: { |
|
|
cashDetails: CashDetails; |
|
|
cashDetails: CashDetails; |
|
|
|
|
|
filters?: Filter[]; |
|
|
userCurrency: string; |
|
|
userCurrency: string; |
|
|
userId: string; |
|
|
userId: string; |
|
|
}): Promise<ActivitiesResponse> { |
|
|
}): Promise<ActivitiesResponse> { |
|
|
|
|
|
const filtersByAssetClass = filters.filter(({ type }) => { |
|
|
|
|
|
return type === 'ASSET_CLASS'; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
filtersByAssetClass.length > 0 && |
|
|
|
|
|
!filtersByAssetClass.find(({ id }) => { |
|
|
|
|
|
return id === AssetClass.LIQUIDITY; |
|
|
|
|
|
}) |
|
|
|
|
|
) { |
|
|
|
|
|
// If asset class filters are present and none of them is liquidity, return an empty response
|
|
|
|
|
|
return { |
|
|
|
|
|
activities: [], |
|
|
|
|
|
count: 0 |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const activities: Activity[] = []; |
|
|
const activities: Activity[] = []; |
|
|
|
|
|
|
|
|
for (const account of cashDetails.accounts) { |
|
|
for (const account of cashDetails.accounts) { |
|
|
@ -755,6 +775,7 @@ export class OrderService { |
|
|
|
|
|
|
|
|
const cashOrders = await this.getCashOrders({ |
|
|
const cashOrders = await this.getCashOrders({ |
|
|
cashDetails, |
|
|
cashDetails, |
|
|
|
|
|
filters, |
|
|
userCurrency, |
|
|
userCurrency, |
|
|
userId |
|
|
userId |
|
|
}); |
|
|
}); |
|
|
|