diff --git a/tinlake-ui/containers/PoolManagement/queries/InvestorTransactions.ts b/tinlake-ui/containers/PoolManagement/queries/InvestorTransactions.ts new file mode 100644 index 000000000..3d10a4b62 --- /dev/null +++ b/tinlake-ui/containers/PoolManagement/queries/InvestorTransactions.ts @@ -0,0 +1,121 @@ +import BN from 'bn.js' +import { csvName } from '.' +import { downloadCSV } from '../../../utils/export' +import { PoolData } from '../../../utils/usePool' +import { calculateCostInUsd, getAllTransactions, getAllTransfers } from './util' + +const tokenSymbolIsJunior = (symbol: string) => symbol.slice(symbol.length - 3) === 'TIN' + +export async function investorTransactions({ poolId }: { poolId: string; poolData: PoolData }) { + const transactions = await getAllTransactions(poolId) + console.log('1') + const transfers = await getAllTransfers(poolId) + console.log('2') + + const headers: { [key: string]: string } = { + timestamp: 'Date', + pool: 'Pool', + owner: 'Account', + type: 'Transaction Type', + token: 'Token', + currencyAmount: 'Currency Amount', + tokenAmount: 'Token Amount', + currencyBalance: 'Currency Balance', + newBalance: 'Token Balance', + tokenPrice: 'Token Price', + transaction: 'Transaction Hash', + gasPrice: 'Gas Price', + gasUsed: 'Gas Used', + transactionCost: 'Transaction Cost (USD)', + } + + const date = (timestamp: string) => new Date(parseInt(timestamp, 10) * 1000) + const formatDate = (timestamp: string) => + `${date(timestamp).toISOString().substr(0, 10)} ${date(timestamp).toUTCString().substr(17)}` + + const rows: string[][] = [ + [...Object.keys(headers).map((key: string) => headers[key])], + ...transactions.map((el: any) => [ + el.timestamp ? formatDate(el.timestamp) : '-', + el.pool ? el.pool.shortName : '-', + el.owner ? el.owner.id : '-', + el.type, + el.symbol, + el.currencyAmount / 10 ** 18, + el.currencyAmount / 10 ** 18 / (el.tokenPrice / 10 ** 27), + (el.newBalance / 10 ** 18) * (el.tokenPrice / 10 ** 27), + el.newBalance / 10 ** 18, + el.tokenPrice / 10 ** 27, + el.transaction, + el.gasPrice / 10 ** 9, + el.gasUsed, + el.type === 'INVEST_EXECUTION' || el.type === 'REDEEM_EXECUTION' + ? 0 + : calculateCostInUsd(el.gasPrice, el.gasUsed, el.timestamp), + ]), + ...transfers.map((transfer: any) => [ + formatDate(transfer.timestamp), + transfer.pool ? transfer.pool.shortName : '-', + transfer.to ? transfer.to : '-', + 'TRANSFER_IN', + transfer.token ? transfer.token.symbol : '-', + new BN(transfer.amount) + .mul( + new BN( + tokenSymbolIsJunior(transfer.token.symbol) ? transfer.pool.juniorTokenPrice : transfer.pool.seniorTokenPrice + ) + ) + .div(new BN(10).pow(new BN(27 + 18))) + .toNumber(), + '-', + '-', + '-', + new BN( + tokenSymbolIsJunior(transfer.token.symbol) ? transfer.pool.juniorTokenPrice : transfer.pool.seniorTokenPrice + ) + .div(new BN(10).pow(new BN(27 - 8))) + .toNumber() / + 10 ** 8, + transfer.transaction, + transfer.gasPrice / 10 ** 9, + transfer.gasUsed, + calculateCostInUsd(transfer.gasPrice, transfer.gasUsed, transfer.timestamp), + ]), + ...transfers.map((transfer: any) => [ + formatDate(transfer.timestamp), + transfer.pool ? transfer.pool.shortName : '-', + transfer.from ? transfer.from : '-', + 'TRANSFER_OUT', + transfer.token ? transfer.token.symbol : '-', + new BN(transfer.amount) + .mul( + new BN( + tokenSymbolIsJunior(transfer.token.symbol) ? transfer.pool.juniorTokenPrice : transfer.pool.seniorTokenPrice + ) + ) + .div(new BN(10).pow(new BN(27 + 18))) + .toNumber(), + transfer.amount / 10 ** 18, + '-', + '-', + new BN( + tokenSymbolIsJunior(transfer.token.symbol) ? transfer.pool.juniorTokenPrice : transfer.pool.seniorTokenPrice + ) + .div(new BN(10).pow(new BN(27 - 8))) + .toNumber() / + 10 ** 8, + transfer.transaction, + transfer.gasPrice / 10 ** 9, + transfer.gasUsed, + calculateCostInUsd(transfer.gasPrice, transfer.gasUsed, transfer.timestamp), + ]), + ] + + const sorted = rows.sort((a: string[], b: string[]) => { + return new Date(a[0]).getTime() - new Date(b[0]).getTime() + }) + + downloadCSV(sorted, csvName(`Investor Transaction List`)) + + return true +} diff --git a/tinlake-ui/containers/PoolManagement/queries/TaxReports.ts b/tinlake-ui/containers/PoolManagement/queries/TaxReports.ts new file mode 100644 index 000000000..94ad73fdd --- /dev/null +++ b/tinlake-ui/containers/PoolManagement/queries/TaxReports.ts @@ -0,0 +1,400 @@ +import BN from 'bn.js' +import { aggregateByYear, calculateFIFOCapitalGains, Operation } from 'fifo-capital-gains-js' +import { csvName } from '.' +import { downloadCSV } from '../../../utils/export' +import { PoolData } from '../../../utils/usePool' +import { + calculateCostInUsd, + date, + formatDateOnly, + getAllTokenPrices, + getAllTransactions, + getAllTransfers, +} from './util' + +const tokenSymbolIsJunior = (symbol: string) => symbol.slice(symbol.length - 3) === 'TIN' +const e27 = new BN(10).pow(new BN(27)) + +function onlyUnique(value: any, index: number, self: any) { + return self.indexOf(value) === index +} + +const sumTransactionFees = (orders: any[]) => { + return orders.reduce((sum: number, order: any) => { + const costInUsd = calculateCostInUsd(order.gasPrice, order.gasUsed, order.timestamp) + return sum + costInUsd + }, 0) +} + +const getBalanceOnFirstDay = (executionsBeforeYearStart: any[]) => { + return executionsBeforeYearStart.reduce((balance: number, result: any) => { + const amount = new BN(result.currencyAmount).div(new BN(10).pow(new BN(18 - 6))).toNumber() / 10 ** 6 + if (result.type === 'INVEST_EXECUTION') return balance + amount + return balance - amount + }, 0) +} + +const calculateRealizedCapitalGains = ( + executions: any[], + transfersFrom: any[], + transfersTo: any[], + investor: string, + yearStart: Date +) => { + if (executions.length === 0) return 0 + + let totalBought = 0 + let largeAdjustment = false + const operations: Operation[] = [ + ...executions.map((execution) => { + let tokenAmount = new BN(execution.currencyAmount) + .mul(e27) + .div(new BN(execution.tokenPrice)) + .div(new BN(10).pow(new BN(18))) + .toNumber() + + if (execution.type === 'INVEST_EXECUTION') { + totalBought += tokenAmount + } + + if (execution.type === 'REDEEM_EXECUTION') { + if (totalBought - tokenAmount < 0) { + // This ensures that we don't try to sell more than we buy, which can be caused by issues with token prices being slightly off + console.log(`Adjusting ${tokenAmount} to ${totalBought}: ${tokenAmount - totalBought}`) + if (tokenAmount - totalBought > 5) largeAdjustment = true + tokenAmount = totalBought + totalBought = 0 + } else { + totalBought = totalBought - tokenAmount + } + } + + return { + amount: tokenAmount, + date: date(execution.timestamp), + price: new BN(execution.tokenPrice).div(new BN(10).pow(new BN(27 - 6))).toNumber() / 10 ** 6, + symbol: execution.symbol, + type: execution.type === 'INVEST_EXECUTION' ? 'BUY' : 'SELL', + } as Operation + }), + ...transfersFrom.map((transfer) => { + const tokenPrice = tokenSymbolIsJunior(transfer.token.symbol) + ? transfer.pool.juniorTokenPrice + : transfer.pool.seniorTokenPrice + + return { + amount: new BN(transfer.amount).div(new BN(10).pow(new BN(18))).toNumber(), + date: date(transfer.timestamp), + price: new BN(tokenPrice).div(new BN(10).pow(new BN(27 - 6))).toNumber() / 10 ** 6, + symbol: transfer.token.symbol, + type: 'SELL', + } as Operation + }), + ...transfersTo.map((transfer) => { + const tokenPrice = tokenSymbolIsJunior(transfer.token.symbol) + ? transfer.pool.juniorTokenPrice + : transfer.pool.seniorTokenPrice + + return { + amount: new BN(transfer.amount).div(new BN(10).pow(new BN(18))).toNumber(), + date: date(transfer.timestamp), + price: new BN(tokenPrice).div(new BN(10).pow(new BN(27 - 6))).toNumber() / 10 ** 6, + symbol: transfer.token.symbol, + type: 'BUY', + } as Operation + }), + ] + + if (largeAdjustment) { + console.log(investor) + console.log(executions) + console.log(operations) + console.log('\n') + } + + try { + // if (investor === '0x00397d81c4b005e86df0492fd468891ad2153377') { + // console.log(executions) + // console.log(transfersFrom) + // console.log(transfersTo) + // console.log(operations) + // } + return aggregateByYear(calculateFIFOCapitalGains(operations)) + } catch (e) { + console.error(e) + const year = yearStart.getFullYear() + return { [year]: 0 } + } +} + +const calculateInterestAccrued = ( + executions: any[], + symbol: string, + tokenPriceFirstDay: number, + tokenPriceLastDay: number, + yearStart: Date, + yearEnd: Date +) => { + if (executions.length === 0) { + const year = yearStart.getFullYear() + return { + balanceOnFirstDay: 0, + balanceOnLastDay: 0, + interestAccrued: { [year]: 0 }, + } + } + const executionsBeforeYearStart = executions.filter((result) => date(result.timestamp) < yearStart) + const balanceOnFirstDay = getBalanceOnFirstDay(executionsBeforeYearStart) // currencyAmount + const tokensOnFirstDay = balanceOnFirstDay / tokenPriceFirstDay + + let totalBought = 0 + const operations: Operation[] = executions.map((execution) => { + let tokenAmount = + execution.type === 'INVEST_EXECUTION' && execution.tokenAmount !== undefined + ? new BN(execution.tokenAmount).div(new BN(10).pow(new BN(18))).toNumber() + : new BN(execution.currencyAmount) + .mul(e27) + .div(new BN(execution.tokenPrice)) + .div(new BN(10).pow(new BN(18 - 6))) + .toNumber() / + 10 ** 6 + + if (execution.type === 'INVEST_EXECUTION') { + totalBought += tokenAmount + } + + if (execution.type === 'REDEEM_EXECUTION') { + if (totalBought - tokenAmount < 0) { + // This ensures that we don't try to sell more than we buy, which can be caused by issues with token prices being slightly off + console.log(`Adjusting ${tokenAmount} to ${totalBought}: ${tokenAmount - totalBought}`) + tokenAmount = totalBought + totalBought = 0 + } else { + totalBought = totalBought - tokenAmount + } + } + + return { + amount: tokenAmount, + date: date(execution.timestamp), + price: new BN(execution.tokenPrice).div(new BN(10).pow(new BN(27 - 6))).toNumber() / 10 ** 6, + symbol: execution.symbol, + type: execution.type === 'INVEST_EXECUTION' ? 'BUY' : 'SELL', + } + }) + + let balanceOnLastDay = operations.reduce((last: number, operation: Operation) => { + if (operation.type === 'BUY') return last + operation.amount + return last - operation.amount + }, 0) + balanceOnLastDay = balanceOnLastDay < 10 ** -6 ? 0 : balanceOnLastDay + const tokensOnLastDay = balanceOnLastDay / tokenPriceLastDay + + // Add a buy order on the first day of the year, with the balance at the start + const operationsAggregratedYearStart = + balanceOnFirstDay > 0 + ? [ + { + symbol, + amount: balanceOnFirstDay, + date: yearStart, + price: tokenPriceFirstDay, + type: 'BUY', + } as Operation, + ...operations.filter((op) => op.date >= yearStart), + ] + : operations + + // Add a sell order at the end of the year, to assume everything was sold + const operationsWithAssumedYearEndSale = + balanceOnLastDay <= 0 + ? operationsAggregratedYearStart + : [ + ...operationsAggregratedYearStart, + { + symbol, + amount: balanceOnLastDay, + date: yearEnd, + price: tokenPriceLastDay, + type: 'SELL', + } as Operation, + ] + try { + // console.log(executions) + // console.log(operations) + return { + balanceOnFirstDay, + tokensOnFirstDay, + balanceOnLastDay, + tokensOnLastDay, + interestAccrued: aggregateByYear(calculateFIFOCapitalGains(operationsWithAssumedYearEndSale)), + } + } catch (e) { + console.error(e) + const year = yearStart.getFullYear() + return { + balanceOnFirstDay, + tokensOnFirstDay, + balanceOnLastDay, + tokensOnLastDay, + tokenPriceLastDay, + interestAccrued: { [year]: 0 }, + } + } +} + +const countTypes = (transactions: any[], transfersFrom: any[], transfersTo: any[]) => { + return { + INVEST_EXECUTION: transactions.filter((tx) => tx.type === 'INVEST_EXECUTION').length, + REDEEM_EXECUTION: transactions.filter((tx) => tx.type === 'REDEEM_EXECUTION').length, + TRANSFER_IN: transfersFrom.length, + TRANSFER_OUT: transfersTo.length, + } +} + +async function taxReportByYear({ + poolId, + yearStart, + yearEnd, +}: { + poolId: string + poolData: PoolData + yearStart: Date + yearEnd: Date +}) { + // const yearStart = new Date(taxYear, 0, 1) + // const yearEnd = new Date(taxYear, 11, 31) + + const transactions = await getAllTransactions(poolId) + const symbols = transactions.map((tx) => tx.symbol).filter(onlyUnique) + + const transfers = await getAllTransfers(poolId) + + const tokenPrices = await getAllTokenPrices(poolId) + const tokenPricesByDay = tokenPrices.reduce((prev: any, result: any) => { + return { + ...prev, + ...{ + [formatDateOnly(date(result.day.id)).toString()]: { + senior: new BN(result.seniorTokenPrice).div(new BN(10).pow(new BN(27 - 6))).toNumber() / 10 ** 6, + junior: new BN(result.juniorTokenPrice).div(new BN(10).pow(new BN(27 - 6))).toNumber() / 10 ** 6, + }, + }, + } + }, {}) + const tokenPricesYearStart = + formatDateOnly(yearStart) in tokenPricesByDay && tokenPricesByDay[formatDateOnly(yearStart)] !== '0' + ? tokenPricesByDay[formatDateOnly(yearStart)] + : { senior: 1.0, junior: 1.0 } + const tokenPricesYearEnd = + formatDateOnly(yearEnd) in tokenPricesByDay && tokenPricesByDay[formatDateOnly(yearEnd)] !== '0' + ? tokenPricesByDay[formatDateOnly(yearEnd)] + : Object.values(tokenPricesByDay).length > 0 + ? Object.values(tokenPricesByDay)[Object.values(tokenPricesByDay).length - 1] // TODO: this should not take the last element + : { senior: 1.0, junior: 1.0 } + + console.log(`DROP token price started at ${tokenPricesYearStart.senior} and ended at ${tokenPricesYearEnd.senior}`) + console.log(`TIN token price started at ${tokenPricesYearStart.junior} and ended at ${tokenPricesYearEnd.junior}`) + + // Get all investors who had a non-zero balance before year end + const investors = transactions + .filter((tx) => tx.type === 'INVEST_EXECUTION' || tx.type === 'REDEEM_EXECUTION') + .filter((result) => date(result.timestamp) <= yearEnd) + .map((tx) => tx.owner.id) + .filter(onlyUnique) + + const rows: any = [ + [ + 'ETH account', + 'Token', + 'Realized capital gains', + 'Interest accrued', + 'Transaction fees paid', + 'Currency Balance Jan 1', + 'Token Balance Jan 1', + 'Currency Balance Dec 31', + 'Token Balance Dec 31', + 'Number of invest executions', + 'Number of redeem executions', + 'Number of transfers in', + 'Number of transfers out', + ], + ] + symbols.forEach((symbol) => { + investors.forEach((investor) => { + // Get all the executions until the end of the year (including the years before, to get all buy ordres) + const executions = transactions + .filter((tx) => tx.symbol === symbol && tx.owner.id === investor) + .filter((tx) => tx.type === 'INVEST_EXECUTION' || tx.type === 'REDEEM_EXECUTION') + .filter((tx) => date(tx.timestamp) <= yearEnd) + + // And get all relevant tx for fees + // TODO: add collect tx + const orders = transactions + .filter((tx) => tx.symbol === symbol && tx.owner.id === investor) + .filter((tx) => tx.type === 'INVEST_ORDER' || tx.type === 'REDEEM_ORDER') + .filter((result) => date(result.timestamp) >= yearStart && date(result.timestamp) <= yearEnd) + + const transfersFrom = transfers.filter((transfer) => transfer.from === investor) + const transfersTo = transfers.filter((transfer) => transfer.to === investor) + + if (executions.length === 0 && transfersFrom.length === 0 && transfersTo.length === 0) { + return + } + + const realizedCapitalGains: any = calculateRealizedCapitalGains( + executions, + transfersFrom, + transfersTo, + investor, + yearStart + ) + const { interestAccrued, balanceOnFirstDay, tokensOnFirstDay, balanceOnLastDay, tokensOnLastDay } = + calculateInterestAccrued( + executions, + symbol, + tokenPricesYearStart[tokenSymbolIsJunior(symbol) ? 'junior' : 'senior'], + tokenPricesYearEnd[tokenSymbolIsJunior(symbol) ? 'junior' : 'senior'], + yearStart, + yearEnd + ) as any + + const transactionFees = sumTransactionFees(orders) + const counts = countTypes( + transactions + .filter((tx) => tx.symbol === symbol && tx.owner.id === investor) + .filter((result) => date(result.timestamp) >= yearStart && date(result.timestamp) <= yearEnd), + transfersFrom.filter((result) => date(result.timestamp) >= yearStart && date(result.timestamp) <= yearEnd), + transfersTo.filter((result) => date(result.timestamp) >= yearStart && date(result.timestamp) <= yearEnd) + ) + + rows.push([ + investor, + symbol, + realizedCapitalGains['2021'] || 0, + interestAccrued['2021'] || 0, + transactionFees, + balanceOnFirstDay, + tokensOnFirstDay, + balanceOnLastDay, + tokensOnLastDay, + counts['INVEST_EXECUTION'], + counts['REDEEM_EXECUTION'], + counts['TRANSFER_IN'], + counts['TRANSFER_OUT'], + ]) + }) + }) + + downloadCSV(rows, csvName(`Tax Report ${yearStart.getFullYear()}`)) + + return true +} + +export function taxReport2020({ poolId, poolData }: { poolId: string; poolData: PoolData }) { + return taxReportByYear({ poolId, poolData, yearStart: new Date(2020, 0, 1), yearEnd: new Date(2020, 11, 31) }) +} + +export function taxReport2021({ poolId, poolData }: { poolId: string; poolData: PoolData }) { + return taxReportByYear({ poolId, poolData, yearStart: new Date(2021, 0, 1), yearEnd: new Date(2021, 11, 31) }) +} diff --git a/tinlake-ui/containers/PoolManagement/queries/eth_prices.json b/tinlake-ui/containers/PoolManagement/queries/eth_prices.json new file mode 100644 index 000000000..c9d5fadc0 --- /dev/null +++ b/tinlake-ui/containers/PoolManagement/queries/eth_prices.json @@ -0,0 +1,2926 @@ +[ + { + "Date": "2020-01-01 00:00:00 UTC", + "price": 129.1863853 + }, + { + "Date": "2020-01-02 00:00:00 UTC", + "price": 130.484685 + }, + { + "Date": "2020-01-03 00:00:00 UTC", + "price": 127.045258 + }, + { + "Date": "2020-01-04 00:00:00 UTC", + "price": 133.7026486 + }, + { + "Date": "2020-01-05 00:00:00 UTC", + "price": 134.1368827 + }, + { + "Date": "2020-01-06 00:00:00 UTC", + "price": 135.0057136 + }, + { + "Date": "2020-01-07 00:00:00 UTC", + "price": 143.806398 + }, + { + "Date": "2020-01-08 00:00:00 UTC", + "price": 143.0194323 + }, + { + "Date": "2020-01-09 00:00:00 UTC", + "price": 140.2739353 + }, + { + "Date": "2020-01-10 00:00:00 UTC", + "price": 137.8605593 + }, + { + "Date": "2020-01-11 00:00:00 UTC", + "price": 144.6047743 + }, + { + "Date": "2020-01-12 00:00:00 UTC", + "price": 142.1823333 + }, + { + "Date": "2020-01-13 00:00:00 UTC", + "price": 145.4228763 + }, + { + "Date": "2020-01-14 00:00:00 UTC", + "price": 143.5879691 + }, + { + "Date": "2020-01-15 00:00:00 UTC", + "price": 165.9914385 + }, + { + "Date": "2020-01-16 00:00:00 UTC", + "price": 166.2530969 + }, + { + "Date": "2020-01-17 00:00:00 UTC", + "price": 163.8059011 + }, + { + "Date": "2020-01-18 00:00:00 UTC", + "price": 171.1562179 + }, + { + "Date": "2020-01-19 00:00:00 UTC", + "price": 174.2383732 + }, + { + "Date": "2020-01-20 00:00:00 UTC", + "price": 166.627106 + }, + { + "Date": "2020-01-21 00:00:00 UTC", + "price": 166.9385281 + }, + { + "Date": "2020-01-22 00:00:00 UTC", + "price": 169.2799359 + }, + { + "Date": "2020-01-23 00:00:00 UTC", + "price": 167.8265296 + }, + { + "Date": "2020-01-24 00:00:00 UTC", + "price": 162.5193711 + }, + { + "Date": "2020-01-25 00:00:00 UTC", + "price": 162.4094798 + }, + { + "Date": "2020-01-26 00:00:00 UTC", + "price": 160.6736109 + }, + { + "Date": "2020-01-27 00:00:00 UTC", + "price": 167.6474096 + }, + { + "Date": "2020-01-28 00:00:00 UTC", + "price": 169.7364357 + }, + { + "Date": "2020-01-29 00:00:00 UTC", + "price": 175.1900031 + }, + { + "Date": "2020-01-30 00:00:00 UTC", + "price": 173.7068882 + }, + { + "Date": "2020-01-31 00:00:00 UTC", + "price": 184.7262184 + }, + { + "Date": "2020-02-01 00:00:00 UTC", + "price": 179.2291039 + }, + { + "Date": "2020-02-02 00:00:00 UTC", + "price": 183.3369376 + }, + { + "Date": "2020-02-03 00:00:00 UTC", + "price": 188.5506418 + }, + { + "Date": "2020-02-04 00:00:00 UTC", + "price": 189.8617635 + }, + { + "Date": "2020-02-05 00:00:00 UTC", + "price": 188.8422074 + }, + { + "Date": "2020-02-06 00:00:00 UTC", + "price": 203.8593184 + }, + { + "Date": "2020-02-07 00:00:00 UTC", + "price": 212.7334142 + }, + { + "Date": "2020-02-08 00:00:00 UTC", + "price": 223.2763197 + }, + { + "Date": "2020-02-09 00:00:00 UTC", + "price": 223.300777 + }, + { + "Date": "2020-02-10 00:00:00 UTC", + "price": 228.2922608 + }, + { + "Date": "2020-02-11 00:00:00 UTC", + "price": 224.1469965 + }, + { + "Date": "2020-02-12 00:00:00 UTC", + "price": 236.7853485 + }, + { + "Date": "2020-02-13 00:00:00 UTC", + "price": 264.0327682 + }, + { + "Date": "2020-02-14 00:00:00 UTC", + "price": 267.6704445 + }, + { + "Date": "2020-02-15 00:00:00 UTC", + "price": 284.2318915 + }, + { + "Date": "2020-02-16 00:00:00 UTC", + "price": 263.8999464 + }, + { + "Date": "2020-02-17 00:00:00 UTC", + "price": 262.1562443 + }, + { + "Date": "2020-02-18 00:00:00 UTC", + "price": 267.9356656 + }, + { + "Date": "2020-02-19 00:00:00 UTC", + "price": 281.9457403 + }, + { + "Date": "2020-02-20 00:00:00 UTC", + "price": 259.1838037 + }, + { + "Date": "2020-02-21 00:00:00 UTC", + "price": 257.9883953 + }, + { + "Date": "2020-02-22 00:00:00 UTC", + "price": 265.1644591 + }, + { + "Date": "2020-02-23 00:00:00 UTC", + "price": 260.9965401 + }, + { + "Date": "2020-02-24 00:00:00 UTC", + "price": 274.6312158 + }, + { + "Date": "2020-02-25 00:00:00 UTC", + "price": 265.2421912 + }, + { + "Date": "2020-02-26 00:00:00 UTC", + "price": 248.3173814 + }, + { + "Date": "2020-02-27 00:00:00 UTC", + "price": 224.8105083 + }, + { + "Date": "2020-02-28 00:00:00 UTC", + "price": 225.4297151 + }, + { + "Date": "2020-02-29 00:00:00 UTC", + "price": 227.7052845 + }, + { + "Date": "2020-03-01 00:00:00 UTC", + "price": 218.3483569 + }, + { + "Date": "2020-03-02 00:00:00 UTC", + "price": 218.939797 + }, + { + "Date": "2020-03-03 00:00:00 UTC", + "price": 231.679446 + }, + { + "Date": "2020-03-04 00:00:00 UTC", + "price": 223.960116 + }, + { + "Date": "2020-03-05 00:00:00 UTC", + "price": 224.1348774 + }, + { + "Date": "2020-03-06 00:00:00 UTC", + "price": 228.0809351 + }, + { + "Date": "2020-03-07 00:00:00 UTC", + "price": 244.2384695 + }, + { + "Date": "2020-03-08 00:00:00 UTC", + "price": 237.3807902 + }, + { + "Date": "2020-03-09 00:00:00 UTC", + "price": 198.8196423 + }, + { + "Date": "2020-03-10 00:00:00 UTC", + "price": 200.8468715 + }, + { + "Date": "2020-03-11 00:00:00 UTC", + "price": 200.7490385 + }, + { + "Date": "2020-03-12 00:00:00 UTC", + "price": 194.2179412 + }, + { + "Date": "2020-03-13 00:00:00 UTC", + "price": 110.5978978 + }, + { + "Date": "2020-03-14 00:00:00 UTC", + "price": 132.5728577 + }, + { + "Date": "2020-03-15 00:00:00 UTC", + "price": 123.0308441 + }, + { + "Date": "2020-03-16 00:00:00 UTC", + "price": 124.6034255 + }, + { + "Date": "2020-03-17 00:00:00 UTC", + "price": 110.9915985 + }, + { + "Date": "2020-03-18 00:00:00 UTC", + "price": 117.2170414 + }, + { + "Date": "2020-03-19 00:00:00 UTC", + "price": 117.7004246 + }, + { + "Date": "2020-03-20 00:00:00 UTC", + "price": 136.8118758 + }, + { + "Date": "2020-03-21 00:00:00 UTC", + "price": 131.964694 + }, + { + "Date": "2020-03-22 00:00:00 UTC", + "price": 131.9432185 + }, + { + "Date": "2020-03-23 00:00:00 UTC", + "price": 122.5205988 + }, + { + "Date": "2020-03-24 00:00:00 UTC", + "price": 135.588658 + }, + { + "Date": "2020-03-25 00:00:00 UTC", + "price": 138.7765713 + }, + { + "Date": "2020-03-26 00:00:00 UTC", + "price": 136.2339214 + }, + { + "Date": "2020-03-27 00:00:00 UTC", + "price": 138.7669376 + }, + { + "Date": "2020-03-28 00:00:00 UTC", + "price": 130.2865619 + }, + { + "Date": "2020-03-29 00:00:00 UTC", + "price": 131.4240521 + }, + { + "Date": "2020-03-30 00:00:00 UTC", + "price": 125.3188745 + }, + { + "Date": "2020-03-31 00:00:00 UTC", + "price": 132.363739 + }, + { + "Date": "2020-04-01 00:00:00 UTC", + "price": 133.2364468 + }, + { + "Date": "2020-04-02 00:00:00 UTC", + "price": 136.2163856 + }, + { + "Date": "2020-04-03 00:00:00 UTC", + "price": 141.4537054 + }, + { + "Date": "2020-04-04 00:00:00 UTC", + "price": 141.2615433 + }, + { + "Date": "2020-04-05 00:00:00 UTC", + "price": 144.2008027 + }, + { + "Date": "2020-04-06 00:00:00 UTC", + "price": 142.8508835 + }, + { + "Date": "2020-04-07 00:00:00 UTC", + "price": 169.8550498 + }, + { + "Date": "2020-04-08 00:00:00 UTC", + "price": 164.5160197 + }, + { + "Date": "2020-04-09 00:00:00 UTC", + "price": 172.8035683 + }, + { + "Date": "2020-04-10 00:00:00 UTC", + "price": 170.0951035 + }, + { + "Date": "2020-04-11 00:00:00 UTC", + "price": 157.740158 + }, + { + "Date": "2020-04-12 00:00:00 UTC", + "price": 158.3278779 + }, + { + "Date": "2020-04-13 00:00:00 UTC", + "price": 158.8638257 + }, + { + "Date": "2020-04-14 00:00:00 UTC", + "price": 156.7013588 + }, + { + "Date": "2020-04-15 00:00:00 UTC", + "price": 158.2671512 + }, + { + "Date": "2020-04-16 00:00:00 UTC", + "price": 153.2228637 + }, + { + "Date": "2020-04-17 00:00:00 UTC", + "price": 171.7759908 + }, + { + "Date": "2020-04-18 00:00:00 UTC", + "price": 170.4458905 + }, + { + "Date": "2020-04-19 00:00:00 UTC", + "price": 187.1435441 + }, + { + "Date": "2020-04-20 00:00:00 UTC", + "price": 180.0585965 + }, + { + "Date": "2020-04-21 00:00:00 UTC", + "price": 170.7040587 + }, + { + "Date": "2020-04-22 00:00:00 UTC", + "price": 170.4515429 + }, + { + "Date": "2020-04-23 00:00:00 UTC", + "price": 182.2767577 + }, + { + "Date": "2020-04-24 00:00:00 UTC", + "price": 184.5937025 + }, + { + "Date": "2020-04-25 00:00:00 UTC", + "price": 187.3433686 + }, + { + "Date": "2020-04-26 00:00:00 UTC", + "price": 194.1142368 + }, + { + "Date": "2020-04-27 00:00:00 UTC", + "price": 197.2299044 + }, + { + "Date": "2020-04-28 00:00:00 UTC", + "price": 196.4626254 + }, + { + "Date": "2020-04-29 00:00:00 UTC", + "price": 197.1547316 + }, + { + "Date": "2020-04-30 00:00:00 UTC", + "price": 215.5481727 + }, + { + "Date": "2020-05-01 00:00:00 UTC", + "price": 205.5560054 + }, + { + "Date": "2020-05-02 00:00:00 UTC", + "price": 211.9682953 + }, + { + "Date": "2020-05-03 00:00:00 UTC", + "price": 213.9430112 + }, + { + "Date": "2020-05-04 00:00:00 UTC", + "price": 210.0247095 + }, + { + "Date": "2020-05-05 00:00:00 UTC", + "price": 206.8325342 + }, + { + "Date": "2020-05-06 00:00:00 UTC", + "price": 205.2251797 + }, + { + "Date": "2020-05-07 00:00:00 UTC", + "price": 200.2547945 + }, + { + "Date": "2020-05-08 00:00:00 UTC", + "price": 212.2924762 + }, + { + "Date": "2020-05-09 00:00:00 UTC", + "price": 211.6890484 + }, + { + "Date": "2020-05-10 00:00:00 UTC", + "price": 210.4318181 + }, + { + "Date": "2020-05-11 00:00:00 UTC", + "price": 188.1372262 + }, + { + "Date": "2020-05-12 00:00:00 UTC", + "price": 185.6747181 + }, + { + "Date": "2020-05-13 00:00:00 UTC", + "price": 189.3057818 + }, + { + "Date": "2020-05-14 00:00:00 UTC", + "price": 199.3693725 + }, + { + "Date": "2020-05-15 00:00:00 UTC", + "price": 203.211247 + }, + { + "Date": "2020-05-16 00:00:00 UTC", + "price": 194.2730978 + }, + { + "Date": "2020-05-17 00:00:00 UTC", + "price": 200.5833909 + }, + { + "Date": "2020-05-18 00:00:00 UTC", + "price": 206.768894 + }, + { + "Date": "2020-05-19 00:00:00 UTC", + "price": 214.3576416 + }, + { + "Date": "2020-05-20 00:00:00 UTC", + "price": 213.6867202 + }, + { + "Date": "2020-05-21 00:00:00 UTC", + "price": 209.9207883 + }, + { + "Date": "2020-05-22 00:00:00 UTC", + "price": 198.9175158 + }, + { + "Date": "2020-05-23 00:00:00 UTC", + "price": 206.2277296 + }, + { + "Date": "2020-05-24 00:00:00 UTC", + "price": 206.411207 + }, + { + "Date": "2020-05-25 00:00:00 UTC", + "price": 200.6907286 + }, + { + "Date": "2020-05-26 00:00:00 UTC", + "price": 203.8101183 + }, + { + "Date": "2020-05-27 00:00:00 UTC", + "price": 200.9636154 + }, + { + "Date": "2020-05-28 00:00:00 UTC", + "price": 207.8458939 + }, + { + "Date": "2020-05-29 00:00:00 UTC", + "price": 219.5915641 + }, + { + "Date": "2020-05-30 00:00:00 UTC", + "price": 220.4911673 + }, + { + "Date": "2020-05-31 00:00:00 UTC", + "price": 242.7097703 + }, + { + "Date": "2020-06-01 00:00:00 UTC", + "price": 232.331003 + }, + { + "Date": "2020-06-02 00:00:00 UTC", + "price": 248.0445666 + }, + { + "Date": "2020-06-03 00:00:00 UTC", + "price": 237.2653201 + }, + { + "Date": "2020-06-04 00:00:00 UTC", + "price": 244.1253366 + }, + { + "Date": "2020-06-05 00:00:00 UTC", + "price": 243.7078213 + }, + { + "Date": "2020-06-06 00:00:00 UTC", + "price": 240.246969 + }, + { + "Date": "2020-06-07 00:00:00 UTC", + "price": 242.0216404 + }, + { + "Date": "2020-06-08 00:00:00 UTC", + "price": 244.2267444 + }, + { + "Date": "2020-06-09 00:00:00 UTC", + "price": 246.2127833 + }, + { + "Date": "2020-06-10 00:00:00 UTC", + "price": 243.8495267 + }, + { + "Date": "2020-06-11 00:00:00 UTC", + "price": 247.5419715 + }, + { + "Date": "2020-06-12 00:00:00 UTC", + "price": 232.0007854 + }, + { + "Date": "2020-06-13 00:00:00 UTC", + "price": 237.5934109 + }, + { + "Date": "2020-06-14 00:00:00 UTC", + "price": 238.2936291 + }, + { + "Date": "2020-06-15 00:00:00 UTC", + "price": 232.1125205 + }, + { + "Date": "2020-06-16 00:00:00 UTC", + "price": 231.0170116 + }, + { + "Date": "2020-06-17 00:00:00 UTC", + "price": 235.2884795 + }, + { + "Date": "2020-06-18 00:00:00 UTC", + "price": 233.8636185 + }, + { + "Date": "2020-06-19 00:00:00 UTC", + "price": 231.6848573 + }, + { + "Date": "2020-06-20 00:00:00 UTC", + "price": 228.9592128 + }, + { + "Date": "2020-06-21 00:00:00 UTC", + "price": 228.8691488 + }, + { + "Date": "2020-06-22 00:00:00 UTC", + "price": 227.7919059 + }, + { + "Date": "2020-06-23 00:00:00 UTC", + "price": 243.36471 + }, + { + "Date": "2020-06-24 00:00:00 UTC", + "price": 243.0794822 + }, + { + "Date": "2020-06-25 00:00:00 UTC", + "price": 234.5649846 + }, + { + "Date": "2020-06-26 00:00:00 UTC", + "price": 232.6487035 + }, + { + "Date": "2020-06-27 00:00:00 UTC", + "price": 229.636526 + }, + { + "Date": "2020-06-28 00:00:00 UTC", + "price": 221.0260853 + }, + { + "Date": "2020-06-29 00:00:00 UTC", + "price": 225.1229462 + }, + { + "Date": "2020-06-30 00:00:00 UTC", + "price": 228.2057638 + }, + { + "Date": "2020-07-01 00:00:00 UTC", + "price": 225.592815 + }, + { + "Date": "2020-07-02 00:00:00 UTC", + "price": 230.6619436 + }, + { + "Date": "2020-07-03 00:00:00 UTC", + "price": 226.5744243 + }, + { + "Date": "2020-07-04 00:00:00 UTC", + "price": 225.1764055 + }, + { + "Date": "2020-07-05 00:00:00 UTC", + "price": 229.0947165 + }, + { + "Date": "2020-07-06 00:00:00 UTC", + "price": 227.899375 + }, + { + "Date": "2020-07-07 00:00:00 UTC", + "price": 241.5268519 + }, + { + "Date": "2020-07-08 00:00:00 UTC", + "price": 238.9644805 + }, + { + "Date": "2020-07-09 00:00:00 UTC", + "price": 246.8590079 + }, + { + "Date": "2020-07-10 00:00:00 UTC", + "price": 241.9751286 + }, + { + "Date": "2020-07-11 00:00:00 UTC", + "price": 240.9549538 + }, + { + "Date": "2020-07-12 00:00:00 UTC", + "price": 239.1020255 + }, + { + "Date": "2020-07-13 00:00:00 UTC", + "price": 241.7715226 + }, + { + "Date": "2020-07-14 00:00:00 UTC", + "price": 239.6387868 + }, + { + "Date": "2020-07-15 00:00:00 UTC", + "price": 240.2514707 + }, + { + "Date": "2020-07-16 00:00:00 UTC", + "price": 238.6635972 + }, + { + "Date": "2020-07-17 00:00:00 UTC", + "price": 233.8370746 + }, + { + "Date": "2020-07-18 00:00:00 UTC", + "price": 232.7814774 + }, + { + "Date": "2020-07-19 00:00:00 UTC", + "price": 235.6811448 + }, + { + "Date": "2020-07-20 00:00:00 UTC", + "price": 238.8952317 + }, + { + "Date": "2020-07-21 00:00:00 UTC", + "price": 236.0600984 + }, + { + "Date": "2020-07-22 00:00:00 UTC", + "price": 245.233735 + }, + { + "Date": "2020-07-23 00:00:00 UTC", + "price": 263.762464 + }, + { + "Date": "2020-07-24 00:00:00 UTC", + "price": 274.7236203 + }, + { + "Date": "2020-07-25 00:00:00 UTC", + "price": 279.4270562 + }, + { + "Date": "2020-07-26 00:00:00 UTC", + "price": 305.0381394 + }, + { + "Date": "2020-07-27 00:00:00 UTC", + "price": 310.517991 + }, + { + "Date": "2020-07-28 00:00:00 UTC", + "price": 320.4761913 + }, + { + "Date": "2020-07-29 00:00:00 UTC", + "price": 316.4067661 + }, + { + "Date": "2020-07-30 00:00:00 UTC", + "price": 317.5390729 + }, + { + "Date": "2020-07-31 00:00:00 UTC", + "price": 334.741922 + }, + { + "Date": "2020-08-01 00:00:00 UTC", + "price": 346.0035061 + }, + { + "Date": "2020-08-02 00:00:00 UTC", + "price": 387.9424212 + }, + { + "Date": "2020-08-03 00:00:00 UTC", + "price": 370.7323024 + }, + { + "Date": "2020-08-04 00:00:00 UTC", + "price": 386.2474477 + }, + { + "Date": "2020-08-05 00:00:00 UTC", + "price": 389.3830083 + }, + { + "Date": "2020-08-06 00:00:00 UTC", + "price": 400.1843625 + }, + { + "Date": "2020-08-07 00:00:00 UTC", + "price": 394.5417455 + }, + { + "Date": "2020-08-08 00:00:00 UTC", + "price": 379.1351558 + }, + { + "Date": "2020-08-09 00:00:00 UTC", + "price": 391.4784386 + }, + { + "Date": "2020-08-10 00:00:00 UTC", + "price": 389.6229311 + }, + { + "Date": "2020-08-11 00:00:00 UTC", + "price": 395.2099137 + }, + { + "Date": "2020-08-12 00:00:00 UTC", + "price": 379.174764 + }, + { + "Date": "2020-08-13 00:00:00 UTC", + "price": 387.5005308 + }, + { + "Date": "2020-08-14 00:00:00 UTC", + "price": 427.4902654 + }, + { + "Date": "2020-08-15 00:00:00 UTC", + "price": 438.7625875 + }, + { + "Date": "2020-08-16 00:00:00 UTC", + "price": 432.6546652 + }, + { + "Date": "2020-08-17 00:00:00 UTC", + "price": 433.4318609 + }, + { + "Date": "2020-08-18 00:00:00 UTC", + "price": 430.0325051 + }, + { + "Date": "2020-08-19 00:00:00 UTC", + "price": 422.1066529 + }, + { + "Date": "2020-08-20 00:00:00 UTC", + "price": 406.5744692 + }, + { + "Date": "2020-08-21 00:00:00 UTC", + "price": 416.4697758 + }, + { + "Date": "2020-08-22 00:00:00 UTC", + "price": 386.8238914 + }, + { + "Date": "2020-08-23 00:00:00 UTC", + "price": 395.8850183 + }, + { + "Date": "2020-08-24 00:00:00 UTC", + "price": 390.789135 + }, + { + "Date": "2020-08-25 00:00:00 UTC", + "price": 408.2691456 + }, + { + "Date": "2020-08-26 00:00:00 UTC", + "price": 383.6621431 + }, + { + "Date": "2020-08-27 00:00:00 UTC", + "price": 385.7524999 + }, + { + "Date": "2020-08-28 00:00:00 UTC", + "price": 381.8376513 + }, + { + "Date": "2020-08-29 00:00:00 UTC", + "price": 395.1382132 + }, + { + "Date": "2020-08-30 00:00:00 UTC", + "price": 399.3745438 + }, + { + "Date": "2020-08-31 00:00:00 UTC", + "price": 428.2956792 + }, + { + "Date": "2020-09-01 00:00:00 UTC", + "price": 435.6930233 + }, + { + "Date": "2020-09-02 00:00:00 UTC", + "price": 475.6846643 + }, + { + "Date": "2020-09-03 00:00:00 UTC", + "price": 439.3537602 + }, + { + "Date": "2020-09-04 00:00:00 UTC", + "price": 383.6915312 + }, + { + "Date": "2020-09-05 00:00:00 UTC", + "price": 387.9040291 + }, + { + "Date": "2020-09-06 00:00:00 UTC", + "price": 334.468593 + }, + { + "Date": "2020-09-07 00:00:00 UTC", + "price": 352.9930021 + }, + { + "Date": "2020-09-08 00:00:00 UTC", + "price": 351.8778603 + }, + { + "Date": "2020-09-09 00:00:00 UTC", + "price": 337.8450519 + }, + { + "Date": "2020-09-10 00:00:00 UTC", + "price": 351.2322671 + }, + { + "Date": "2020-09-11 00:00:00 UTC", + "price": 367.6389288 + }, + { + "Date": "2020-09-12 00:00:00 UTC", + "price": 373.914906 + }, + { + "Date": "2020-09-13 00:00:00 UTC", + "price": 387.7235163 + }, + { + "Date": "2020-09-14 00:00:00 UTC", + "price": 365.6955063 + }, + { + "Date": "2020-09-15 00:00:00 UTC", + "price": 376.3945611 + }, + { + "Date": "2020-09-16 00:00:00 UTC", + "price": 364.6900451 + }, + { + "Date": "2020-09-17 00:00:00 UTC", + "price": 365.1305508 + }, + { + "Date": "2020-09-18 00:00:00 UTC", + "price": 388.7974562 + }, + { + "Date": "2020-09-19 00:00:00 UTC", + "price": 383.172866 + }, + { + "Date": "2020-09-20 00:00:00 UTC", + "price": 385.4721235 + }, + { + "Date": "2020-09-21 00:00:00 UTC", + "price": 370.9678952 + }, + { + "Date": "2020-09-22 00:00:00 UTC", + "price": 341.2771309 + }, + { + "Date": "2020-09-23 00:00:00 UTC", + "price": 343.9175471 + }, + { + "Date": "2020-09-24 00:00:00 UTC", + "price": 321.0774352 + }, + { + "Date": "2020-09-25 00:00:00 UTC", + "price": 348.82102 + }, + { + "Date": "2020-09-26 00:00:00 UTC", + "price": 351.331567 + }, + { + "Date": "2020-09-27 00:00:00 UTC", + "price": 354.2615819 + }, + { + "Date": "2020-09-28 00:00:00 UTC", + "price": 357.0664364 + }, + { + "Date": "2020-09-29 00:00:00 UTC", + "price": 354.4295835 + }, + { + "Date": "2020-09-30 00:00:00 UTC", + "price": 359.4260895 + }, + { + "Date": "2020-10-01 00:00:00 UTC", + "price": 359.5989848 + }, + { + "Date": "2020-10-02 00:00:00 UTC", + "price": 353.1978481 + }, + { + "Date": "2020-10-03 00:00:00 UTC", + "price": 345.9125682 + }, + { + "Date": "2020-10-04 00:00:00 UTC", + "price": 345.9924632 + }, + { + "Date": "2020-10-05 00:00:00 UTC", + "price": 352.4588065 + }, + { + "Date": "2020-10-06 00:00:00 UTC", + "price": 353.6044273 + }, + { + "Date": "2020-10-07 00:00:00 UTC", + "price": 340.6160218 + }, + { + "Date": "2020-10-08 00:00:00 UTC", + "price": 341.4437965 + }, + { + "Date": "2020-10-09 00:00:00 UTC", + "price": 350.0556766 + }, + { + "Date": "2020-10-10 00:00:00 UTC", + "price": 365.3394448 + }, + { + "Date": "2020-10-11 00:00:00 UTC", + "price": 370.471811 + }, + { + "Date": "2020-10-12 00:00:00 UTC", + "price": 374.4970151 + }, + { + "Date": "2020-10-13 00:00:00 UTC", + "price": 387.2555584 + }, + { + "Date": "2020-10-14 00:00:00 UTC", + "price": 381.1687739 + }, + { + "Date": "2020-10-15 00:00:00 UTC", + "price": 379.2102538 + }, + { + "Date": "2020-10-16 00:00:00 UTC", + "price": 377.1586811 + }, + { + "Date": "2020-10-17 00:00:00 UTC", + "price": 365.9906424 + }, + { + "Date": "2020-10-18 00:00:00 UTC", + "price": 368.6504704 + }, + { + "Date": "2020-10-19 00:00:00 UTC", + "price": 378.0493653 + }, + { + "Date": "2020-10-20 00:00:00 UTC", + "price": 379.6394773 + }, + { + "Date": "2020-10-21 00:00:00 UTC", + "price": 368.2270142 + }, + { + "Date": "2020-10-22 00:00:00 UTC", + "price": 391.1667422 + }, + { + "Date": "2020-10-23 00:00:00 UTC", + "price": 413.2018903 + }, + { + "Date": "2020-10-24 00:00:00 UTC", + "price": 408.8894886 + }, + { + "Date": "2020-10-25 00:00:00 UTC", + "price": 411.9592178 + }, + { + "Date": "2020-10-26 00:00:00 UTC", + "price": 406.1570941 + }, + { + "Date": "2020-10-27 00:00:00 UTC", + "price": 393.3829084 + }, + { + "Date": "2020-10-28 00:00:00 UTC", + "price": 403.5298378 + }, + { + "Date": "2020-10-29 00:00:00 UTC", + "price": 388.8773399 + }, + { + "Date": "2020-10-30 00:00:00 UTC", + "price": 386.446013 + }, + { + "Date": "2020-10-31 00:00:00 UTC", + "price": 382.900771 + }, + { + "Date": "2020-11-01 00:00:00 UTC", + "price": 385.8445888 + }, + { + "Date": "2020-11-02 00:00:00 UTC", + "price": 394.936342 + }, + { + "Date": "2020-11-03 00:00:00 UTC", + "price": 383.8498034 + }, + { + "Date": "2020-11-04 00:00:00 UTC", + "price": 387.6163737 + }, + { + "Date": "2020-11-05 00:00:00 UTC", + "price": 401.7330968 + }, + { + "Date": "2020-11-06 00:00:00 UTC", + "price": 415.9277704 + }, + { + "Date": "2020-11-07 00:00:00 UTC", + "price": 454.6515431 + }, + { + "Date": "2020-11-08 00:00:00 UTC", + "price": 435.4183541 + }, + { + "Date": "2020-11-09 00:00:00 UTC", + "price": 455.358367 + }, + { + "Date": "2020-11-10 00:00:00 UTC", + "price": 445.0512933 + }, + { + "Date": "2020-11-11 00:00:00 UTC", + "price": 449.8161845 + }, + { + "Date": "2020-11-12 00:00:00 UTC", + "price": 463.1808717 + }, + { + "Date": "2020-11-13 00:00:00 UTC", + "price": 462.2056196 + }, + { + "Date": "2020-11-14 00:00:00 UTC", + "price": 475.9690937 + }, + { + "Date": "2020-11-15 00:00:00 UTC", + "price": 462.7183971 + }, + { + "Date": "2020-11-16 00:00:00 UTC", + "price": 449.2068016 + }, + { + "Date": "2020-11-17 00:00:00 UTC", + "price": 461.3711967 + }, + { + "Date": "2020-11-18 00:00:00 UTC", + "price": 482.1983847 + }, + { + "Date": "2020-11-19 00:00:00 UTC", + "price": 479.4376614 + }, + { + "Date": "2020-11-20 00:00:00 UTC", + "price": 471.3179584 + }, + { + "Date": "2020-11-21 00:00:00 UTC", + "price": 508.7922146 + }, + { + "Date": "2020-11-22 00:00:00 UTC", + "price": 548.8421162 + }, + { + "Date": "2020-11-23 00:00:00 UTC", + "price": 560.5088875 + }, + { + "Date": "2020-11-24 00:00:00 UTC", + "price": 608.2733109 + }, + { + "Date": "2020-11-25 00:00:00 UTC", + "price": 602.6662624 + }, + { + "Date": "2020-11-26 00:00:00 UTC", + "price": 568.275153 + }, + { + "Date": "2020-11-27 00:00:00 UTC", + "price": 518.4670452 + }, + { + "Date": "2020-11-28 00:00:00 UTC", + "price": 517.5530264 + }, + { + "Date": "2020-11-29 00:00:00 UTC", + "price": 537.3926121 + }, + { + "Date": "2020-11-30 00:00:00 UTC", + "price": 574.7511197 + }, + { + "Date": "2020-12-01 00:00:00 UTC", + "price": 612.2637856 + }, + { + "Date": "2020-12-02 00:00:00 UTC", + "price": 589.5818444 + }, + { + "Date": "2020-12-03 00:00:00 UTC", + "price": 598.7606101 + }, + { + "Date": "2020-12-04 00:00:00 UTC", + "price": 616.5066616 + }, + { + "Date": "2020-12-05 00:00:00 UTC", + "price": 571.1904316 + }, + { + "Date": "2020-12-06 00:00:00 UTC", + "price": 595.919414 + }, + { + "Date": "2020-12-07 00:00:00 UTC", + "price": 601.9689349 + }, + { + "Date": "2020-12-08 00:00:00 UTC", + "price": 592.3865067 + }, + { + "Date": "2020-12-09 00:00:00 UTC", + "price": 554.3296743 + }, + { + "Date": "2020-12-10 00:00:00 UTC", + "price": 573.8953091 + }, + { + "Date": "2020-12-11 00:00:00 UTC", + "price": 560.4542654 + }, + { + "Date": "2020-12-12 00:00:00 UTC", + "price": 545.9828353 + }, + { + "Date": "2020-12-13 00:00:00 UTC", + "price": 568.3587534 + }, + { + "Date": "2020-12-14 00:00:00 UTC", + "price": 590.3244403 + }, + { + "Date": "2020-12-15 00:00:00 UTC", + "price": 585.5418949 + }, + { + "Date": "2020-12-16 00:00:00 UTC", + "price": 589.0668316 + }, + { + "Date": "2020-12-17 00:00:00 UTC", + "price": 635.9618894 + }, + { + "Date": "2020-12-18 00:00:00 UTC", + "price": 644.0652702 + }, + { + "Date": "2020-12-19 00:00:00 UTC", + "price": 654.4204163 + }, + { + "Date": "2020-12-20 00:00:00 UTC", + "price": 659.3188076 + }, + { + "Date": "2020-12-21 00:00:00 UTC", + "price": 639.5154369 + }, + { + "Date": "2020-12-22 00:00:00 UTC", + "price": 610.4270279 + }, + { + "Date": "2020-12-23 00:00:00 UTC", + "price": 634.9797234 + }, + { + "Date": "2020-12-24 00:00:00 UTC", + "price": 587.9588955 + }, + { + "Date": "2020-12-25 00:00:00 UTC", + "price": 612.8796571 + }, + { + "Date": "2020-12-26 00:00:00 UTC", + "price": 626.4567388 + }, + { + "Date": "2020-12-27 00:00:00 UTC", + "price": 636.7423172 + }, + { + "Date": "2020-12-28 00:00:00 UTC", + "price": 689.6598573 + }, + { + "Date": "2020-12-29 00:00:00 UTC", + "price": 732.9570293 + }, + { + "Date": "2020-12-30 00:00:00 UTC", + "price": 735.5908982 + }, + { + "Date": "2020-12-31 00:00:00 UTC", + "price": 752.8559324 + }, + { + "Date": "2021-01-01 00:00:00 UTC", + "price": 738.6169382 + }, + { + "Date": "2021-01-02 00:00:00 UTC", + "price": 730.1473402 + }, + { + "Date": "2021-01-03 00:00:00 UTC", + "price": 777.6960653 + }, + { + "Date": "2021-01-04 00:00:00 UTC", + "price": 967.0005967 + }, + { + "Date": "2021-01-05 00:00:00 UTC", + "price": 1025.654768 + }, + { + "Date": "2021-01-06 00:00:00 UTC", + "price": 1103.358252 + }, + { + "Date": "2021-01-07 00:00:00 UTC", + "price": 1208.575093 + }, + { + "Date": "2021-01-08 00:00:00 UTC", + "price": 1229.471315 + }, + { + "Date": "2021-01-09 00:00:00 UTC", + "price": 1223.729688 + }, + { + "Date": "2021-01-10 00:00:00 UTC", + "price": 1282.979576 + }, + { + "Date": "2021-01-11 00:00:00 UTC", + "price": 1267.731003 + }, + { + "Date": "2021-01-12 00:00:00 UTC", + "price": 1092.914338 + }, + { + "Date": "2021-01-13 00:00:00 UTC", + "price": 1045.406815 + }, + { + "Date": "2021-01-14 00:00:00 UTC", + "price": 1132.015591 + }, + { + "Date": "2021-01-15 00:00:00 UTC", + "price": 1216.914788 + }, + { + "Date": "2021-01-16 00:00:00 UTC", + "price": 1171.860018 + }, + { + "Date": "2021-01-17 00:00:00 UTC", + "price": 1234.63187 + }, + { + "Date": "2021-01-18 00:00:00 UTC", + "price": 1229.379698 + }, + { + "Date": "2021-01-19 00:00:00 UTC", + "price": 1255.976692 + }, + { + "Date": "2021-01-20 00:00:00 UTC", + "price": 1383.48409 + }, + { + "Date": "2021-01-21 00:00:00 UTC", + "price": 1385.852996 + }, + { + "Date": "2021-01-22 00:00:00 UTC", + "price": 1122.912433 + }, + { + "Date": "2021-01-23 00:00:00 UTC", + "price": 1236.683443 + }, + { + "Date": "2021-01-24 00:00:00 UTC", + "price": 1231.17638 + }, + { + "Date": "2021-01-25 00:00:00 UTC", + "price": 1392.539763 + }, + { + "Date": "2021-01-26 00:00:00 UTC", + "price": 1323.429503 + }, + { + "Date": "2021-01-27 00:00:00 UTC", + "price": 1355.233724 + }, + { + "Date": "2021-01-28 00:00:00 UTC", + "price": 1253.141672 + }, + { + "Date": "2021-01-29 00:00:00 UTC", + "price": 1328.773619 + }, + { + "Date": "2021-01-30 00:00:00 UTC", + "price": 1380.284259 + }, + { + "Date": "2021-01-31 00:00:00 UTC", + "price": 1372.427229 + }, + { + "Date": "2021-02-01 00:00:00 UTC", + "price": 1317.047436 + }, + { + "Date": "2021-02-02 00:00:00 UTC", + "price": 1368.664455 + }, + { + "Date": "2021-02-03 00:00:00 UTC", + "price": 1514.225196 + }, + { + "Date": "2021-02-04 00:00:00 UTC", + "price": 1661.000824 + }, + { + "Date": "2021-02-05 00:00:00 UTC", + "price": 1587.800899 + }, + { + "Date": "2021-02-06 00:00:00 UTC", + "price": 1724.856908 + }, + { + "Date": "2021-02-07 00:00:00 UTC", + "price": 1683.941298 + }, + { + "Date": "2021-02-08 00:00:00 UTC", + "price": 1608.640548 + }, + { + "Date": "2021-02-09 00:00:00 UTC", + "price": 1750.997554 + }, + { + "Date": "2021-02-10 00:00:00 UTC", + "price": 1769.053534 + }, + { + "Date": "2021-02-11 00:00:00 UTC", + "price": 1739.164209 + }, + { + "Date": "2021-02-12 00:00:00 UTC", + "price": 1782.508869 + }, + { + "Date": "2021-02-13 00:00:00 UTC", + "price": 1841.197751 + }, + { + "Date": "2021-02-14 00:00:00 UTC", + "price": 1810.842546 + }, + { + "Date": "2021-02-15 00:00:00 UTC", + "price": 1804.984146 + }, + { + "Date": "2021-02-16 00:00:00 UTC", + "price": 1775.758352 + }, + { + "Date": "2021-02-17 00:00:00 UTC", + "price": 1782.575309 + }, + { + "Date": "2021-02-18 00:00:00 UTC", + "price": 1845.573922 + }, + { + "Date": "2021-02-19 00:00:00 UTC", + "price": 1938.569437 + }, + { + "Date": "2021-02-20 00:00:00 UTC", + "price": 1969.979718 + }, + { + "Date": "2021-02-21 00:00:00 UTC", + "price": 1929.367693 + }, + { + "Date": "2021-02-22 00:00:00 UTC", + "price": 1941.426768 + }, + { + "Date": "2021-02-23 00:00:00 UTC", + "price": 1788.61521 + }, + { + "Date": "2021-02-24 00:00:00 UTC", + "price": 1563.924606 + }, + { + "Date": "2021-02-25 00:00:00 UTC", + "price": 1628.391534 + }, + { + "Date": "2021-02-26 00:00:00 UTC", + "price": 1468.860104 + }, + { + "Date": "2021-02-27 00:00:00 UTC", + "price": 1450.988747 + }, + { + "Date": "2021-02-28 00:00:00 UTC", + "price": 1480.129577 + }, + { + "Date": "2021-03-01 00:00:00 UTC", + "price": 1416.661553 + }, + { + "Date": "2021-03-02 00:00:00 UTC", + "price": 1570.39969 + }, + { + "Date": "2021-03-03 00:00:00 UTC", + "price": 1497.089104 + }, + { + "Date": "2021-03-04 00:00:00 UTC", + "price": 1579.427169 + }, + { + "Date": "2021-03-05 00:00:00 UTC", + "price": 1546.499621 + }, + { + "Date": "2021-03-06 00:00:00 UTC", + "price": 1539.048429 + }, + { + "Date": "2021-03-07 00:00:00 UTC", + "price": 1661.92797 + }, + { + "Date": "2021-03-08 00:00:00 UTC", + "price": 1727.463096 + }, + { + "Date": "2021-03-09 00:00:00 UTC", + "price": 1837.533031 + }, + { + "Date": "2021-03-10 00:00:00 UTC", + "price": 1869.331102 + }, + { + "Date": "2021-03-11 00:00:00 UTC", + "price": 1802.311092 + }, + { + "Date": "2021-03-12 00:00:00 UTC", + "price": 1826.057477 + }, + { + "Date": "2021-03-13 00:00:00 UTC", + "price": 1770.936179 + }, + { + "Date": "2021-03-14 00:00:00 UTC", + "price": 1927.72072 + }, + { + "Date": "2021-03-15 00:00:00 UTC", + "price": 1866.071545 + }, + { + "Date": "2021-03-16 00:00:00 UTC", + "price": 1791.047852 + }, + { + "Date": "2021-03-17 00:00:00 UTC", + "price": 1808.551217 + }, + { + "Date": "2021-03-18 00:00:00 UTC", + "price": 1828.754833 + }, + { + "Date": "2021-03-19 00:00:00 UTC", + "price": 1780.159646 + }, + { + "Date": "2021-03-20 00:00:00 UTC", + "price": 1817.132963 + }, + { + "Date": "2021-03-21 00:00:00 UTC", + "price": 1817.860143 + }, + { + "Date": "2021-03-22 00:00:00 UTC", + "price": 1790.378075 + }, + { + "Date": "2021-03-23 00:00:00 UTC", + "price": 1686.891197 + }, + { + "Date": "2021-03-24 00:00:00 UTC", + "price": 1673.859184 + }, + { + "Date": "2021-03-25 00:00:00 UTC", + "price": 1581.631056 + }, + { + "Date": "2021-03-26 00:00:00 UTC", + "price": 1587.297964 + }, + { + "Date": "2021-03-27 00:00:00 UTC", + "price": 1700.366869 + }, + { + "Date": "2021-03-28 00:00:00 UTC", + "price": 1713.837876 + }, + { + "Date": "2021-03-29 00:00:00 UTC", + "price": 1689.036798 + }, + { + "Date": "2021-03-30 00:00:00 UTC", + "price": 1817.626388 + }, + { + "Date": "2021-03-31 00:00:00 UTC", + "price": 1840.294952 + }, + { + "Date": "2021-04-01 00:00:00 UTC", + "price": 1915.832536 + }, + { + "Date": "2021-04-02 00:00:00 UTC", + "price": 1970.4712 + }, + { + "Date": "2021-04-03 00:00:00 UTC", + "price": 2134.101788 + }, + { + "Date": "2021-04-04 00:00:00 UTC", + "price": 2016.667247 + }, + { + "Date": "2021-04-05 00:00:00 UTC", + "price": 2077.755212 + }, + { + "Date": "2021-04-06 00:00:00 UTC", + "price": 2097.796383 + }, + { + "Date": "2021-04-07 00:00:00 UTC", + "price": 2115.055452 + }, + { + "Date": "2021-04-08 00:00:00 UTC", + "price": 1989.148062 + }, + { + "Date": "2021-04-09 00:00:00 UTC", + "price": 2081.354063 + }, + { + "Date": "2021-04-10 00:00:00 UTC", + "price": 2069.667796 + }, + { + "Date": "2021-04-11 00:00:00 UTC", + "price": 2142.796065 + }, + { + "Date": "2021-04-12 00:00:00 UTC", + "price": 2150.265143 + }, + { + "Date": "2021-04-13 00:00:00 UTC", + "price": 2142.476276 + }, + { + "Date": "2021-04-14 00:00:00 UTC", + "price": 2304.343516 + }, + { + "Date": "2021-04-15 00:00:00 UTC", + "price": 2429.661528 + }, + { + "Date": "2021-04-16 00:00:00 UTC", + "price": 2514.168416 + }, + { + "Date": "2021-04-17 00:00:00 UTC", + "price": 2424.553845 + }, + { + "Date": "2021-04-18 00:00:00 UTC", + "price": 2345.266963 + }, + { + "Date": "2021-04-19 00:00:00 UTC", + "price": 2245.760753 + }, + { + "Date": "2021-04-20 00:00:00 UTC", + "price": 2168.032727 + }, + { + "Date": "2021-04-21 00:00:00 UTC", + "price": 2324.284687 + }, + { + "Date": "2021-04-22 00:00:00 UTC", + "price": 2373.501344 + }, + { + "Date": "2021-04-23 00:00:00 UTC", + "price": 2426.07115 + }, + { + "Date": "2021-04-24 00:00:00 UTC", + "price": 2364.231204 + }, + { + "Date": "2021-04-25 00:00:00 UTC", + "price": 2212.843798 + }, + { + "Date": "2021-04-26 00:00:00 UTC", + "price": 2307.355321 + }, + { + "Date": "2021-04-27 00:00:00 UTC", + "price": 2532.386803 + }, + { + "Date": "2021-04-28 00:00:00 UTC", + "price": 2647.15819 + }, + { + "Date": "2021-04-29 00:00:00 UTC", + "price": 2748.784585 + }, + { + "Date": "2021-04-30 00:00:00 UTC", + "price": 2757.497552 + }, + { + "Date": "2021-05-01 00:00:00 UTC", + "price": 2776.703712 + }, + { + "Date": "2021-05-02 00:00:00 UTC", + "price": 2944.916947 + }, + { + "Date": "2021-05-03 00:00:00 UTC", + "price": 2953.297348 + }, + { + "Date": "2021-05-04 00:00:00 UTC", + "price": 3439.85507 + }, + { + "Date": "2021-05-05 00:00:00 UTC", + "price": 3245.663149 + }, + { + "Date": "2021-05-06 00:00:00 UTC", + "price": 3524.562728 + }, + { + "Date": "2021-05-07 00:00:00 UTC", + "price": 3495.075869 + }, + { + "Date": "2021-05-08 00:00:00 UTC", + "price": 3493.5345 + }, + { + "Date": "2021-05-09 00:00:00 UTC", + "price": 3912.742917 + }, + { + "Date": "2021-05-10 00:00:00 UTC", + "price": 3932.754068 + }, + { + "Date": "2021-05-11 00:00:00 UTC", + "price": 3979.608652 + }, + { + "Date": "2021-05-12 00:00:00 UTC", + "price": 4182.790286 + }, + { + "Date": "2021-05-13 00:00:00 UTC", + "price": 3906.108903 + }, + { + "Date": "2021-05-14 00:00:00 UTC", + "price": 3750.341595 + }, + { + "Date": "2021-05-15 00:00:00 UTC", + "price": 4088.731708 + }, + { + "Date": "2021-05-16 00:00:00 UTC", + "price": 3659.921844 + }, + { + "Date": "2021-05-17 00:00:00 UTC", + "price": 3602.004897 + }, + { + "Date": "2021-05-18 00:00:00 UTC", + "price": 3288.229887 + }, + { + "Date": "2021-05-19 00:00:00 UTC", + "price": 3399.04928 + }, + { + "Date": "2021-05-20 00:00:00 UTC", + "price": 2505.014946 + }, + { + "Date": "2021-05-21 00:00:00 UTC", + "price": 2778.279661 + }, + { + "Date": "2021-05-22 00:00:00 UTC", + "price": 2419.103217 + }, + { + "Date": "2021-05-23 00:00:00 UTC", + "price": 2306.371267 + }, + { + "Date": "2021-05-24 00:00:00 UTC", + "price": 2120.037375 + }, + { + "Date": "2021-05-25 00:00:00 UTC", + "price": 2640.159632 + }, + { + "Date": "2021-05-26 00:00:00 UTC", + "price": 2695.477807 + }, + { + "Date": "2021-05-27 00:00:00 UTC", + "price": 2882.483408 + }, + { + "Date": "2021-05-28 00:00:00 UTC", + "price": 2742.990863 + }, + { + "Date": "2021-05-29 00:00:00 UTC", + "price": 2433.328866 + }, + { + "Date": "2021-05-30 00:00:00 UTC", + "price": 2294.626286 + }, + { + "Date": "2021-05-31 00:00:00 UTC", + "price": 2395.853228 + }, + { + "Date": "2021-06-01 00:00:00 UTC", + "price": 2708.429866 + }, + { + "Date": "2021-06-02 00:00:00 UTC", + "price": 2632.6566 + }, + { + "Date": "2021-06-03 00:00:00 UTC", + "price": 2717.154037 + }, + { + "Date": "2021-06-04 00:00:00 UTC", + "price": 2858.276702 + }, + { + "Date": "2021-06-05 00:00:00 UTC", + "price": 2694.497667 + }, + { + "Date": "2021-06-06 00:00:00 UTC", + "price": 2624.768915 + }, + { + "Date": "2021-06-07 00:00:00 UTC", + "price": 2711.547939 + }, + { + "Date": "2021-06-08 00:00:00 UTC", + "price": 2580.53558 + }, + { + "Date": "2021-06-09 00:00:00 UTC", + "price": 2528.022301 + }, + { + "Date": "2021-06-10 00:00:00 UTC", + "price": 2620.625389 + }, + { + "Date": "2021-06-11 00:00:00 UTC", + "price": 2486.600069 + }, + { + "Date": "2021-06-12 00:00:00 UTC", + "price": 2356.634774 + }, + { + "Date": "2021-06-13 00:00:00 UTC", + "price": 2379.991748 + }, + { + "Date": "2021-06-14 00:00:00 UTC", + "price": 2517.771696 + }, + { + "Date": "2021-06-15 00:00:00 UTC", + "price": 2587.381611 + }, + { + "Date": "2021-06-16 00:00:00 UTC", + "price": 2561.188331 + }, + { + "Date": "2021-06-17 00:00:00 UTC", + "price": 2365.872786 + }, + { + "Date": "2021-06-18 00:00:00 UTC", + "price": 2380.74452 + }, + { + "Date": "2021-06-19 00:00:00 UTC", + "price": 2231.554315 + }, + { + "Date": "2021-06-20 00:00:00 UTC", + "price": 2176.308536 + }, + { + "Date": "2021-06-21 00:00:00 UTC", + "price": 2251.560559 + }, + { + "Date": "2021-06-22 00:00:00 UTC", + "price": 1900.1223 + }, + { + "Date": "2021-06-23 00:00:00 UTC", + "price": 1875.357694 + }, + { + "Date": "2021-06-24 00:00:00 UTC", + "price": 1971.105978 + }, + { + "Date": "2021-06-25 00:00:00 UTC", + "price": 1990.076151 + }, + { + "Date": "2021-06-26 00:00:00 UTC", + "price": 1833.463161 + }, + { + "Date": "2021-06-27 00:00:00 UTC", + "price": 1817.047666 + }, + { + "Date": "2021-06-28 00:00:00 UTC", + "price": 1973.926865 + }, + { + "Date": "2021-06-29 00:00:00 UTC", + "price": 2087.518724 + }, + { + "Date": "2021-06-30 00:00:00 UTC", + "price": 2169.400068 + }, + { + "Date": "2021-07-01 00:00:00 UTC", + "price": 2279.354161 + }, + { + "Date": "2021-07-02 00:00:00 UTC", + "price": 2121.657901 + }, + { + "Date": "2021-07-03 00:00:00 UTC", + "price": 2157.880585 + }, + { + "Date": "2021-07-04 00:00:00 UTC", + "price": 2228.532399 + }, + { + "Date": "2021-07-05 00:00:00 UTC", + "price": 2329.004751 + }, + { + "Date": "2021-07-06 00:00:00 UTC", + "price": 2217.301853 + }, + { + "Date": "2021-07-07 00:00:00 UTC", + "price": 2320.654929 + }, + { + "Date": "2021-07-08 00:00:00 UTC", + "price": 2317.236943 + }, + { + "Date": "2021-07-09 00:00:00 UTC", + "price": 2126.442467 + }, + { + "Date": "2021-07-10 00:00:00 UTC", + "price": 2156.580957 + }, + { + "Date": "2021-07-11 00:00:00 UTC", + "price": 2123.058597 + }, + { + "Date": "2021-07-12 00:00:00 UTC", + "price": 2144.014257 + }, + { + "Date": "2021-07-13 00:00:00 UTC", + "price": 2042.499187 + }, + { + "Date": "2021-07-14 00:00:00 UTC", + "price": 1944.395017 + }, + { + "Date": "2021-07-15 00:00:00 UTC", + "price": 1997.663314 + }, + { + "Date": "2021-07-16 00:00:00 UTC", + "price": 1910.726952 + }, + { + "Date": "2021-07-17 00:00:00 UTC", + "price": 1874.20025 + }, + { + "Date": "2021-07-18 00:00:00 UTC", + "price": 1899.84275 + }, + { + "Date": "2021-07-19 00:00:00 UTC", + "price": 1905.723383 + }, + { + "Date": "2021-07-20 00:00:00 UTC", + "price": 1824.929392 + }, + { + "Date": "2021-07-21 00:00:00 UTC", + "price": 1794.973425 + }, + { + "Date": "2021-07-22 00:00:00 UTC", + "price": 2003.723921 + }, + { + "Date": "2021-07-23 00:00:00 UTC", + "price": 2027.533448 + }, + { + "Date": "2021-07-24 00:00:00 UTC", + "price": 2117.154608 + }, + { + "Date": "2021-07-25 00:00:00 UTC", + "price": 2183.627415 + }, + { + "Date": "2021-07-26 00:00:00 UTC", + "price": 2209.49936 + }, + { + "Date": "2021-07-27 00:00:00 UTC", + "price": 2230.212068 + }, + { + "Date": "2021-07-28 00:00:00 UTC", + "price": 2292.579637 + }, + { + "Date": "2021-07-29 00:00:00 UTC", + "price": 2299.689406 + }, + { + "Date": "2021-07-30 00:00:00 UTC", + "price": 2383.44326 + }, + { + "Date": "2021-07-31 00:00:00 UTC", + "price": 2462.399983 + }, + { + "Date": "2021-08-01 00:00:00 UTC", + "price": 2541.674599 + }, + { + "Date": "2021-08-02 00:00:00 UTC", + "price": 2555.408179 + }, + { + "Date": "2021-08-03 00:00:00 UTC", + "price": 2611.67307 + }, + { + "Date": "2021-08-04 00:00:00 UTC", + "price": 2521.268475 + }, + { + "Date": "2021-08-05 00:00:00 UTC", + "price": 2724.532243 + }, + { + "Date": "2021-08-06 00:00:00 UTC", + "price": 2821.649693 + }, + { + "Date": "2021-08-07 00:00:00 UTC", + "price": 2888.732274 + }, + { + "Date": "2021-08-08 00:00:00 UTC", + "price": 3151.217517 + }, + { + "Date": "2021-08-09 00:00:00 UTC", + "price": 3012.308559 + }, + { + "Date": "2021-08-10 00:00:00 UTC", + "price": 3163.064655 + }, + { + "Date": "2021-08-11 00:00:00 UTC", + "price": 3147.842995 + }, + { + "Date": "2021-08-12 00:00:00 UTC", + "price": 3166.647218 + }, + { + "Date": "2021-08-13 00:00:00 UTC", + "price": 3048.412682 + }, + { + "Date": "2021-08-14 00:00:00 UTC", + "price": 3323.197991 + }, + { + "Date": "2021-08-15 00:00:00 UTC", + "price": 3268.548177 + }, + { + "Date": "2021-08-16 00:00:00 UTC", + "price": 3309.75491 + }, + { + "Date": "2021-08-17 00:00:00 UTC", + "price": 3153.583684 + }, + { + "Date": "2021-08-18 00:00:00 UTC", + "price": 3007.144027 + }, + { + "Date": "2021-08-19 00:00:00 UTC", + "price": 3037.230251 + }, + { + "Date": "2021-08-20 00:00:00 UTC", + "price": 3144.818437 + }, + { + "Date": "2021-08-21 00:00:00 UTC", + "price": 3276.969837 + }, + { + "Date": "2021-08-22 00:00:00 UTC", + "price": 3224.00046 + }, + { + "Date": "2021-08-23 00:00:00 UTC", + "price": 3243.486358 + }, + { + "Date": "2021-08-24 00:00:00 UTC", + "price": 3320.40917 + }, + { + "Date": "2021-08-25 00:00:00 UTC", + "price": 3177.663796 + }, + { + "Date": "2021-08-26 00:00:00 UTC", + "price": 3231.441452 + }, + { + "Date": "2021-08-27 00:00:00 UTC", + "price": 3122.971797 + }, + { + "Date": "2021-08-28 00:00:00 UTC", + "price": 3267.539435 + }, + { + "Date": "2021-08-29 00:00:00 UTC", + "price": 3245.430222 + }, + { + "Date": "2021-08-30 00:00:00 UTC", + "price": 3233.383152 + }, + { + "Date": "2021-08-31 00:00:00 UTC", + "price": 3232.733863 + }, + { + "Date": "2021-09-01 00:00:00 UTC", + "price": 3440.562336 + }, + { + "Date": "2021-09-02 00:00:00 UTC", + "price": 3790.613996 + }, + { + "Date": "2021-09-03 00:00:00 UTC", + "price": 3793.300743 + }, + { + "Date": "2021-09-04 00:00:00 UTC", + "price": 3936.163392 + }, + { + "Date": "2021-09-05 00:00:00 UTC", + "price": 3894.937512 + }, + { + "Date": "2021-09-06 00:00:00 UTC", + "price": 3950.270345 + }, + { + "Date": "2021-09-07 00:00:00 UTC", + "price": 3943.256785 + }, + { + "Date": "2021-09-08 00:00:00 UTC", + "price": 3440.341757 + }, + { + "Date": "2021-09-09 00:00:00 UTC", + "price": 3496.859023 + }, + { + "Date": "2021-09-10 00:00:00 UTC", + "price": 3435.979933 + }, + { + "Date": "2021-09-11 00:00:00 UTC", + "price": 3209.915696 + }, + { + "Date": "2021-09-12 00:00:00 UTC", + "price": 3268.104162 + }, + { + "Date": "2021-09-13 00:00:00 UTC", + "price": 3417.839367 + }, + { + "Date": "2021-09-14 00:00:00 UTC", + "price": 3301.186777 + }, + { + "Date": "2021-09-15 00:00:00 UTC", + "price": 3425.250873 + }, + { + "Date": "2021-09-16 00:00:00 UTC", + "price": 3595.962571 + }, + { + "Date": "2021-09-17 00:00:00 UTC", + "price": 3573.307516 + }, + { + "Date": "2021-09-18 00:00:00 UTC", + "price": 3412.177182 + }, + { + "Date": "2021-09-19 00:00:00 UTC", + "price": 3427.584262 + }, + { + "Date": "2021-09-20 00:00:00 UTC", + "price": 3335.884887 + }, + { + "Date": "2021-09-21 00:00:00 UTC", + "price": 2977.322679 + }, + { + "Date": "2021-09-22 00:00:00 UTC", + "price": 2744.111 + }, + { + "Date": "2021-09-23 00:00:00 UTC", + "price": 3074.119761 + }, + { + "Date": "2021-09-24 00:00:00 UTC", + "price": 3159.269866 + }, + { + "Date": "2021-09-25 00:00:00 UTC", + "price": 2930.742706 + }, + { + "Date": "2021-09-26 00:00:00 UTC", + "price": 2946.970846 + }, + { + "Date": "2021-09-27 00:00:00 UTC", + "price": 3063.316345 + }, + { + "Date": "2021-09-28 00:00:00 UTC", + "price": 2939.742283 + }, + { + "Date": "2021-09-29 00:00:00 UTC", + "price": 2798.984417 + }, + { + "Date": "2021-09-30 00:00:00 UTC", + "price": 2855.611731 + }, + { + "Date": "2021-10-01 00:00:00 UTC", + "price": 3013.493232 + }, + { + "Date": "2021-10-02 00:00:00 UTC", + "price": 3305.107041 + }, + { + "Date": "2021-10-03 00:00:00 UTC", + "price": 3393.924249 + }, + { + "Date": "2021-10-04 00:00:00 UTC", + "price": 3426.387081 + }, + { + "Date": "2021-10-05 00:00:00 UTC", + "price": 3390.310408 + }, + { + "Date": "2021-10-06 00:00:00 UTC", + "price": 3520.342257 + }, + { + "Date": "2021-10-07 00:00:00 UTC", + "price": 3592.17613 + }, + { + "Date": "2021-10-08 00:00:00 UTC", + "price": 3594.918358 + }, + { + "Date": "2021-10-09 00:00:00 UTC", + "price": 3558.549577 + }, + { + "Date": "2021-10-10 00:00:00 UTC", + "price": 3588.080922 + }, + { + "Date": "2021-10-11 00:00:00 UTC", + "price": 3431.019307 + }, + { + "Date": "2021-10-12 00:00:00 UTC", + "price": 3537.840087 + }, + { + "Date": "2021-10-13 00:00:00 UTC", + "price": 3498.105292 + }, + { + "Date": "2021-10-14 00:00:00 UTC", + "price": 3605.650334 + }, + { + "Date": "2021-10-15 00:00:00 UTC", + "price": 3794.516888 + }, + { + "Date": "2021-10-16 00:00:00 UTC", + "price": 3885.641765 + }, + { + "Date": "2021-10-17 00:00:00 UTC", + "price": 3854.498461 + }, + { + "Date": "2021-10-18 00:00:00 UTC", + "price": 3854.223687 + }, + { + "Date": "2021-10-19 00:00:00 UTC", + "price": 3752.618727 + }, + { + "Date": "2021-10-20 00:00:00 UTC", + "price": 3884.587295 + }, + { + "Date": "2021-10-21 00:00:00 UTC", + "price": 4170.107933 + }, + { + "Date": "2021-10-22 00:00:00 UTC", + "price": 4074.860158 + }, + { + "Date": "2021-10-23 00:00:00 UTC", + "price": 3990.711976 + }, + { + "Date": "2021-10-24 00:00:00 UTC", + "price": 4179.442298 + }, + { + "Date": "2021-10-25 00:00:00 UTC", + "price": 4094.938993 + }, + { + "Date": "2021-10-26 00:00:00 UTC", + "price": 4230.208372 + }, + { + "Date": "2021-10-27 00:00:00 UTC", + "price": 4152.570289 + }, + { + "Date": "2021-10-28 00:00:00 UTC", + "price": 3944.090862 + }, + { + "Date": "2021-10-29 00:00:00 UTC", + "price": 4288.097219 + }, + { + "Date": "2021-10-30 00:00:00 UTC", + "price": 4422.940536 + }, + { + "Date": "2021-10-31 00:00:00 UTC", + "price": 4324.609926 + }, + { + "Date": "2021-11-01 00:00:00 UTC", + "price": 4292.040472 + }, + { + "Date": "2021-11-02 00:00:00 UTC", + "price": 4330.553152 + }, + { + "Date": "2021-11-03 00:00:00 UTC", + "price": 4596.593091 + }, + { + "Date": "2021-11-04 00:00:00 UTC", + "price": 4607.699273 + }, + { + "Date": "2021-11-05 00:00:00 UTC", + "price": 4550.014435 + }, + { + "Date": "2021-11-06 00:00:00 UTC", + "price": 4494.802761 + }, + { + "Date": "2021-11-07 00:00:00 UTC", + "price": 4527.104154 + }, + { + "Date": "2021-11-08 00:00:00 UTC", + "price": 4626.629288 + }, + { + "Date": "2021-11-09 00:00:00 UTC", + "price": 4815.004634 + }, + { + "Date": "2021-11-10 00:00:00 UTC", + "price": 4742.080911 + }, + { + "Date": "2021-11-11 00:00:00 UTC", + "price": 4641.528765 + }, + { + "Date": "2021-11-12 00:00:00 UTC", + "price": 4732.92445 + }, + { + "Date": "2021-11-13 00:00:00 UTC", + "price": 4685.106356 + }, + { + "Date": "2021-11-14 00:00:00 UTC", + "price": 4666.498498 + }, + { + "Date": "2021-11-15 00:00:00 UTC", + "price": 4652.947394 + }, + { + "Date": "2021-11-16 00:00:00 UTC", + "price": 4583.211419 + }, + { + "Date": "2021-11-17 00:00:00 UTC", + "price": 4243.352907 + }, + { + "Date": "2021-11-18 00:00:00 UTC", + "price": 4302.804959 + }, + { + "Date": "2021-11-19 00:00:00 UTC", + "price": 3993.846595 + }, + { + "Date": "2021-11-20 00:00:00 UTC", + "price": 4317.603196 + }, + { + "Date": "2021-11-21 00:00:00 UTC", + "price": 4436.192767 + }, + { + "Date": "2021-11-22 00:00:00 UTC", + "price": 4319.361567 + }, + { + "Date": "2021-11-23 00:00:00 UTC", + "price": 4101.062876 + }, + { + "Date": "2021-11-24 00:00:00 UTC", + "price": 4355.420958 + }, + { + "Date": "2021-11-25 00:00:00 UTC", + "price": 4269.43722 + }, + { + "Date": "2021-11-26 00:00:00 UTC", + "price": 4515.8433 + }, + { + "Date": "2021-11-27 00:00:00 UTC", + "price": 4048.312844 + }, + { + "Date": "2021-11-28 00:00:00 UTC", + "price": 4084.088486 + }, + { + "Date": "2021-11-29 00:00:00 UTC", + "price": 4290.091863 + }, + { + "Date": "2021-11-30 00:00:00 UTC", + "price": 4444.52828 + }, + { + "Date": "2021-12-01 00:00:00 UTC", + "price": 4637.121617 + }, + { + "Date": "2021-12-02 00:00:00 UTC", + "price": 4589.610618 + }, + { + "Date": "2021-12-03 00:00:00 UTC", + "price": 4519.441028 + }, + { + "Date": "2021-12-04 00:00:00 UTC", + "price": 4240.155517 + }, + { + "Date": "2021-12-05 00:00:00 UTC", + "price": 4101.656792 + }, + { + "Date": "2021-12-06 00:00:00 UTC", + "price": 4198.572875 + }, + { + "Date": "2021-12-07 00:00:00 UTC", + "price": 4347.615631 + }, + { + "Date": "2021-12-08 00:00:00 UTC", + "price": 4310.566646 + }, + { + "Date": "2021-12-09 00:00:00 UTC", + "price": 4431.540647 + }, + { + "Date": "2021-12-10 00:00:00 UTC", + "price": 4153.333311 + }, + { + "Date": "2021-12-11 00:00:00 UTC", + "price": 3918.200743 + }, + { + "Date": "2021-12-12 00:00:00 UTC", + "price": 4079.814931 + }, + { + "Date": "2021-12-13 00:00:00 UTC", + "price": 4135.84151 + }, + { + "Date": "2021-12-14 00:00:00 UTC", + "price": 3782.895262 + }, + { + "Date": "2021-12-15 00:00:00 UTC", + "price": 3858.164468 + }, + { + "Date": "2021-12-16 00:00:00 UTC", + "price": 4015.722543 + }, + { + "Date": "2021-12-17 00:00:00 UTC", + "price": 3971.559766 + }, + { + "Date": "2021-12-18 00:00:00 UTC", + "price": 3886.747362 + }, + { + "Date": "2021-12-19 00:00:00 UTC", + "price": 3966.425352 + }, + { + "Date": "2021-12-20 00:00:00 UTC", + "price": 3928.841724 + }, + { + "Date": "2021-12-21 00:00:00 UTC", + "price": 3950.482392 + }, + { + "Date": "2021-12-22 00:00:00 UTC", + "price": 4036.549718 + }, + { + "Date": "2021-12-23 00:00:00 UTC", + "price": 3992.594577 + }, + { + "Date": "2021-12-24 00:00:00 UTC", + "price": 4113.529932 + }, + { + "Date": "2021-12-25 00:00:00 UTC", + "price": 4055.117367 + }, + { + "Date": "2021-12-26 00:00:00 UTC", + "price": 4110.571871 + }, + { + "Date": "2021-12-27 00:00:00 UTC", + "price": 4075.031619 + }, + { + "Date": "2021-12-28 00:00:00 UTC", + "price": 4045.05135 + }, + { + "Date": "2021-12-29 00:00:00 UTC", + "price": 3807.360367 + }, + { + "Date": "2021-12-30 00:00:00 UTC", + "price": 3644.405517 + }, + { + "Date": "2021-12-31 00:00:00 UTC", + "price": 3714.945456 + } +] diff --git a/tinlake-ui/containers/PoolManagement/queries/index.ts b/tinlake-ui/containers/PoolManagement/queries/index.ts index a8c7f0c29..b13b149cc 100644 --- a/tinlake-ui/containers/PoolManagement/queries/index.ts +++ b/tinlake-ui/containers/PoolManagement/queries/index.ts @@ -2,7 +2,9 @@ import { PoolData } from '../../../utils/usePool' import { assetList } from './AssetList' import { dailyInvestorBalances } from './DailyInvestorBalances' import { dailyTokenPrices } from './DailyTokenPrices' +import { investorTransactions } from './InvestorTransactions' import { rawPoolData } from './PoolData' +import { taxReport2020, taxReport2021 } from './TaxReports' export type PoolQuery = ({ poolId, poolData }: { poolId: string; poolData: PoolData }) => Promise @@ -11,6 +13,9 @@ const queries: { [name: string]: PoolQuery } = { 'Daily token prices': dailyTokenPrices, 'List of assets': assetList, 'Raw pool data': rawPoolData, + 'Investor transactions': investorTransactions, + 'Tax report 2020': taxReport2020, + 'Tax report 2021': taxReport2021, } export default queries diff --git a/tinlake-ui/containers/PoolManagement/queries/util.ts b/tinlake-ui/containers/PoolManagement/queries/util.ts new file mode 100644 index 000000000..365359b52 --- /dev/null +++ b/tinlake-ui/containers/PoolManagement/queries/util.ts @@ -0,0 +1,262 @@ +import BN from 'bn.js' +import { ethers } from 'ethers' +import gql from 'graphql-tag' +import config from '../../../config' +import Apollo from '../../../services/apollo' +const rawEthPrices = require('./eth_prices.json') + +export const date = (timestamp: string) => new Date(parseInt(timestamp, 10) * 1000) +export const formatDateOnly = (date: Date) => date.toISOString().substr(0, 10) + +const provider = new ethers.providers.JsonRpcProvider(config.rpcUrl) + +type EthPrice = { Date: string; price: number } +export const ethPrices = (rawEthPrices as EthPrice[]).reduce((prev: any, price: EthPrice) => { + return { ...prev, ...{ [formatDateOnly(new Date(price.Date)).toString()]: price.price } } +}, {}) + +export const calculateCostInUsd = (gasPrice: number, gasUsed: number, timestamp: string) => { + const costInEth = + new BN(gasUsed) + .mul(new BN(gasPrice)) + .div(new BN(10).pow(new BN(12))) + .toNumber() / + 10 ** 6 + return costInEth * ethPrices[formatDateOnly(date(timestamp))] +} + +const fetchTransactions = async ( + poolId: string, + skip: number, + first: number, + blockHash: string | null +): Promise => { + return await Apollo.runCustomQuery(gql` + { + investorTransactions(where: {pool: ${`"${poolId.toLowerCase()}"`} }, orderBy: timestamp, orderDirection: desc, first: ${first}, skip: ${skip} ${ + blockHash ? `, block: { hash: "${blockHash}" }` : '' + }) { + pool { + shortName + } + type + symbol + currencyAmount + newBalance + tokenPrice + transaction + owner { + id + } + timestamp + gasPrice + gasUsed + } + _meta { + block { + hash + number + } + } + } + `) +} + +export async function getAllTransactions(poolId: string) { + let start = 0 + const limit = 1000 + + const transactions: any[] = [] + let blockHash: string | null = null + let blockNumber: number | null = null + + // eslint-disable-next-line no-constant-condition + while (true) { + const response: any = await fetchTransactions(poolId, start, limit, blockHash) + + if (blockHash === null) { + blockHash = response._meta.block.hash + } + if (blockNumber === null) { + blockNumber = response._meta.block.number + } + transactions.push(...response.investorTransactions) + if (response.investorTransactions.length < limit) { + break + } + start += limit + } + + const transactionsWithActualGasUsed = await Promise.all( + transactions.map(async (tx: any) => { + const receipt = await provider.getTransactionReceipt(tx.transaction) + return { + ...tx, + gasUsed: receipt.gasUsed.toNumber(), + gasPrice: receipt.effectiveGasPrice.toNumber(), + } + }) + ) + + const sorted = transactionsWithActualGasUsed.sort((a, b) => { + return date(a.timestamp).getTime() - date(b.timestamp).getTime() + }) + + return sorted +} + +const fetchERC20Transfers = async ( + poolId: string, + skip: number, + first: number, + blockHash: string | null +): Promise => { + return await Apollo.runCustomQuery(gql` + { + erc20Transfers(where: {pool: ${`"${poolId.toLowerCase()}"`} }, first: ${first}, skip: ${skip} ${ + blockHash ? `, block: { hash: "${blockHash}" }` : '' + }) { + id + transaction + from + to + amount + pool { + shortName + addresses { + seniorTranche + juniorTranche + } + seniorTokenPrice + juniorTokenPrice + } + token { + symbol + } + } + _meta { + block { + hash + number + } + } + } + `) +} + +export async function getAllTransfers(poolId: string): Promise { + let start = 0 + const limit = 1000 + + const transfers: any[] = [] + let blockHash: string | null = null + let blockNumber: number | null = null + + // eslint-disable-next-line no-constant-condition + while (true) { + const response: any = await fetchERC20Transfers(poolId, start, limit, blockHash) + + if (blockHash === null) { + blockHash = response._meta.block.hash + } + if (blockNumber === null) { + blockNumber = response._meta.block.number + } + transfers.push(...response.erc20Transfers) + if (response.erc20Transfers.length < limit) { + break + } + start += limit + } + + const nonContractTransfers = ( + await Promise.all( + transfers + .map((transfer: any) => { + return { + ...transfer, + isContract: + transfer.from === '0x0000000000000000000000000000000000000000' || + Object.values(transfer.pool.addresses).includes(transfer.from) || + Object.values(transfer.pool.addresses).includes(transfer.to), + } + }) + .filter((transfer: any) => !transfer.isContract) + .map(async (transfer: any) => { + const codeFrom = await provider.getCode(transfer.from) + const codeTo = await provider.getCode(transfer.to) + const block = await provider.getBlock(Number(transfer.id.split('-')[0])) + const receipt = await provider.getTransactionReceipt(transfer.transaction) + return { + ...transfer, + codeFrom, + codeTo, + timestamp: block.timestamp, + gasUsed: receipt.gasUsed.toNumber(), + gasPrice: receipt.effectiveGasPrice.toNumber(), + } + }) + ) + ).filter((transfer: any) => transfer.codeFrom === '0x' && transfer.codeTo === '0x') + + const sorted = nonContractTransfers.sort((a, b) => { + return date(a.timestamp).getTime() - date(b.timestamp).getTime() + }) + + return sorted +} + +const fetchTokenPrices = async ( + poolId: string, + skip: number, + first: number, + blockHash: string | null +): Promise => { + return await Apollo.runCustomQuery(gql` + { + dailyPoolDatas(where: {pool: ${`"${poolId.toLowerCase()}"`} }, first: ${first}, skip: ${skip} ${ + blockHash ? `, block: { hash: "${blockHash}" }` : '' + }) { + day { + id + } + juniorTokenPrice + seniorTokenPrice + } + _meta { + block { + hash + number + } + } + } + `) +} + +export async function getAllTokenPrices(poolId: string) { + let start = 0 + const limit = 1000 + + const tokenPrices: any[] = [] + let blockHash: string | null = null + let blockNumber: number | null = null + + // eslint-disable-next-line no-constant-condition + while (true) { + const response: any = await fetchTokenPrices(poolId, start, limit, blockHash) + + if (blockHash === null) { + blockHash = response._meta.block.hash + } + if (blockNumber === null) { + blockNumber = response._meta.block.number + } + tokenPrices.push(...response.dailyPoolDatas) + if (response.dailyPoolDatas.length < limit) { + break + } + start += limit + } + + return tokenPrices +} diff --git a/tinlake-ui/containers/Portfolio/transactionList.ts b/tinlake-ui/containers/Portfolio/transactionList.ts new file mode 100644 index 000000000..e79cb07de --- /dev/null +++ b/tinlake-ui/containers/Portfolio/transactionList.ts @@ -0,0 +1,104 @@ +import gql from 'graphql-tag' +import Apollo from '../../services/apollo' +import { downloadCSV } from '../../utils/export' +import { csvName } from '../DataQuery/queries' + +const fetch = async (owner: string, skip: number, first: number, blockHash: string | null): Promise => { + return await Apollo.runCustomQuery(gql` + { + investorTransactions(where: {owner: ${`"${owner}"`} }, orderBy: timestamp, orderDirection: desc, first: ${first}, skip: ${skip} ${ + blockHash ? `, block: { hash: "${blockHash}" }` : '' + }) { + pool { + shortName + } + type + symbol + currencyAmount + newBalance + tokenPrice + transaction + owner { + id + } + timestamp + gasPrice + gasUsed + } + _meta { + block { + hash + number + } + } + } + `) +} + +export async function investorTransactions(owner: string) { + let start = 0 + const limit = 1000 + + const results: any[] = [] + let blockHash: string | null = null + let blockNumber: number | null = null + + // subgraph only returns 1000 entries, fetch until no more entries are returned + // eslint-disable-next-line no-constant-condition + while (true) { + const response: any = await fetch(owner, start, limit, blockHash) + + if (blockHash === null) { + blockHash = response._meta.block.hash + } + if (blockNumber === null) { + blockNumber = response._meta.block.number + } + results.push(...response.investorTransactions) + if (response.investorTransactions.length < limit) { + break + } + start += limit + } + + const headers: { [key: string]: string } = { + timestamp: 'Date', + pool: 'Pool', + owner: 'Account', + type: 'Transaction Type', + symbol: 'Symbol', + currencyAmount: 'Currency Amount', + newBalance: 'New Balance', + tokenPrice: 'Token Price', + transaction: 'Transaction Hash', + gasPrice: 'Gas Price', + gasUsed: 'Gas Used', + } + + const date = (timestamp: string) => new Date(parseInt(timestamp, 10) * 1000) + const formatDate = (timestamp: string) => + `${date(timestamp).toISOString().substr(0, 10)} ${date(timestamp).toUTCString().substr(17)}` + + const rows: string[][] = [ + [...Object.keys(headers).map((key: string) => headers[key])], + ...results.map((el: any) => [ + el.timestamp ? formatDate(el.timestamp) : '-', + el.pool ? el.pool.shortName : '-', + el.owner ? el.owner.id : '-', + ...Object.keys(headers) + .filter((item: any) => !Object.keys(headers).slice(0, 3).includes(item)) + .map((item: any) => { + if (['currencyAmount', 'newBalance'].includes(item)) { + return el[item] ? el[item] / 10 ** 18 : '-' + } else if (item === 'tokenPrice') { + return el[item] ? el[item] / 10 ** 27 : '-' + } else if (item === 'gasPrice') { + return el[item] ? el[item] / 10 ** 9 : '-' + } + return el[item] ? el[item] : '-' + }), + ]), + ] + + downloadCSV(rows, csvName(`Investor Transaction List`)) +} diff --git a/tinlake-ui/package.json b/tinlake-ui/package.json index c736186f1..18138529d 100644 --- a/tinlake-ui/package.json +++ b/tinlake-ui/package.json @@ -73,6 +73,7 @@ "decimal.js-light": "2.5.0", "ethereum-blockies": "github:MyEtherWallet/blockies", "ethers": "5.4.7", + "fifo-capital-gains-js": "^0.1.1", "graphql": "15.0.0", "graphql-tag": "2.10.3", "grommet": "2.17.5", diff --git a/yarn.lock b/yarn.lock index 6b4c76fa4..cdab99e64 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2548,6 +2548,7 @@ __metadata: ethereum-blockies: "github:MyEtherWallet/blockies" ethers: 5.4.7 express: 4.17.1 + fifo-capital-gains-js: ^0.1.1 graphql: 15.0.0 graphql-tag: 2.10.3 grommet: 2.17.5 @@ -18826,6 +18827,15 @@ __metadata: languageName: node linkType: hard +"fifo-capital-gains-js@npm:^0.1.1": + version: 0.1.1 + resolution: "fifo-capital-gains-js@npm:0.1.1" + peerDependencies: + tslib: ">=1.9.0" + checksum: 42d494e9fe1f70026ca5dac8cbca093b6704d9947aeb46eaf793fc9feaf3e841dde52cca0ff1ca1585c6b3d3a38a10c80753c0032d784360d13a40257afecbd1 + languageName: node + linkType: hard + "figgy-pudding@npm:^3.5.1": version: 3.5.2 resolution: "figgy-pudding@npm:3.5.2"