changed timestamps and file names

This commit is contained in:
Yandre 2021-12-06 14:26:22 -05:00
parent 5c5d52c7c0
commit 9ab940673c
3 changed files with 17 additions and 9 deletions

View File

@ -44,9 +44,9 @@ const AccountFunding = () => {
dataToExport = [
...dataToExport,
...hourlyFunding[asset].map((funding) => {
console.log(funding)
const timestamp = new Date(funding.time)
return {
timestamp: funding.time,
timestamp: `${timestamp.toLocaleDateString()} ${timestamp.toLocaleTimeString()}`,
asset: asset,
amount: funding.total_funding,
}
@ -54,7 +54,9 @@ const AccountFunding = () => {
]
}
const title = 'Mango Markets - Funding History - ' + new Date().toString()
const title = `${
mangoAccount.name || mangoAccount.publicKey
}-Funding-${new Date().toLocaleDateString()}`
const columns = ['Timestamp', 'Asset', 'Amount']
exportDataToCSV(dataToExport, title, columns, t)

View File

@ -57,7 +57,7 @@ export default function AccountHistory() {
if (view == 'Trades') {
dataToExport = tradeHistory.map((trade) => {
console.log(trade)
const timestamp = new Date(trade.loadTimestamp)
return {
asset: trade.marketName,
orderType: trade.side.toUpperCase(),
@ -66,7 +66,7 @@ export default function AccountHistory() {
value: trade.value,
liquidity: trade.liquidity,
fee: trade.feeCost,
date: trade.loadTimestamp,
date: `${timestamp.toLocaleDateString()} ${timestamp.toLocaleTimeString()}`,
}
})
headers = [
@ -84,9 +84,10 @@ export default function AccountHistory() {
.filter((val) => val.activity_type == view)
.map((row) => {
row = row.activity_details
const timestamp = new Date(row.block_datetime)
return {
date: row.block_datetime,
date: `${timestamp.toLocaleDateString()} ${timestamp.toLocaleTimeString()}`,
asset: row.symbol,
quantity: row.quantity,
value: row.usd_equivalent,
@ -105,7 +106,9 @@ export default function AccountHistory() {
}
const tab = historyViews.filter((v) => v.key == view)[0].label
const title = `Mango Markets - ${tab} - ' + ${new Date().toString()}`
const title = `${
mangoAccount.name || mangoAccount.publicKey
}-${tab}-${new Date().toLocaleDateString()}`
exportDataToCSV(dataToExport, title, headers, t)
}

View File

@ -62,8 +62,9 @@ const AccountInterest = () => {
dataToExport = [
...dataToExport,
...hourlyInterestStats[asset].map((interest) => {
const timestamp = new Date(interest.time)
return {
timestamp: interest.time,
timestamp: `${timestamp.toLocaleDateString()} ${timestamp.toLocaleTimeString()}`,
asset: asset,
deposit_interest: interest.deposit_interest,
borrow_interest: interest.borrow_interest,
@ -72,7 +73,9 @@ const AccountInterest = () => {
]
}
const title = 'Mango Markets - Interest History - ' + new Date().toString()
const title = `${
mangoAccount.name || mangoAccount.publicKey
}-Interest-${new Date().toLocaleDateString()}`
const headers = [
'Timestamp',
'Asset',