frequi_origin/src/views/Graphs.vue

114 lines
2.7 KiB
Vue
Raw Normal View History

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">
2020-07-02 17:58:06 +00:00
<div class="col-mb-2">
<b-checkbox v-model="historicView">HistoricData</b-checkbox>
2020-07-02 18:05:20 +00:00
</div>
<div class="col-mb-2 ml-2 mr-2">
2020-07-02 17:58:06 +00:00
<b-button @click="refresh">&#x21bb;</b-button>
</div>
2020-06-20 06:52:43 +00:00
<div class="col-mb-2">
<b-form-select
:options="historicView ? pairlist : whitelist"
v-model="pair"
@change="refresh"
>
</b-form-select>
2020-06-20 06:52:43 +00:00
</div>
2020-06-23 18:37:14 +00:00
</div>
<div class="mt-2 row" v-if="historicView">
2020-08-01 15:04:05 +00:00
<TimeRangeSelect class="col-md-4 mr-2" v-model="timerange"></TimeRangeSelect>
<StrategyList class="col-md-2" v-model="strategy"></StrategyList>
</div>
2020-07-02 05:01:24 +00:00
2020-06-20 06:52:43 +00:00
<div class="row">
2020-06-23 18:37:14 +00:00
<CandleChart
:pair="pair"
:timeframe="timeframe"
2020-07-13 19:38:18 +00:00
:timeframems="timeframems"
2020-06-23 18:37:14 +00:00
:dataset="dataset"
2020-07-13 18:52:29 +00:00
:trades="trades"
2020-06-23 18:37:14 +00:00
>
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-07-11 17:55:47 +00:00
import TimeRangeSelect from '@/components/ftbot/TimeRangeSelect.vue';
2020-07-31 05:17:50 +00:00
import StrategyList from '@/components/ftbot/StrategyList.vue';
2020-08-03 09:08:39 +00:00
import { AvailablePairPayload, PairCandlePayload, PairHistoryPayload } from '@/store/types';
2020-06-17 18:38:25 +00:00
2020-06-22 06:05:03 +00:00
const ftbot = namespace('ftbot');
2020-07-31 05:17:50 +00:00
2020-06-22 06:05:03 +00:00
@Component({
2020-07-31 05:17:50 +00:00
components: { CandleChart, StrategyList, TimeRangeSelect },
2020-06-22 06:05:03 +00:00
})
export default class Graphs extends Vue {
pair = 'XRP/USDT';
timeframe = '5m';
2020-07-13 19:38:18 +00:00
timeframems = 300000;
2020-07-02 17:58:06 +00:00
historicView = false;
strategy = '';
2020-07-11 17:55:47 +00:00
timerange = '';
@ftbot.State pairlist;
@ftbot.State candleData;
2020-06-22 06:05:03 +00:00
2020-07-02 17:58:06 +00:00
@ftbot.State history;
2020-06-22 06:05:03 +00:00
@ftbot.State whitelist;
2020-07-13 18:52:29 +00:00
@ftbot.State trades;
2020-06-22 06:05:03 +00:00
@ftbot.Action
2020-07-02 17:58:06 +00:00
public getPairCandles!: (payload: PairCandlePayload) => void;
@ftbot.Action
public getPairHistory!: (payload: PairHistoryPayload) => void;
2020-06-22 06:05:03 +00:00
@ftbot.Action
public getWhitelist;
@ftbot.Action
public getAvailablePairs!: (payload: AvailablePairPayload) => void;
2020-06-17 18:38:25 +00:00
mounted() {
2020-06-20 06:52:43 +00:00
this.getWhitelist();
this.refresh();
this.getAvailablePairs({ timeframe: this.timeframe });
2020-06-23 18:37:14 +00:00
}
2020-06-22 06:05:03 +00:00
get dataset() {
2020-07-02 17:58:06 +00:00
if (this.historicView) {
return this.history[`${this.pair}__${this.timeframe}`];
}
return this.candleData[`${this.pair}__${this.timeframe}`];
2020-06-22 06:05:03 +00:00
}
refresh() {
2020-07-02 17:58:06 +00:00
if (this.historicView) {
this.getPairHistory({
pair: this.pair,
timeframe: this.timeframe,
2020-07-11 17:55:47 +00:00
timerange: this.timerange,
strategy: this.strategy,
2020-07-02 17:58:06 +00:00
});
} else {
this.getPairCandles({ pair: this.pair, timeframe: this.timeframe, limit: 500 });
}
2020-06-22 06:05:03 +00:00
}
}
2020-06-17 18:38:25 +00:00
</script>
<style scoped></style>