Show stake amount in trade detail

This commit is contained in:
Matthias 2021-12-30 09:42:24 +01:00
parent d7ed2e46c8
commit 4a9846cdd1
3 changed files with 15 additions and 2 deletions

View File

@ -5,6 +5,9 @@
<h5 class="detail-header">General</h5> <h5 class="detail-header">General</h5>
<ValuePair description="TradeId">{{ trade.trade_id }}</ValuePair> <ValuePair description="TradeId">{{ trade.trade_id }}</ValuePair>
<ValuePair description="Pair">{{ trade.pair }}</ValuePair> <ValuePair description="Pair">{{ trade.pair }}</ValuePair>
<ValuePair description="Stake">{{
formatPriceCurrency(trade.stake_amount, stakeCurrency)
}}</ValuePair>
<ValuePair description="Open date">{{ timestampms(trade.open_timestamp) }}</ValuePair> <ValuePair description="Open date">{{ timestampms(trade.open_timestamp) }}</ValuePair>
<ValuePair v-if="trade.buy_tag" description="Buy tag">{{ trade.buy_tag }}</ValuePair> <ValuePair v-if="trade.buy_tag" description="Buy tag">{{ trade.buy_tag }}</ValuePair>
<ValuePair description="Open Rate">{{ formatPrice(trade.open_rate) }}</ValuePair> <ValuePair description="Open Rate">{{ formatPrice(trade.open_rate) }}</ValuePair>
@ -57,7 +60,7 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue, Prop } from 'vue-property-decorator'; import { Component, Vue, Prop } from 'vue-property-decorator';
import { formatPercent, formatPrice, timestampms } from '@/shared/formatters'; import { formatPercent, formatPriceCurrency, formatPrice, timestampms } from '@/shared/formatters';
import ValuePair from '@/components/general/ValuePair.vue'; import ValuePair from '@/components/general/ValuePair.vue';
import { Trade } from '@/types'; import { Trade } from '@/types';
@ -67,11 +70,15 @@ import { Trade } from '@/types';
export default class TradeDetail extends Vue { export default class TradeDetail extends Vue {
@Prop({ type: Object, required: true }) trade!: Trade; @Prop({ type: Object, required: true }) trade!: Trade;
@Prop({ type: String, required: true }) stakeCurrency!: string;
timestampms = timestampms; timestampms = timestampms;
formatPercent = formatPercent; formatPercent = formatPercent;
formatPrice = formatPrice; formatPrice = formatPrice;
formatPriceCurrency = formatPriceCurrency;
} }
</script> </script>
<style scoped> <style scoped>

View File

@ -76,6 +76,7 @@ export enum BotStoreGetters {
selectedBacktestResult = 'selectedBacktestResult', selectedBacktestResult = 'selectedBacktestResult',
canRunBacktest = 'canRunBacktest', canRunBacktest = 'canRunBacktest',
stakeCurrencyDecimals = 'stakeCurrencyDecimals', stakeCurrencyDecimals = 'stakeCurrencyDecimals',
stakeCurrency = 'stakeCurrency',
strategyPlotConfig = 'strategyPlotConfig', strategyPlotConfig = 'strategyPlotConfig',
version = 'version', version = 'version',
botApiVersion = 'botApiVersion', botApiVersion = 'botApiVersion',
@ -251,6 +252,9 @@ export function createBotSubStore(botId: string, botName: string) {
[BotStoreGetters.stakeCurrencyDecimals](state: FtbotStateType): number { [BotStoreGetters.stakeCurrencyDecimals](state: FtbotStateType): number {
return state.botState?.stake_currency_decimals || 3; return state.botState?.stake_currency_decimals || 3;
}, },
[BotStoreGetters.stakeCurrency](state: FtbotStateType): string {
return state.botState?.stake_currency || '';
},
[BotStoreGetters.strategyPlotConfig](state: FtbotStateType): PlotConfig | undefined { [BotStoreGetters.strategyPlotConfig](state: FtbotStateType): PlotConfig | undefined {
return state.strategyPlotConfig; return state.strategyPlotConfig;
}, },

View File

@ -100,7 +100,7 @@
drag-allow-from=".card-header" drag-allow-from=".card-header"
> >
<DraggableContainer header="Trade Detail"> <DraggableContainer header="Trade Detail">
<TradeDetail :trade="tradeDetail"> </TradeDetail> <TradeDetail :trade="tradeDetail" :stake-currency="stakeCurrency" />
</DraggableContainer> </DraggableContainer>
</GridItem> </GridItem>
<GridItem <GridItem
@ -187,6 +187,8 @@ export default class Trading extends Vue {
@ftbot.Getter [BotStoreGetters.whitelist]!: string[]; @ftbot.Getter [BotStoreGetters.whitelist]!: string[];
@ftbot.Getter [BotStoreGetters.stakeCurrency]!: string;
@layoutNs.Getter [LayoutGetters.getTradingLayout]!: GridItemData[]; @layoutNs.Getter [LayoutGetters.getTradingLayout]!: GridItemData[];
@layoutNs.Getter [LayoutGetters.getTradingLayoutSm]!: GridItemData[]; @layoutNs.Getter [LayoutGetters.getTradingLayoutSm]!: GridItemData[];