2020-06-17 18:38:25 +00:00
|
|
|
<template>
|
2020-06-20 06:52:43 +00:00
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="row mb-2">
|
|
|
|
<div class="col-mb-2">
|
|
|
|
<b-form-select :options="whitelist" v-model="pair" @change="refresh"> </b-form-select>
|
|
|
|
</div>
|
2020-06-23 18:37:14 +00:00
|
|
|
<div class="col-mb-2">
|
|
|
|
<b-checkbox v-model="strategyPlotConfig">Use strategy plot_config</b-checkbox>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div v-if="!strategyPlotConfig" class="container-fluid">
|
|
|
|
<div class="row">
|
|
|
|
<label class="h3">Plot config builder</label>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-mb-3">
|
|
|
|
<b-form-group label-cols="auto" label="Choose column" label-for="columnSelector">
|
|
|
|
<b-form-select id="columnSelector" :options="dataset.columns" v-model="selColumn">
|
|
|
|
</b-form-select>
|
|
|
|
</b-form-group>
|
|
|
|
</div>
|
|
|
|
<div class="col-mb-3 ml-2">
|
|
|
|
<b-form-group label-cols="auto" label="Target field" label-for="columnSelector">
|
|
|
|
<b-form-select id="FieldSel" :options="plotsegments" v-model="selField">
|
|
|
|
</b-form-select>
|
|
|
|
</b-form-group>
|
|
|
|
</div>
|
|
|
|
<div class="col-mb-3 ml-2">
|
|
|
|
<b-button variant="primary" @click="addBar">Add</b-button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-06-20 06:52:43 +00:00
|
|
|
</div>
|
|
|
|
<div class="row">
|
2020-06-23 18:37:14 +00:00
|
|
|
<CandleChart
|
|
|
|
:pair="pair"
|
|
|
|
:timeframe="timeframe"
|
|
|
|
:dataset="dataset"
|
|
|
|
:plotConfig="selectedPlotConfig"
|
|
|
|
>
|
2020-06-23 05:09:58 +00:00
|
|
|
</CandleChart>
|
2020-06-20 06:52:43 +00:00
|
|
|
</div>
|
2020-06-17 18:38:25 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2020-06-22 06:05:03 +00:00
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Vue } from 'vue-property-decorator';
|
|
|
|
import { namespace } from 'vuex-class';
|
2020-06-17 18:38:25 +00:00
|
|
|
|
|
|
|
import CandleChart from '@/components/ftbot/CandleChart.vue';
|
|
|
|
|
2020-06-22 06:05:03 +00:00
|
|
|
const ftbot = namespace('ftbot');
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
components: { CandleChart },
|
|
|
|
})
|
|
|
|
export default class Graphs extends Vue {
|
|
|
|
pair = 'XRP/USDT';
|
|
|
|
|
|
|
|
timeframe = '5m';
|
|
|
|
|
2020-06-23 18:37:14 +00:00
|
|
|
strategyPlotConfig = false;
|
|
|
|
|
|
|
|
selColumn = '';
|
|
|
|
|
|
|
|
selField = '';
|
|
|
|
|
|
|
|
selColor = '#FFFF00';
|
|
|
|
|
|
|
|
customPlotConfig = {};
|
|
|
|
|
2020-06-22 06:05:03 +00:00
|
|
|
@ftbot.State history;
|
|
|
|
|
|
|
|
@ftbot.State whitelist;
|
|
|
|
|
2020-06-23 05:09:58 +00:00
|
|
|
@ftbot.State plotConfig;
|
|
|
|
|
2020-06-22 06:05:03 +00:00
|
|
|
@ftbot.Action
|
|
|
|
public getPairHistory;
|
|
|
|
|
|
|
|
@ftbot.Action
|
|
|
|
public getWhitelist;
|
|
|
|
|
2020-06-23 05:09:58 +00:00
|
|
|
@ftbot.Action
|
|
|
|
public getPlotConfig;
|
|
|
|
|
2020-06-17 18:38:25 +00:00
|
|
|
mounted() {
|
2020-06-20 06:52:43 +00:00
|
|
|
this.getWhitelist();
|
|
|
|
this.refresh();
|
2020-06-22 06:05:03 +00:00
|
|
|
}
|
|
|
|
|
2020-06-23 18:37:14 +00:00
|
|
|
get selectedPlotConfig() {
|
|
|
|
return this.strategyPlotConfig ? this.plotConfig : this.customPlotConfig;
|
|
|
|
}
|
|
|
|
|
2020-06-22 06:05:03 +00:00
|
|
|
get dataset() {
|
|
|
|
return this.history[`${this.pair}__${this.timeframe}`];
|
|
|
|
}
|
|
|
|
|
2020-06-23 18:37:14 +00:00
|
|
|
get plotsegments() {
|
|
|
|
return Object.keys(this.plotConfig);
|
|
|
|
}
|
|
|
|
|
2020-06-22 06:05:03 +00:00
|
|
|
refresh() {
|
|
|
|
this.getPairHistory({ pair: this.pair, timeframe: this.timeframe, limit: 500 });
|
2020-06-23 05:09:58 +00:00
|
|
|
|
|
|
|
this.getPlotConfig();
|
2020-06-22 06:05:03 +00:00
|
|
|
}
|
2020-06-23 18:37:14 +00:00
|
|
|
|
|
|
|
addBar() {
|
|
|
|
console.log('Add clicked');
|
|
|
|
console.log(this.selColumn);
|
|
|
|
console.log(this.selField);
|
|
|
|
console.log(this.plotConfig);
|
|
|
|
|
|
|
|
this.plotConfig[this.selField][this.selColumn] = { color: this.selColor };
|
|
|
|
console.log(this.plotConfig);
|
|
|
|
}
|
2020-06-22 06:05:03 +00:00
|
|
|
}
|
2020-06-17 18:38:25 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped></style>
|