Use Cash History report for true after-fee daily P&L, Fills FIFO as fallback
- Primary: Cash History report sums non-Fund-Transaction Deltas per day, capturing broker platform fees not present in the Fills report - Fallback: Fills + FIFO used when Cash History 404s (passed/completed accounts) - Extracts requestReport() as shared helper to reduce duplication - debug PATCH endpoint now accepts optional `name` param to test any report Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
570a54fe60
commit
8848f90b11
@@ -103,12 +103,12 @@ export async function PATCH(req: Request) {
|
||||
|
||||
// Full report cycle
|
||||
if (payload.action === 'report') {
|
||||
const { account, startDate, endDate } = payload;
|
||||
const { account, startDate, endDate, name: reportName = 'Fills' } = payload;
|
||||
try {
|
||||
let reportData = (await axios.post(
|
||||
'https://rpt-demo.tradovateapi.com/v1/reports/requestreport',
|
||||
{
|
||||
name: 'Fills', representationType: 'json', timezone: -300,
|
||||
name: reportName, representationType: 'json', timezone: -300,
|
||||
params: [
|
||||
{ name: 'startDate', value: startDate },
|
||||
{ name: 'endDate', value: endDate },
|
||||
|
||||
Reference in New Issue
Block a user