diff --git a/src/components/charts/CumProfitChart.vue b/src/components/charts/CumProfitChart.vue index 0b41a783..8ad46bb4 100644 --- a/src/components/charts/CumProfitChart.vue +++ b/src/components/charts/CumProfitChart.vue @@ -16,7 +16,7 @@ import 'echarts/lib/component/dataZoom'; import 'echarts/lib/component/visualMap'; import 'echarts/lib/component/visualMapPiecewise'; -import { Trade } from '@/store/types'; +import { ClosedTrade } from '@/store/types'; // Define Column labels here to avoid typos const CHART_PROFIT = 'Profit'; @@ -28,7 +28,7 @@ const CHART_TRADE_COUNT = 'Trade Count'; }, }) export default class CumProfitChart extends Vue { - @Prop({ required: true }) trades!: Array; + @Prop({ required: true }) trades!: ClosedTrade[]; get cumulativeData() { const res: Record[] = []; diff --git a/src/components/ftbot/TradeList.vue b/src/components/ftbot/TradeList.vue index b0064146..851aaba3 100644 --- a/src/components/ftbot/TradeList.vue +++ b/src/components/ftbot/TradeList.vue @@ -74,7 +74,7 @@ export default class TradeList extends Vue { perPage = this.activeTrades ? 200 : 15; - tableFields: Array> = [ + tableFields: Array> = [ { key: 'trade_id', label: 'ID' }, { key: 'pair', label: 'Pair' }, { key: 'amount', label: 'Amount' }, diff --git a/src/shared/formatters.ts b/src/shared/formatters.ts index 886050bb..88060643 100644 --- a/src/shared/formatters.ts +++ b/src/shared/formatters.ts @@ -1,7 +1,7 @@ import * as moment from 'moment'; -export function formatPercent(value: number): string { - return value ? `${(value * 100).toFixed(3)}%` : ''; +export function formatPercent(value: number, decimals = 3): string { + return value ? `${(value * 100).toFixed(decimals)}%` : ''; } export function formatPrice(value: number): string { diff --git a/src/store/types.ts b/src/store/types.ts index 79b53432..d10c5a75 100644 --- a/src/store/types.ts +++ b/src/store/types.ts @@ -138,3 +138,34 @@ export interface Trade { initial_stop_loss_pct?: number; open_order_id?: string; } + +export interface ClosedTrade extends Trade { + fee_open_cost: number; + fee_open_currency: string; + + /** Close date in the format Y-M-d HH:mm:ss */ + close_date: string; + close_timestamp: number; + close_rate: number; + close_profit: number; + close_profit_abs: number; + fee_close: number; + fee_close_cost?: number; + fee_close_currency?: string; + + current_rate?: number; + sell_reason?: string; + min_rate?: number; + max_rate?: number; + + stop_loss_abs: number; + stop_loss_ratio: number; + stop_loss_pct: number; + stoploss_order_id?: string; + stoploss_last_update?: string; + stoploss_last_update_timestamp?: number; + initial_stop_loss_abs?: number; + initial_stop_loss_ratio?: number; + initial_stop_loss_pct?: number; + open_order_id?: string; +}