Create more types for UI

This commit is contained in:
Matthias 2020-08-29 11:32:26 +02:00
parent 3ed6fd79ac
commit 3aba82f917
5 changed files with 10 additions and 4 deletions

View File

@ -16,7 +16,7 @@ import 'echarts/lib/component/dataZoom';
import 'echarts/lib/component/visualMap'; import 'echarts/lib/component/visualMap';
import 'echarts/lib/component/visualMapPiecewise'; import 'echarts/lib/component/visualMapPiecewise';
import { ClosedTrade } from '@/types'; import { ClosedTrade, CumProfitData } from '@/types';
// Define Column labels here to avoid typos // Define Column labels here to avoid typos
const CHART_PROFIT = 'Profit'; const CHART_PROFIT = 'Profit';
@ -31,7 +31,7 @@ export default class CumProfitChart extends Vue {
@Prop({ required: true }) trades!: ClosedTrade[]; @Prop({ required: true }) trades!: ClosedTrade[];
get cumulativeData() { get cumulativeData() {
const res: Record<string, any>[] = []; const res: CumProfitData[] = [];
const closedTrades = this.trades; // .filter((t) => t.close_timestamp); const closedTrades = this.trades; // .filter((t) => t.close_timestamp);
closedTrades.sort((a, b) => (a.close_timestamp > b.close_timestamp ? 1 : -1)); closedTrades.sort((a, b) => (a.close_timestamp > b.close_timestamp ? 1 : -1));

5
src/types/chart.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
export interface CumProfitData {
date: number;
profit: number;
raising: boolean;
}

View File

@ -1,3 +1,4 @@
export * from './auth.types'; export * from './auth.d';
export * from './chart.d';
export * from './types'; export * from './types.d';