Friday, November 4, 2022

Rust pop-quiz: PnL

Okay.


... how many entries do you read contain the word 'thereof' unironically, huh?

Now:

1. given a set of assets, prices, amounts
2. compute PnL* of a trade

*PnL: 'profit and loss'

The start-state of assets is here.

You can test-run PnL against mini-me.csv.

And then do a full-blown run against trades.csv.

BONUS


Besides printing each trade and its PnL, ...

Given the current assets and the trades for a day, print the total profit (or loss) and then the new set of assets at the end of the trading day.

No comments:

Post a Comment