frequi_origin/src/views/Trading.vue

220 lines
6.4 KiB
Vue
Raw Normal View History

<template>
2020-08-18 06:29:40 +00:00
<GridLayout
class="h-100 w-100"
:row-height="50"
:layout="gridLayout"
2020-08-25 17:45:35 +00:00
:vertical-compact="false"
:margin="[5, 5]"
2021-05-28 17:07:34 +00:00
:is-resizable="!getLayoutLocked"
:is-draggable="!getLayoutLocked"
2020-08-18 06:29:40 +00:00
@layout-updated="layoutUpdatedEvent"
>
<GridItem
2020-08-29 14:43:50 +00:00
:i="gridLayoutMultiPane.i"
:x="gridLayoutMultiPane.x"
:y="gridLayoutMultiPane.y"
:w="gridLayoutMultiPane.w"
:h="gridLayoutMultiPane.h"
2020-09-12 15:51:00 +00:00
drag-allow-from=".card-header"
>
2020-08-31 18:01:51 +00:00
<DraggableContainer header="Multi Pane">
<b-tabs content-class="mt-3" class="mt-1">
2020-11-20 06:08:24 +00:00
<b-tab title="Pairs combined" active>
2020-12-05 16:17:39 +00:00
<PairSummary :pairlist="whitelist" :current-locks="currentLocks" :trades="openTrades" />
2020-11-20 06:08:24 +00:00
</b-tab>
2021-08-30 17:57:42 +00:00
<b-tab title="General">
<div class="d-flex justify-content-center">
<BotControls class="mt-1 mb-2" />
</div>
2020-08-31 18:01:51 +00:00
<BotStatus />
</b-tab>
<b-tab title="Performance">
<Performance class="performance-view" />
</b-tab>
<b-tab title="Balance" lazy>
<Balance />
</b-tab>
<b-tab title="Daily Stats" lazy>
<DailyStats />
</b-tab>
<b-tab title="Pairlist" lazy>
<FTBotAPIPairList />
</b-tab>
2020-10-24 18:04:01 +00:00
<b-tab title="Pair Locks" lazy>
<PairLockList />
</b-tab>
2020-08-31 18:01:51 +00:00
</b-tabs>
</DraggableContainer>
</GridItem>
<GridItem
2020-08-29 14:43:50 +00:00
:i="gridLayoutOpenTrades.i"
:x="gridLayoutOpenTrades.x"
:y="gridLayoutOpenTrades.y"
:w="gridLayoutOpenTrades.w"
:h="gridLayoutOpenTrades.h"
drag-allow-from=".card-header"
>
2020-08-31 18:01:51 +00:00
<DraggableContainer header="Open Trades">
<TradeList
class="open-trades"
:trades="openTrades"
title="Open trades"
:active-trades="true"
empty-text="Currently no open trades."
/>
</DraggableContainer>
</GridItem>
<GridItem
2020-08-29 14:43:50 +00:00
:i="gridLayoutTradeHistory.i"
:x="gridLayoutTradeHistory.x"
:y="gridLayoutTradeHistory.y"
:w="gridLayoutTradeHistory.w"
:h="gridLayoutTradeHistory.h"
drag-allow-from=".card-header"
>
2020-08-31 18:01:51 +00:00
<DraggableContainer header="Closed Trades">
<TradeList
class="trade-history"
:trades="closedTrades"
title="Trade history"
2021-12-25 09:06:00 +00:00
:show-filter="true"
2020-08-31 18:01:51 +00:00
empty-text="No closed trades so far."
/>
</DraggableContainer>
</GridItem>
<GridItem
v-if="detailTradeId"
:i="gridLayoutTradeDetail.i"
:x="gridLayoutTradeDetail.x"
:y="gridLayoutTradeDetail.y"
:w="gridLayoutTradeDetail.w"
:h="gridLayoutTradeDetail.h"
2020-09-30 13:33:07 +00:00
:min-h="4"
drag-allow-from=".card-header"
>
<DraggableContainer header="Trade Detail">
<TradeDetail :trade="tradeDetail"> </TradeDetail>
2020-08-31 18:01:51 +00:00
</DraggableContainer>
</GridItem>
2020-09-14 18:24:24 +00:00
<GridItem
:i="gridLayoutChartView.i"
:x="gridLayoutChartView.x"
:y="gridLayoutChartView.y"
:w="gridLayoutChartView.w"
:h="gridLayoutChartView.h"
2020-09-27 07:23:35 +00:00
:min-h="6"
2020-09-14 18:24:24 +00:00
drag-allow-from=".card-header"
>
<DraggableContainer header="Chart">
<CandleChartContainer
:available-pairs="whitelist"
:historic-view="!!false"
:timeframe="timeframe"
:trades="allTrades"
>
</CandleChartContainer>
</DraggableContainer>
</GridItem>
</GridLayout>
</template>
2020-06-20 15:46:08 +00:00
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
2020-06-29 19:14:16 +00:00
import { namespace } from 'vuex-class';
2020-08-29 09:38:43 +00:00
import { GridLayout, GridItem, GridItemData } from 'vue-grid-layout';
import Balance from '@/components/ftbot/Balance.vue';
import BotControls from '@/components/ftbot/BotControls.vue';
import BotStatus from '@/components/ftbot/BotStatus.vue';
import CandleChartContainer from '@/components/charts/CandleChartContainer.vue';
import DailyStats from '@/components/ftbot/DailyStats.vue';
import DraggableContainer from '@/components/layout/DraggableContainer.vue';
import FTBotAPIPairList from '@/components/ftbot/FTBotAPIPairList.vue';
2020-10-24 18:04:01 +00:00
import PairLockList from '@/components/ftbot/PairLockList.vue';
2020-10-31 08:40:40 +00:00
import PairSummary from '@/components/ftbot/PairSummary.vue';
import Performance from '@/components/ftbot/Performance.vue';
2020-06-04 17:56:19 +00:00
import TradeDetail from '@/components/ftbot/TradeDetail.vue';
import TradeList from '@/components/ftbot/TradeList.vue';
2020-06-29 18:43:54 +00:00
import { Lock, Trade } from '@/types';
2020-09-14 18:26:25 +00:00
import { BotStoreGetters } from '@/store/modules/ftbot';
2020-10-06 05:59:05 +00:00
import { TradeLayout, findGridLayout, LayoutGetters, LayoutActions } from '@/store/modules/layout';
import StoreModules from '@/store/storeSubModules';
2020-06-29 18:43:54 +00:00
const ftbot = namespace(StoreModules.ftbot);
const layoutNs = namespace(StoreModules.layout);
2020-06-20 15:46:08 +00:00
@Component({
2020-05-18 18:49:30 +00:00
components: {
Balance,
2020-05-18 18:49:30 +00:00
BotControls,
BotStatus,
CandleChartContainer,
2020-05-18 18:49:30 +00:00
DailyStats,
DraggableContainer,
FTBotAPIPairList,
GridItem,
GridLayout,
2020-10-24 18:04:01 +00:00
PairLockList,
2020-10-31 08:40:40 +00:00
PairSummary,
Performance,
2020-06-04 17:56:19 +00:00
TradeDetail,
TradeList,
2020-05-18 18:49:30 +00:00
},
2020-06-20 15:46:08 +00:00
})
2020-06-29 18:43:54 +00:00
export default class Trading extends Vue {
@ftbot.Getter [BotStoreGetters.detailTradeId]!: number;
2020-06-29 18:43:54 +00:00
2020-09-14 18:24:24 +00:00
@ftbot.Getter [BotStoreGetters.openTrades]!: Trade[];
2020-06-29 18:43:54 +00:00
2020-09-14 18:24:24 +00:00
@ftbot.Getter [BotStoreGetters.closedTrades]!: Trade[];
@ftbot.Getter [BotStoreGetters.allTrades]!: Trade[];
2020-06-29 18:43:54 +00:00
2020-09-14 18:26:25 +00:00
@ftbot.Getter [BotStoreGetters.tradeDetail]!: Trade;
2020-09-14 18:24:24 +00:00
@ftbot.Getter [BotStoreGetters.timeframe]!: string;
@ftbot.Getter [BotStoreGetters.currentLocks]!: Lock[];
@ftbot.Getter [BotStoreGetters.whitelist]!: string[];
2020-09-14 18:24:24 +00:00
2020-10-06 05:59:05 +00:00
@layoutNs.Getter [LayoutGetters.getTradingLayout]!: GridItemData[];
2020-08-18 06:29:40 +00:00
2020-10-06 05:59:05 +00:00
@layoutNs.Action [LayoutActions.setTradingLayout];
2020-08-18 06:29:40 +00:00
2021-05-28 17:07:34 +00:00
@layoutNs.Getter [LayoutGetters.getLayoutLocked]: boolean;
2020-08-18 06:29:40 +00:00
get gridLayout(): GridItemData[] {
return this.getTradingLayout;
}
2020-08-29 14:43:50 +00:00
get gridLayoutMultiPane(): GridItemData {
return findGridLayout(this.gridLayout, TradeLayout.multiPane);
}
get gridLayoutOpenTrades(): GridItemData {
return findGridLayout(this.gridLayout, TradeLayout.openTrades);
}
get gridLayoutTradeHistory(): GridItemData {
return findGridLayout(this.gridLayout, TradeLayout.tradeHistory);
}
get gridLayoutTradeDetail(): GridItemData {
return findGridLayout(this.gridLayout, TradeLayout.tradeDetail);
}
2020-09-14 18:24:24 +00:00
get gridLayoutChartView(): GridItemData {
return findGridLayout(this.gridLayout, TradeLayout.chartView);
}
2020-08-18 06:29:40 +00:00
layoutUpdatedEvent(newLayout) {
this.setTradingLayout(newLayout);
}
2020-06-29 18:43:54 +00:00
}
</script>
<style scoped></style>