Skip to content

Instantly share code, notes, and snippets.

@ahouts
Created October 31, 2025 15:06
Show Gist options
  • Select an option

  • Save ahouts/b7cd6f6970b8e592984364c5e26c5e99 to your computer and use it in GitHub Desktop.

Select an option

Save ahouts/b7cd6f6970b8e592984364c5e26c5e99 to your computer and use it in GitHub Desktop.
Selecting the most recent fee trade for a portfolio
SELECT id
FROM trades
WHERE portfolio_id = :portfolio_id
AND type = 'fee'
ORDER BY date DESC
LIMIT 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment