mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-24 03:55:15 +00:00
feat: Improve download-main settings
This commit is contained in:
parent
933b8fd318
commit
5d7120d1ca
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { DownloadDataPayload } from '@/types';
|
import { DownloadDataPayload, ExchangeSelection, MarginMode, TradingMode } from '@/types';
|
||||||
|
|
||||||
const botStore = useBotStore();
|
const botStore = useBotStore();
|
||||||
const pairs = ref<string[]>(['XRP/USDT', 'BTC/USDT']);
|
const pairs = ref<string[]>(['XRP/USDT', 'BTC/USDT']);
|
||||||
|
@ -7,27 +7,29 @@ const timeframes = ref<string[]>(['5m', '1h']);
|
||||||
|
|
||||||
const { pairTemplates } = usePairTemplates();
|
const { pairTemplates } = usePairTemplates();
|
||||||
|
|
||||||
const exchange = ref({
|
const exchange = ref<{
|
||||||
|
customExchange: boolean;
|
||||||
|
selectedExchange: ExchangeSelection;
|
||||||
|
}>({
|
||||||
customExchange: false,
|
customExchange: false,
|
||||||
selectedExchange: {
|
selectedExchange: {
|
||||||
exchange: 'binance',
|
exchange: 'binance',
|
||||||
trade_mode: {
|
trade_mode: {
|
||||||
margin_mode: '',
|
margin_mode: MarginMode.NONE,
|
||||||
trading_mode: 'spot',
|
trading_mode: TradingMode.SPOT,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function addPair() {
|
const erase = ref(false);
|
||||||
pairs.value.push('');
|
const downloadTrades = ref(false);
|
||||||
}
|
|
||||||
|
// State to track the collapse status
|
||||||
|
const isAdvancedOpen = ref(false);
|
||||||
|
|
||||||
function addPairs(_pairs: string[]) {
|
function addPairs(_pairs: string[]) {
|
||||||
pairs.value.push(..._pairs);
|
pairs.value.push(..._pairs);
|
||||||
}
|
}
|
||||||
function addTimeframe() {
|
|
||||||
timeframes.value.push('');
|
|
||||||
}
|
|
||||||
|
|
||||||
async function startDownload() {
|
async function startDownload() {
|
||||||
const payload: DownloadDataPayload = {
|
const payload: DownloadDataPayload = {
|
||||||
|
@ -35,12 +37,19 @@ async function startDownload() {
|
||||||
timeframes: timeframes.value.filter((tf) => tf !== ''),
|
timeframes: timeframes.value.filter((tf) => tf !== ''),
|
||||||
timerange: '20240101-',
|
timerange: '20240101-',
|
||||||
};
|
};
|
||||||
if (exchange.value.customExchange) {
|
|
||||||
console.log('setting custom exchange props');
|
// Include advanced options only if the section is open
|
||||||
payload.exchange = exchange.value.selectedExchange.exchange;
|
if (isAdvancedOpen.value) {
|
||||||
payload.trading_mode = exchange.value.selectedExchange.trade_mode.trading_mode;
|
payload.erase = erase.value;
|
||||||
payload.margin_mode = exchange.value.selectedExchange.trade_mode.margin_mode;
|
payload.download_trades = downloadTrades.value;
|
||||||
|
|
||||||
|
if (exchange.value.customExchange) {
|
||||||
|
payload.exchange = exchange.value.selectedExchange.exchange;
|
||||||
|
payload.trading_mode = exchange.value.selectedExchange.trade_mode.trading_mode;
|
||||||
|
payload.margin_mode = exchange.value.selectedExchange.trade_mode.margin_mode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(payload);
|
console.log(payload);
|
||||||
await botStore.activeBot.startDataDownload(payload);
|
await botStore.activeBot.startDataDownload(payload);
|
||||||
}
|
}
|
||||||
|
@ -78,20 +87,41 @@ async function startDownload() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-2 border rounded-1 p-2 text-start">
|
<div class="mb-2 border rounded-1 p-2 text-start">
|
||||||
<BFormCheckbox v-model="exchange.customExchange" class="mb-2">
|
<BButton
|
||||||
Custom Exchange
|
v-b-toggle.advanced-options
|
||||||
</BFormCheckbox>
|
class="mb-2"
|
||||||
<ExchangeSelect v-if="exchange.customExchange" v-model="exchange.selectedExchange" />
|
@click="isAdvancedOpen = !isAdvancedOpen"
|
||||||
|
>
|
||||||
|
Advanced Options
|
||||||
|
<i-mdi-chevron-down v-if="!isAdvancedOpen" />
|
||||||
|
<i-mdi-chevron-up v-else />
|
||||||
|
</BButton>
|
||||||
|
<BCollapse id="advanced-options">
|
||||||
|
<div class="mb-2 border rounded-1 p-2 text-start">
|
||||||
|
<BFormCheckbox v-model="erase" class="mb-2">Erase existing data</BFormCheckbox>
|
||||||
|
<BFormCheckbox v-model="downloadTrades" class="mb-2">
|
||||||
|
Download Trades instead of OHLCV data
|
||||||
|
</BFormCheckbox>
|
||||||
|
</div>
|
||||||
|
<div class="mb-2 border rounded-1 p-2 text-start">
|
||||||
|
<BFormCheckbox
|
||||||
|
v-model="exchange.customExchange"
|
||||||
|
v-b-toggle.custom-exchange
|
||||||
|
class="mb-2"
|
||||||
|
>
|
||||||
|
Custom Exchange
|
||||||
|
</BFormCheckbox>
|
||||||
|
<BCollapse id="custom-exchange">
|
||||||
|
<ExchangeSelect v-model="exchange.selectedExchange" />
|
||||||
|
</BCollapse>
|
||||||
|
</div>
|
||||||
|
</BCollapse>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<BButton variant="primary" @click="startDownload">Start Download</BButton>
|
<BButton variant="primary" @click="startDownload">Start Download</BButton>
|
||||||
</div>
|
</div>
|
||||||
</BCard>
|
</BCard>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.mb-3 {
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user