mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 11:35:14 +00:00
Introduce closedTrade type
This commit is contained in:
parent
b0c69f6d77
commit
79886014ab
|
@ -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 { Trade } from '@/store/types';
|
import { ClosedTrade } from '@/store/types';
|
||||||
|
|
||||||
// Define Column labels here to avoid typos
|
// Define Column labels here to avoid typos
|
||||||
const CHART_PROFIT = 'Profit';
|
const CHART_PROFIT = 'Profit';
|
||||||
|
@ -28,7 +28,7 @@ const CHART_TRADE_COUNT = 'Trade Count';
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class CumProfitChart extends Vue {
|
export default class CumProfitChart extends Vue {
|
||||||
@Prop({ required: true }) trades!: Array<Trade>;
|
@Prop({ required: true }) trades!: ClosedTrade[];
|
||||||
|
|
||||||
get cumulativeData() {
|
get cumulativeData() {
|
||||||
const res: Record<string, any>[] = [];
|
const res: Record<string, any>[] = [];
|
||||||
|
|
|
@ -74,7 +74,7 @@ export default class TradeList extends Vue {
|
||||||
|
|
||||||
perPage = this.activeTrades ? 200 : 15;
|
perPage = this.activeTrades ? 200 : 15;
|
||||||
|
|
||||||
tableFields: Array<Record<string, string>> = [
|
tableFields: Array<Record<string, string | Function>> = [
|
||||||
{ key: 'trade_id', label: 'ID' },
|
{ key: 'trade_id', label: 'ID' },
|
||||||
{ key: 'pair', label: 'Pair' },
|
{ key: 'pair', label: 'Pair' },
|
||||||
{ key: 'amount', label: 'Amount' },
|
{ key: 'amount', label: 'Amount' },
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
|
|
||||||
export function formatPercent(value: number): string {
|
export function formatPercent(value: number, decimals = 3): string {
|
||||||
return value ? `${(value * 100).toFixed(3)}%` : '';
|
return value ? `${(value * 100).toFixed(decimals)}%` : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatPrice(value: number): string {
|
export function formatPrice(value: number): string {
|
||||||
|
|
|
@ -138,3 +138,34 @@ export interface Trade {
|
||||||
initial_stop_loss_pct?: number;
|
initial_stop_loss_pct?: number;
|
||||||
open_order_id?: string;
|
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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user