frequi_origin/src/views/TradingView.vue

217 lines
7.0 KiB
Vue
Raw Normal View History

<template>
<grid-layout
2020-08-18 06:29:40 +00:00
class="h-100 w-100"
:row-height="50"
:layout="gridLayoutData"
2020-08-25 17:45:35 +00:00
:vertical-compact="false"
:margin="[5, 5]"
2021-12-26 15:27:30 +00:00
:responsive-layouts="responsiveGridLayouts"
:is-resizable="!isLayoutLocked"
:is-draggable="!isLayoutLocked"
:responsive="true"
2022-01-01 16:22:32 +00:00
:cols="{ lg: 12, md: 12, sm: 12, xs: 4, xxs: 2 }"
:col-num="12"
@update:breakpoint="breakpointChanged"
2020-08-18 06:29:40 +00:00
>
<template #default="{ gridItemProps }">
<grid-item
v-if="gridLayoutMultiPane.h != 0"
v-bind="gridItemProps"
:i="gridLayoutMultiPane.i"
:x="gridLayoutMultiPane.x"
:y="gridLayoutMultiPane.y"
:w="gridLayoutMultiPane.w"
:h="gridLayoutMultiPane.h"
drag-allow-from=".card-header"
>
<DraggableContainer header="Multi Pane">
<div class="mt-1 d-flex justify-content-center">
<BotControls class="mt-1 mb-2" />
</div>
<b-tabs content-class="mt-3" class="mt-1">
<b-tab title="Pairs combined" active>
<PairSummary
:pairlist="botStore.activeBot.whitelist"
:current-locks="botStore.activeBot.activeLocks"
:trades="botStore.activeBot.openTrades"
/>
</b-tab>
<b-tab title="General">
<BotStatus />
</b-tab>
<b-tab title="Performance">
2023-04-13 04:44:21 +00:00
<BotPerformance 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-tab title="Pair Locks" lazy>
<PairLockList />
</b-tab>
</b-tabs>
</DraggableContainer>
</grid-item>
<grid-item
v-if="gridLayoutOpenTrades.h != 0"
v-bind="gridItemProps"
:i="gridLayoutOpenTrades.i"
:x="gridLayoutOpenTrades.x"
:y="gridLayoutOpenTrades.y"
:w="gridLayoutOpenTrades.w"
:h="gridLayoutOpenTrades.h"
drag-allow-from=".card-header"
>
<DraggableContainer header="Open Trades">
<TradeList
class="open-trades"
:trades="botStore.activeBot.openTrades"
title="Open trades"
:active-trades="true"
empty-text="Currently no open trades."
/>
</DraggableContainer>
</grid-item>
<grid-item
v-if="gridLayoutTradeHistory.h != 0"
v-bind="gridItemProps"
:i="gridLayoutTradeHistory.i"
:x="gridLayoutTradeHistory.x"
:y="gridLayoutTradeHistory.y"
:w="gridLayoutTradeHistory.w"
:h="gridLayoutTradeHistory.h"
drag-allow-from=".card-header"
>
<DraggableContainer header="Closed Trades">
<trade-list
class="trade-history"
:trades="botStore.activeBot.closedTrades"
title="Trade history"
:show-filter="true"
empty-text="No closed trades so far."
/>
</DraggableContainer>
</grid-item>
<grid-item
v-if="
botStore.activeBot.detailTradeId &&
botStore.activeBot.tradeDetail &&
gridLayoutTradeDetail.h != 0
"
v-bind="gridItemProps"
:i="gridLayoutTradeDetail.i"
:x="gridLayoutTradeDetail.x"
:y="gridLayoutTradeDetail.y"
:w="gridLayoutTradeDetail.w"
:h="gridLayoutTradeDetail.h"
:min-h="4"
drag-allow-from=".card-header"
>
<DraggableContainer header="Trade Detail">
<TradeDetail
:trade="botStore.activeBot.tradeDetail"
:stake-currency="botStore.activeBot.stakeCurrency"
/>
</DraggableContainer>
</grid-item>
<grid-item
v-if="gridLayoutTradeDetail.h != 0"
v-bind="gridItemProps"
: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="botStore.activeBot.whitelist"
:historic-view="!!false"
:timeframe="botStore.activeBot.timeframe"
:trades="botStore.activeBot.allTrades"
>
</CandleChartContainer>
</DraggableContainer>
</grid-item>
</template>
</grid-layout>
</template>
2023-02-15 17:14:25 +00:00
<script setup lang="ts">
import { GridItemData } from '@/types';
2023-04-13 04:47:46 +00:00
import Balance from '@/components/ftbot/BotBalance.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';
2023-04-13 04:47:46 +00:00
import BotPerformance from '@/components/ftbot/BotPerformance.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
2023-02-15 17:14:25 +00:00
import { ref, computed } from 'vue';
import { useLayoutStore, findGridLayout, TradeLayout } from '@/stores/layout';
2022-04-18 17:30:17 +00:00
import { useBotStore } from '@/stores/ftbotwrapper';
2020-06-29 18:43:54 +00:00
2023-02-15 17:14:25 +00:00
const botStore = useBotStore();
const layoutStore = useLayoutStore();
const currentBreakpoint = ref('');
const breakpointChanged = (newBreakpoint) => {
// console.log('breakpoint:', newBreakpoint);
currentBreakpoint.value = newBreakpoint;
};
const isResizableLayout = computed(() =>
['', 'sm', 'md', 'lg', 'xl'].includes(currentBreakpoint.value),
);
const isLayoutLocked = computed(() => {
2023-04-12 16:26:17 +00:00
return layoutStore.layoutLocked || !isResizableLayout.value;
2023-02-15 17:14:25 +00:00
});
const gridLayoutData = computed((): GridItemData[] => {
2023-04-12 16:26:17 +00:00
if (isResizableLayout.value) {
2023-02-15 17:14:25 +00:00
return layoutStore.tradingLayout;
}
return [...layoutStore.getTradingLayoutSm];
});
2023-02-15 17:14:25 +00:00
const gridLayoutMultiPane = computed(() => {
return findGridLayout(gridLayoutData.value, TradeLayout.multiPane);
});
2023-02-15 17:14:25 +00:00
const gridLayoutOpenTrades = computed(() => {
return findGridLayout(gridLayoutData.value, TradeLayout.openTrades);
});
2023-02-15 17:14:25 +00:00
const gridLayoutTradeHistory = computed(() => {
return findGridLayout(gridLayoutData.value, TradeLayout.tradeHistory);
});
2023-02-15 17:14:25 +00:00
const gridLayoutTradeDetail = computed(() => {
return findGridLayout(gridLayoutData.value, TradeLayout.tradeDetail);
});
2021-12-26 15:27:30 +00:00
2023-02-15 17:14:25 +00:00
const gridLayoutChartView = computed(() => {
return findGridLayout(gridLayoutData.value, TradeLayout.chartView);
});
2022-04-18 17:30:17 +00:00
2023-02-15 17:14:25 +00:00
const responsiveGridLayouts = computed(() => {
return {
sm: layoutStore.getTradingLayoutSm,
};
});
</script>
<style scoped></style>