Created
March 25, 2024 19:12
-
-
Save tadcrazio/ead54cc660bcf553fe506a265f1982ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Specify the path to your input and output CSV files | |
$inputCSV = "PathToKoinyTransactionFile.csv" | |
$outputCSV = "PathToExport.csv" | |
# Import the input CSV data | |
$data = Import-Csv $inputCSV -Delimiter ',' | |
# Process each row of the input CSV | |
$results = $data | ForEach-Object { | |
# Calculate Net Value in USD (Assuming Gain is already in USD) | |
$netValueUSD = [decimal]$_.SentCostBasis + [decimal]$_.GainUSD + [decimal]$_.FeeValueUSD | |
# Create a new object (row) for the output CSV | |
[PSCustomObject]@{ | |
Date = $_.Date | |
Type = $_.Type | |
'Sent Asset' = $_.'Sent Currency' | |
'Sent Amount' = $_.'Sent Amount' | |
'Received Asset' = $_.'Received Currency' | |
'Received Amount' = $_.'Received Amount' | |
'Fee Asset' = $_.'Fee Currency' | |
'Fee Amount' = $_.'Fee Amount' | |
'Market Value Currency' = 'USD' # Assuming market value in USD | |
'Market Value' = $_.'Net Value (USD)' | |
Description = $_.Description | |
'Transaction Hash' = $_.TxHash | |
'Transaction ID' = ''; # Leave blank if you don't have Transaction IDs | |
} | |
} | |
# Export the modified data to the output CSV | |
$results | Export-Csv -Path $outputCSV -NoTypeInformation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment