frequi_origin/src/views/Trading.vue

234 lines
6.5 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"
2020-08-18 06:29:40 +00:00
@layout-updated="layoutUpdatedEvent"
>
<GridItem
2020-08-29 14:43:50 +00:00
:i="gridLayoutBotControls.i"
:x="gridLayoutBotControls.x"
:y="gridLayoutBotControls.y"
:w="gridLayoutBotControls.w"
:h="gridLayoutBotControls.h"
2020-09-12 15:51:00 +00:00
drag-allow-from=".card-header"
>
2020-08-31 18:01:51 +00:00
<DraggableContainer header="Bot Controls">
<ReloadControl class="mt-3" />
<BotControls />
</DraggableContainer>
</GridItem>
<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-3">
<b-tab title="Status" active>
<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>
</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"
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"
drag-allow-from=".card-header"
>
<DraggableContainer header="Trade Detail">
<TradeDetail :trade="tradeDetail"> </TradeDetail>
2020-08-31 18:01:51 +00:00
</DraggableContainer>
</GridItem>
<GridItem
2020-08-29 14:43:50 +00:00
:i="gridLayoutLogView.i"
:x="gridLayoutLogView.x"
:y="gridLayoutLogView.y"
:w="gridLayoutLogView.w"
:h="gridLayoutLogView.h"
2020-09-12 15:51:00 +00:00
drag-allow-from=".card-header"
>
2020-08-31 18:01:51 +00:00
<DraggableContainer header="Logs">
<LogViewer />
</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"
min-h="6"
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 TradeList from '@/components/ftbot/TradeList.vue';
import Performance from '@/components/ftbot/Performance.vue';
import BotControls from '@/components/ftbot/BotControls.vue';
import BotStatus from '@/components/ftbot/BotStatus.vue';
import Balance from '@/components/ftbot/Balance.vue';
import DailyStats from '@/components/ftbot/DailyStats.vue';
import FTBotAPIPairList from '@/components/ftbot/FTBotAPIPairList.vue';
2020-06-04 17:56:19 +00:00
import TradeDetail from '@/components/ftbot/TradeDetail.vue';
import ReloadControl from '@/components/ftbot/ReloadControl.vue';
2020-08-15 15:31:56 +00:00
import LogViewer from '@/components/ftbot/LogViewer.vue';
2020-08-31 18:01:51 +00:00
import DraggableContainer from '@/components/layout/DraggableContainer.vue';
2020-09-14 18:24:24 +00:00
import CandleChartContainer from '@/components/charts/CandleChartContainer.vue';
2020-06-29 18:43:54 +00:00
2020-08-29 09:23:39 +00:00
import { Trade } from '@/types';
2020-09-14 18:26:25 +00:00
import { BotStoreGetters } from '@/store/modules/ftbot';
2020-08-29 14:43:50 +00:00
import { TradeLayout, findGridLayout } from '@/store/modules/layout';
2020-06-29 18:43:54 +00:00
const ftbot = namespace('ftbot');
2020-08-18 06:29:40 +00:00
const layoutNs = namespace('layout');
2020-06-20 15:46:08 +00:00
@Component({
2020-05-18 18:49:30 +00:00
components: {
2020-08-29 09:38:43 +00:00
GridLayout,
GridItem,
2020-08-31 18:01:51 +00:00
DraggableContainer,
2020-05-18 18:49:30 +00:00
TradeList,
Performance,
BotControls,
BotStatus,
Balance,
DailyStats,
FTBotAPIPairList,
2020-06-04 17:56:19 +00:00
TradeDetail,
ReloadControl,
2020-08-15 15:31:56 +00:00
LogViewer,
2020-09-14 18:24:24 +00:00
CandleChartContainer,
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 {
2020-09-02 18:19:34 +00:00
@ftbot.State 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.State whitelist!: string[];
2020-08-18 06:29:40 +00:00
@layoutNs.Getter getTradingLayout!: GridItemData[];
@layoutNs.Mutation setTradingLayout;
get gridLayout(): GridItemData[] {
return this.getTradingLayout;
}
2020-08-29 14:43:50 +00:00
get gridLayoutBotControls(): GridItemData {
return findGridLayout(this.gridLayout, TradeLayout.botControls);
}
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-08-29 14:43:50 +00:00
get gridLayoutLogView(): GridItemData {
return findGridLayout(this.gridLayout, TradeLayout.logView);
}
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>