Skip to content

Find tax loss harvesting opportunities

GET
/api/calculate/reports/tax-loss-opportunities/{address}
curl --request GET \
--url 'https://api.qeychain.xyz/api/calculate/reports/tax-loss-opportunities/example?tax_rate=0.25&min_loss=100'

Identifies positions with unrealized losses that can be sold to offset capital gains.

Tax loss harvesting strategy:
1. Sell assets with unrealized losses to realize the loss
2. Use realized losses to offset capital gains, reducing tax liability
3. Optionally, rebuy the asset after 30+ days to avoid wash sale rules

**Wash Sale Warning**: If the same asset was sold within the last 30 days,
the endpoint flags a warning. Selling and rebuying the same asset within 30 days
triggers IRS wash sale rules, disallowing the loss deduction.

NOTE: As of 2026, wash sale rules do NOT apply to cryptoassets (IRC Section 1091).
However, this may change with future legislation, so warnings are included.

Returns opportunities sorted by potential tax savings (highest first).
address
required
Address
string
tax_rate
Tax Rate

Estimated tax rate (0-1, default 0.25 = 25%)

number
default: 0.25 <= 1

Estimated tax rate (0-1, default 0.25 = 25%)

min_loss
Min Loss

Minimum unrealized loss to include (default $100)

number
default: 100

Minimum unrealized loss to include (default $100)

owned_wallets
Any of:
Array<string>

All wallet addresses owned by the user (for internal transfer detection)

Successful Response

Media typeapplication/json
Examplegenerated
example

Bad Request

Media typeapplication/json
ErrorResponse

Standard error response.

object
detail
required
Detail

Error message

string
error_code
Any of:
string
Examplegenerated
{
"detail": "example",
"error_code": "example"
}

Not Found

Media typeapplication/json
ErrorResponse

Standard error response.

object
detail
required
Detail

Error message

string
error_code
Any of:
string
Examplegenerated
{
"detail": "example",
"error_code": "example"
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}

Internal Server Error

Media typeapplication/json
ErrorResponse

Standard error response.

object
detail
required
Detail

Error message

string
error_code
Any of:
string
Examplegenerated
{
"detail": "example",
"error_code": "example"
}