-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afdac92
commit 746a3a5
Showing
15 changed files
with
425 additions
and
147 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import ReactEcharts from "echarts-for-react"; | ||
import useResponseStore from '../utils/useResponseStore'; | ||
|
||
const CoinPriceChart = () => { | ||
|
||
const { responseBackTest } = useResponseStore(); | ||
|
||
const { | ||
trading_logs | ||
} = responseBackTest.payload; | ||
|
||
const option = { | ||
legend: { | ||
data: ['매수', '매도'] | ||
}, | ||
xAxis: { | ||
type: 'category', | ||
boundaryGap: false, | ||
axisLine: { | ||
onZero: false | ||
}, | ||
data: trading_logs.map((log) =>{ | ||
const dateObj = new Date(log.date) | ||
const date = dateObj.toLocaleDateString() | ||
return date | ||
}) | ||
}, | ||
yAxis: { | ||
axisLabel: { | ||
formatter: function(value) { | ||
if(value >= 1000000) return (value / 1000000) + 'M' | ||
if(value >= 1000) return (value / 1000000) + 'K' | ||
return value | ||
} | ||
} | ||
}, | ||
series: [ | ||
{ | ||
name: "매수", | ||
type: "bar", | ||
data: trading_logs.map((log) => { | ||
if(log.type === '매수') return log.coin_price | ||
return 0 | ||
}) | ||
}, | ||
{ | ||
name: '매도', | ||
type: 'bar', | ||
data: trading_logs.map((log) => { | ||
if(log.type === '매도') return log.coin_price | ||
return 0 | ||
}) | ||
} | ||
] | ||
} | ||
|
||
return ( | ||
<div className="w-full h-full rounded-xl shadow-xl border pt-5"> | ||
<ReactEcharts option={option} style={{width:'100%', height:'100%'}} className="relative right-0"/> | ||
</div> | ||
|
||
) | ||
} | ||
|
||
export default CoinPriceChart |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import ReactEcharts from "echarts-for-react"; | ||
import useResponseStore from '../utils/useResponseStore'; | ||
|
||
const TradingProfitRateChart = () => { | ||
|
||
const { responseBackTest } = useResponseStore(); | ||
|
||
const { | ||
trading_logs | ||
} = responseBackTest.payload; | ||
|
||
const tradeDate = trading_logs.map((log) =>{ | ||
if(log.type === '매도'){ | ||
const dateObj = new Date(log.date) | ||
const date = dateObj.toLocaleDateString() | ||
return date | ||
} | ||
}) | ||
const tradeRate = trading_logs.map((log) => { | ||
if(log.type ==='매도') return log.rate | ||
}) | ||
|
||
const option = { | ||
legend: { | ||
data: ['매도'] | ||
}, | ||
xAxis: { | ||
type: 'category', | ||
boundaryGap: false, | ||
axisLine: { | ||
onZero: false | ||
}, | ||
data: tradeDate.filter(item => item !== undefined) | ||
}, | ||
yAxis: { | ||
scale:true, | ||
axisLabel: { | ||
formatter: function(value) { | ||
return value | ||
} | ||
} | ||
}, | ||
series: [ | ||
{ | ||
name: '매도', | ||
type: 'bar', | ||
data: tradeRate.filter(item => item !== undefined) | ||
} | ||
] | ||
} | ||
|
||
|
||
|
||
return ( | ||
<div className="h-full rounded-xl shadow-xl border pt-5"> | ||
<ReactEcharts option={option} style={{width:'100%', height:'100%'}} className="relative right-0"/> | ||
</div> | ||
) | ||
} | ||
|
||
export default TradingProfitRateChart |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import ReactEcharts from "echarts-for-react"; | ||
|
||
const WinLossChart = ({performance}) => { | ||
|
||
const option = { | ||
series: [ | ||
{ | ||
type: 'gauge', | ||
startAngle: 180, | ||
endAngle: 0, | ||
center: ['50%', '86%'], | ||
radius: '125%', | ||
min: 0, | ||
max: 100, | ||
splitNumber: 8, | ||
axisLine: { | ||
lineStyle: { | ||
width: 6, | ||
color: [ | ||
[0.25, '#FF6E76'], | ||
[0.5, '#FDDD60'], | ||
[0.75, '#58D9F9'], | ||
[1, '#7CFFB2'] | ||
] | ||
} | ||
}, | ||
pointer: { | ||
icon: 'path://M12.8,0.7l12,40.1H0.7L12.8,0.7z', | ||
length: '12%', | ||
width: 20, | ||
offsetCenter: [0, '-60%'], | ||
itemStyle: { | ||
color: 'auto' | ||
} | ||
}, | ||
axisTick: { | ||
length: 12, | ||
lineStyle: { | ||
color: 'auto', | ||
width: 2 | ||
} | ||
}, | ||
splitLine: { | ||
length: 20, | ||
lineStyle: { | ||
color: 'auto', | ||
width: 5 | ||
} | ||
}, | ||
axisLabel: { | ||
color: '#464646', | ||
fontSize: 16, | ||
distance: -50, | ||
rotate: 'tangential', | ||
formatter: function (value) { | ||
if (value === 87.5) { | ||
return 'Grade A'; | ||
} else if (value === 62.5) { | ||
return 'Grade B'; | ||
} else if (value === 37.5) { | ||
return 'Grade C'; | ||
} else if (value === 12.5) { | ||
return 'Grade D'; | ||
} | ||
return ''; | ||
} | ||
}, | ||
title: { | ||
offsetCenter: [0, '-10%'], | ||
fontSize: 18 | ||
}, | ||
detail: { | ||
fontSize: 32, | ||
offsetCenter: [0, '-35%'], | ||
valueAnimation: true, | ||
formatter: function (value) { | ||
return Math.round(value) + '%'; | ||
}, | ||
color: 'inherit' | ||
}, | ||
data: [ | ||
{ | ||
value: performance.win_rate, | ||
name: 'Win Rating' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
|
||
return ( | ||
<ReactEcharts option={option} style={{width:'100%', height:'100%'}}/> | ||
) | ||
} | ||
|
||
export default WinLossChart |
Oops, something went wrong.