-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathavax.py
More file actions
18 lines (16 loc) · 863 Bytes
/
Copy pathavax.py
File metadata and controls
18 lines (16 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import csv
import datetime
if __name__ == '__main__':
avax = open("input/avax", "r")
output_lines = []
for line in avax.readlines():
timestamp, tradeType, amount, currency, size_usd, fee = line.split(',')
timestamp2 = datetime.datetime.strptime(timestamp, "%m-%d-%YT%H:%M:%S").strftime("%Y-%m-%dT%H:%M:%S")
if tradeType == 'Buy':
output_lines.append([timestamp2, tradeType, amount, currency, size_usd, 'USD', '0.54', 'USD', 'AVAX', 'US'])
elif tradeType == 'Sell':
output_lines.append([timestamp2, tradeType, size_usd, 'USD', amount, currency, '0.54', 'USD', 'AVAX', 'US'])
with open('output/avax-trades.csv', mode='w') as output:
output = csv.writer(output, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
for txn in output_lines:
output.writerow(txn)