|
1 | 1 | <script setup lang="ts"> |
2 | | -import { |
3 | | - MarketKey, |
4 | | - BusEvents, |
5 | | - UiSpotMarket, |
6 | | - GridStrategyType, |
7 | | - InvestmentTypeGst, |
8 | | - SpotGridTradingForm |
9 | | -} from '@/types' |
10 | | -
|
11 | | -const spotMarket = inject(MarketKey) as Ref<UiSpotMarket> |
12 | | -
|
13 | | -const gridStrategyStore = useGridStrategyStore() |
14 | | -const strategyType = ref(GridStrategyType.Auto) |
15 | | -
|
16 | | -useForm<SpotGridTradingForm>({ |
17 | | - initialValues: { |
18 | | - investmentType: InvestmentTypeGst.BaseAndQuote |
19 | | - }, |
20 | | - keepValuesOnUnmount: true |
21 | | -}) |
22 | | -
|
23 | | -const activeStrategy = computed(() => |
24 | | - gridStrategyStore.activeSpotStrategies.find((strategy) => { |
25 | | - return strategy.marketId === spotMarket.value?.marketId |
26 | | - }) |
27 | | -) |
28 | | -
|
29 | | -function updateType(type: GridStrategyType) { |
30 | | - strategyType.value = type |
31 | | -} |
32 | | -
|
33 | | -function onOpenTradingBotDetails() { |
34 | | - if (!activeStrategy.value) { |
35 | | - return |
36 | | - } |
37 | | -
|
38 | | - useEventBus(BusEvents.OpenTradingBotDetails).emit(activeStrategy.value) |
39 | | -} |
| 2 | +// Trading Bots disabled in this build. |
40 | 3 | </script> |
41 | 4 |
|
42 | 5 | <template> |
43 | | - <div class="p-4"> |
44 | | - <PartialsTradingBotsSpotStrategyDetails |
45 | | - v-if="activeStrategy" |
46 | | - v-bind="{ activeStrategy, market: spotMarket }" |
47 | | - /> |
48 | | - |
49 | | - <div v-else> |
50 | | - <div class="flex mt-4 bg-brand-875 rounded-md"> |
51 | | - <AppButtonSelect |
52 | | - v-for="type in Object.values(GridStrategyType)" |
53 | | - :key="type" |
54 | | - v-bind="{ value: type }" |
55 | | - v-model="strategyType" |
56 | | - class="flex-1 rounded-md" |
57 | | - active-classes="bg-blue-500" |
58 | | - > |
59 | | - <template #default="{ isActive }"> |
60 | | - <AppButton |
61 | | - :variant="isActive ? 'primary' : 'primary-cta'" |
62 | | - :class="['w-full py-1.5 leading-relaxed focus-within:ring-0']" |
63 | | - > |
64 | | - {{ $t(`tradingBots.${type}`) }} |
65 | | - </AppButton> |
66 | | - </template> |
67 | | - </AppButtonSelect> |
68 | | - </div> |
69 | | - |
70 | | - <div> |
71 | | - <PartialsTradeSpotFormTradingBotsAuto |
72 | | - v-if="strategyType === GridStrategyType.Auto" |
73 | | - :has-active-strategy="!!activeStrategy" |
74 | | - @update:tab="updateType" |
75 | | - @view:details="onOpenTradingBotDetails" |
76 | | - /> |
77 | | - |
78 | | - <PartialsTradeSpotFormTradingBotsManual |
79 | | - v-else |
80 | | - :has-active-strategy="!!activeStrategy" |
81 | | - @view:details="onOpenTradingBotDetails" |
82 | | - /> |
83 | | - </div> |
84 | | - </div> |
85 | | - </div> |
| 6 | + <div /> |
86 | 7 | </template> |
0 commit comments