How to use it
- Enter the amount borrowed, in CAD.
- Enter the price spread you observe, as a percentage.
- Enter the flash-loan fee, the swap fee per trade and the number of swaps.
- Enter the gas cost of the transaction in CAD.
- Read the net result and the breakeven spread.
What makes a flash loan different
An ordinary loan needs collateral because the borrower might not repay. A flash loan needs none because the loan, whatever is done with the funds, and the repayment all happen inside one atomic transaction. If the repayment plus fee is not there at the end, the whole transaction reverts as if it never happened, and the only cost is the gas spent on the failed attempt.
Flash loans are used for arbitrage, for refinancing collateral from one position to another and for liquidations. They have also been used in attacks that manipulate thinly traded prices; the defence against those is sound price-feed design, covered in oracle risk. This calculator covers only the fee arithmetic.
Worked example
Illustrative inputs: borrow $100,000, observe a 0.4% spread between two pools, pay a 0.05% flash-loan fee and two swaps at 0.3% each, and spend $40 on gas.
The swap fees alone come to 0.6% of the amount, more than the spread. Borrowing ten times as much does not help: at $1,000,000 the result is −$2,540 and the breakeven spread is still about 0.65%, because every cost except gas grows with size.
| Item | CAD |
|---|---|
| Gross spread (0.4% of $100,000) | +$400.00 |
| Flash-loan fee (0.05%) | −$50.00 |
| Swap fees (2 × 0.3%) | −$600.00 |
| Gas | −$40.00 |
| Net result | −$290.00 |
| Breakeven spread | 0.69% |
Why visible spreads usually disappear
Most apparent spreads are smaller than the round-trip cost of fees. The few that are not do not last: automated traders scan for them continuously and compete to be included first in a block, often by paying higher priority fees, which raises gas for everyone in the race.
The calculator also treats the quoted spread as if it could be captured on the full amount. In reality, trading a large amount through a pool moves its price against you, so the spread shrinks as size grows. The MEV calculator shows how fast price impact grows in a constant-product pool.
What the calculator leaves out
It does not model price impact, competing transactions, priority fees, failure rates, or the cost of writing and reviewing contract code. It charges each swap on the full borrowed amount. Treat a positive result as a reason to check more inputs, not as a profit.
Fee levels differ between lending protocols and can be changed by governance decisions; the inputs here are illustrative only.
For most people, the practical lesson concerns the protocols they deposit into rather than flash loans themselves. Because anyone can borrow a very large amount for the length of one transaction, a protocol that values assets from a single pool's momentary price can be pushed off balance within that transaction. When assessing where to deposit, look at how a protocol sources its prices; oracle risk explains what to check.
Canadian context
CRA weighs how often you transact, how long you hold, your knowledge of crypto markets and the time you spend when deciding whether gains are business income. Repeated arbitrage of this kind is more likely to be treated as business income than as capital gains; see capital vs business income.
Even one transaction can contain several trades of one crypto-asset for another, each of which can be a disposition with its own CAD value to record.
