2020-05-17 21:41:38 +00:00
|
|
|
<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-12-21 18:39:55 +00:00
|
|
|
: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 }"
|
2020-08-18 06:29:40 +00:00
|
|
|
@layout-updated="layoutUpdatedEvent"
|
2021-12-26 15:27:30 +00:00
|
|
|
@breakpoint-changed="breakpointChanged"
|
2020-08-18 06:29:40 +00:00
|
|
|
>
|
2020-08-17 05:10:33 +00:00
|
|
|
<GridItem
|
2021-12-26 15:27:30 +00:00
|
|
|
v-if="gridLayoutMultiPane.h != 0"
|
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-17 05:10:33 +00:00
|
|
|
>
|
2020-08-31 18:01:51 +00:00
|
|
|
<DraggableContainer header="Multi Pane">
|
2021-08-29 13:40:54 +00:00
|
|
|
<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>
|
2020-08-17 05:10:33 +00:00
|
|
|
</GridItem>
|
|
|
|
<GridItem
|
2021-12-26 15:27:30 +00:00
|
|
|
v-if="gridLayoutOpenTrades.h != 0"
|
2020-08-29 14:43:50 +00:00
|
|
|
:i="gridLayoutOpenTrades.i"
|
|
|
|
:x="gridLayoutOpenTrades.x"
|
|
|
|
:y="gridLayoutOpenTrades.y"
|
|
|
|
:w="gridLayoutOpenTrades.w"
|
|
|
|
:h="gridLayoutOpenTrades.h"
|
2020-08-17 05:10:33 +00:00
|
|
|
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>
|
2020-08-17 05:10:33 +00:00
|
|
|
</GridItem>
|
|
|
|
<GridItem
|
2021-12-26 15:27:30 +00:00
|
|
|
v-if="gridLayoutTradeHistory.h != 0"
|
2020-08-29 14:43:50 +00:00
|
|
|
:i="gridLayoutTradeHistory.i"
|
|
|
|
:x="gridLayoutTradeHistory.x"
|
|
|
|
:y="gridLayoutTradeHistory.y"
|
|
|
|
:w="gridLayoutTradeHistory.w"
|
|
|
|
:h="gridLayoutTradeHistory.h"
|
2020-08-17 05:10:33 +00:00
|
|
|
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."
|
|
|
|
/>
|
2020-09-01 05:51:03 +00:00
|
|
|
</DraggableContainer>
|
|
|
|
</GridItem>
|
|
|
|
<GridItem
|
2021-12-26 15:27:30 +00:00
|
|
|
v-if="detailTradeId && gridLayoutTradeDetail.h != 0"
|
2020-09-01 05:51:03 +00:00
|
|
|
: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"
|
2020-09-01 05:51:03 +00:00
|
|
|
drag-allow-from=".card-header"
|
|
|
|
>
|
|
|
|
<DraggableContainer header="Trade Detail">
|
2021-12-30 08:42:24 +00:00
|
|
|
<TradeDetail :trade="tradeDetail" :stake-currency="stakeCurrency" />
|
2020-08-31 18:01:51 +00:00
|
|
|
</DraggableContainer>
|
2020-08-17 05:10:33 +00:00
|
|
|
</GridItem>
|
2020-09-14 18:24:24 +00:00
|
|
|
<GridItem
|
2021-12-26 15:27:30 +00:00
|
|
|
v-if="gridLayoutTradeDetail.h != 0"
|
2020-09-14 18:24:24 +00:00
|
|
|
: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>
|
2020-08-17 05:10:33 +00:00
|
|
|
</GridLayout>
|
2020-05-17 21:41:38 +00:00
|
|
|
</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';
|
2020-05-17 21:41:38 +00:00
|
|
|
|
2021-10-05 17:26:07 +00:00
|
|
|
import Balance from '@/components/ftbot/Balance.vue';
|
2020-05-18 15:41:58 +00:00
|
|
|
import BotControls from '@/components/ftbot/BotControls.vue';
|
|
|
|
import BotStatus from '@/components/ftbot/BotStatus.vue';
|
2021-10-05 17:26:07 +00:00
|
|
|
import CandleChartContainer from '@/components/charts/CandleChartContainer.vue';
|
2020-05-18 15:41:58 +00:00
|
|
|
import DailyStats from '@/components/ftbot/DailyStats.vue';
|
2021-10-05 17:26:07 +00:00
|
|
|
import DraggableContainer from '@/components/layout/DraggableContainer.vue';
|
2020-05-22 12:43:32 +00:00
|
|
|
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';
|
2021-10-05 17:26:07 +00:00
|
|
|
import Performance from '@/components/ftbot/Performance.vue';
|
2020-06-04 17:56:19 +00:00
|
|
|
import TradeDetail from '@/components/ftbot/TradeDetail.vue';
|
2021-10-05 17:26:07 +00:00
|
|
|
import TradeList from '@/components/ftbot/TradeList.vue';
|
2020-06-29 18:43:54 +00:00
|
|
|
|
2020-12-05 16:06:26 +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';
|
2021-12-20 19:12:57 +00:00
|
|
|
import StoreModules from '@/store/storeSubModules';
|
2020-06-29 18:43:54 +00:00
|
|
|
|
2021-12-20 19:12:57 +00:00
|
|
|
const ftbot = namespace(StoreModules.ftbot);
|
|
|
|
const layoutNs = namespace(StoreModules.layout);
|
2020-05-17 21:41:38 +00:00
|
|
|
|
2020-06-20 15:46:08 +00:00
|
|
|
@Component({
|
2020-05-18 18:49:30 +00:00
|
|
|
components: {
|
2021-10-05 17:26:07 +00:00
|
|
|
Balance,
|
2020-05-18 18:49:30 +00:00
|
|
|
BotControls,
|
|
|
|
BotStatus,
|
2021-10-05 17:26:07 +00:00
|
|
|
CandleChartContainer,
|
2020-05-18 18:49:30 +00:00
|
|
|
DailyStats,
|
2021-10-05 17:26:07 +00:00
|
|
|
DraggableContainer,
|
2020-05-22 12:43:32 +00:00
|
|
|
FTBotAPIPairList,
|
2021-10-05 17:26:07 +00:00
|
|
|
GridItem,
|
|
|
|
GridLayout,
|
2020-10-24 18:04:01 +00:00
|
|
|
PairLockList,
|
2020-10-31 08:40:40 +00:00
|
|
|
PairSummary,
|
2021-10-05 17:26:07 +00:00
|
|
|
Performance,
|
2020-06-04 17:56:19 +00:00
|
|
|
TradeDetail,
|
2021-10-05 17:26:07 +00:00
|
|
|
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 {
|
2021-08-28 09:39:03 +00:00
|
|
|
@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-08-17 05:10:33 +00:00
|
|
|
|
2020-09-14 18:24:24 +00:00
|
|
|
@ftbot.Getter [BotStoreGetters.timeframe]!: string;
|
|
|
|
|
2020-12-05 16:06:26 +00:00
|
|
|
@ftbot.Getter [BotStoreGetters.currentLocks]!: Lock[];
|
|
|
|
|
2021-08-28 09:39:03 +00:00
|
|
|
@ftbot.Getter [BotStoreGetters.whitelist]!: string[];
|
2020-09-14 18:24:24 +00:00
|
|
|
|
2021-12-30 08:42:24 +00:00
|
|
|
@ftbot.Getter [BotStoreGetters.stakeCurrency]!: string;
|
|
|
|
|
2020-10-06 05:59:05 +00:00
|
|
|
@layoutNs.Getter [LayoutGetters.getTradingLayout]!: GridItemData[];
|
2020-08-18 06:29:40 +00:00
|
|
|
|
2021-12-26 15:27:30 +00:00
|
|
|
@layoutNs.Getter [LayoutGetters.getTradingLayoutSm]!: GridItemData[];
|
|
|
|
|
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;
|
|
|
|
|
2021-12-26 15:27:30 +00:00
|
|
|
currentBreakpoint = '';
|
|
|
|
|
|
|
|
localGridLayout: GridItemData[] = [];
|
|
|
|
|
|
|
|
get isLayoutLocked() {
|
|
|
|
return this.getLayoutLocked || !this.isResizableLayout;
|
|
|
|
}
|
|
|
|
|
|
|
|
get isResizableLayout() {
|
2022-01-01 16:22:32 +00:00
|
|
|
return ['', 'sm', 'md', 'lg', 'xl'].includes(this.currentBreakpoint);
|
2021-12-26 15:27:30 +00:00
|
|
|
}
|
|
|
|
|
2020-08-18 06:29:40 +00:00
|
|
|
get gridLayout(): GridItemData[] {
|
2021-12-26 15:27:30 +00:00
|
|
|
if (this.isResizableLayout) {
|
|
|
|
return this.getTradingLayout;
|
|
|
|
}
|
|
|
|
return this.localGridLayout;
|
|
|
|
}
|
|
|
|
|
|
|
|
set gridLayout(newLayout) {
|
|
|
|
// Dummy setter to make gridLayout happy. Updates happen through layoutUpdated.
|
2020-08-18 06:29:40 +00:00
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2020-09-01 05:51:03 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2021-12-26 15:27:30 +00:00
|
|
|
mounted() {
|
|
|
|
this.localGridLayout = [...this.getTradingLayoutSm];
|
|
|
|
}
|
|
|
|
|
2020-08-18 06:29:40 +00:00
|
|
|
layoutUpdatedEvent(newLayout) {
|
2021-12-26 15:27:30 +00:00
|
|
|
if (this.isResizableLayout) {
|
|
|
|
this.setTradingLayout(newLayout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
get responsiveGridLayouts() {
|
|
|
|
return {
|
|
|
|
sm: this[LayoutGetters.getTradingLayoutSm],
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
breakpointChanged(newBreakpoint) {
|
2022-01-01 16:22:32 +00:00
|
|
|
console.log('breakpoint:', newBreakpoint);
|
2021-12-26 15:27:30 +00:00
|
|
|
this.currentBreakpoint = newBreakpoint;
|
2020-08-18 06:29:40 +00:00
|
|
|
}
|
2020-06-29 18:43:54 +00:00
|
|
|
}
|
2020-05-17 21:41:38 +00:00
|
|
|
</script>
|
|
|
|
|
2020-08-17 05:10:33 +00:00
|
|
|
<style scoped></style>
|