2022-09-29 19:21:31 +00:00
|
|
|
import React from 'react'
|
2022-09-14 16:51:14 +00:00
|
|
|
|
2022-09-29 19:21:31 +00:00
|
|
|
import Container from 'components/Container'
|
|
|
|
import { formatCurrency } from 'utils/formatters'
|
2022-09-02 11:51:00 +00:00
|
|
|
|
2022-09-08 06:23:02 +00:00
|
|
|
const mockedAccounts = [
|
|
|
|
{
|
|
|
|
id: 1,
|
2022-09-29 19:21:31 +00:00
|
|
|
label: 'Subaccount 1',
|
2022-09-08 06:23:02 +00:00
|
|
|
networth: 100000,
|
|
|
|
totalPositionValue: 150000,
|
|
|
|
debt: 50000,
|
|
|
|
profit: 25000,
|
|
|
|
leverage: 3,
|
|
|
|
maxLeverage: 5,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 2,
|
2022-09-29 19:21:31 +00:00
|
|
|
label: 'Subaccount 2',
|
2022-09-08 06:34:05 +00:00
|
|
|
networth: 33000,
|
|
|
|
totalPositionValue: 11000,
|
|
|
|
debt: 20000,
|
|
|
|
profit: -11366,
|
|
|
|
leverage: 2,
|
|
|
|
maxLeverage: 10,
|
2022-09-08 06:23:02 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 3,
|
2022-09-29 19:21:31 +00:00
|
|
|
label: 'Subaccount 3',
|
2022-09-08 06:34:05 +00:00
|
|
|
networth: 0,
|
|
|
|
totalPositionValue: 12938129,
|
|
|
|
debt: 9999999999,
|
|
|
|
profit: -99999999,
|
2022-09-08 06:23:02 +00:00
|
|
|
leverage: 3,
|
|
|
|
maxLeverage: 5,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 4,
|
2022-09-29 19:21:31 +00:00
|
|
|
label: 'Subaccount 4',
|
2022-09-08 06:34:05 +00:00
|
|
|
networth: 33653.22,
|
|
|
|
totalPositionValue: 100000,
|
|
|
|
debt: 50001.9,
|
2022-09-08 06:23:02 +00:00
|
|
|
profit: 25000,
|
|
|
|
leverage: 3,
|
|
|
|
maxLeverage: 5,
|
|
|
|
},
|
2022-09-29 19:21:31 +00:00
|
|
|
]
|
2022-09-08 06:23:02 +00:00
|
|
|
|
2022-09-02 11:51:00 +00:00
|
|
|
const Portfolio = () => {
|
2022-09-02 14:55:49 +00:00
|
|
|
return (
|
|
|
|
<div className="flex flex-col gap-4">
|
|
|
|
<Container className="flex-1">Portfolio Module</Container>
|
|
|
|
<div className="grid grid-cols-2 gap-4">
|
2022-09-08 06:23:02 +00:00
|
|
|
{mockedAccounts.map((account) => (
|
2022-09-08 06:34:05 +00:00
|
|
|
<Container key={account.id}>
|
|
|
|
<p className="mb-4 text-center font-bold">{account.label}</p>
|
|
|
|
<div className="grid grid-cols-3 gap-4">
|
|
|
|
<div>
|
|
|
|
<p>{formatCurrency(account.networth)}</p>
|
|
|
|
<p className="text-sm text-white/40">Net worth</p>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<p>{formatCurrency(account.totalPositionValue)}</p>
|
|
|
|
<p className="text-sm text-white/40">Total Position Value</p>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<p>{formatCurrency(account.debt)}</p>
|
|
|
|
<p className="text-sm text-white/40">Debt</p>
|
|
|
|
</div>
|
|
|
|
<div>
|
2022-09-29 19:21:31 +00:00
|
|
|
<p className={`${account.profit > 0 ? 'text-green-400' : 'text-red-500'}`}>
|
|
|
|
{account.profit > 0 && '+'}
|
2022-09-08 06:34:05 +00:00
|
|
|
{formatCurrency(account.profit)}
|
|
|
|
</p>
|
|
|
|
<p className="text-sm text-white/40">P&L</p>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<p>{account.leverage}</p>
|
|
|
|
<p className="text-sm text-white/40">Current Leverage</p>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<p>{account.maxLeverage}</p>
|
|
|
|
<p className="text-sm text-white/40">Max Leverage</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Container>
|
2022-09-08 06:23:02 +00:00
|
|
|
))}
|
2022-09-02 14:55:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-09-29 19:21:31 +00:00
|
|
|
)
|
|
|
|
}
|
2022-09-02 11:51:00 +00:00
|
|
|
|
2022-09-29 19:21:31 +00:00
|
|
|
export default Portfolio
|