From 11f967aa0513a0578d7a26ac1cb4543e90174788 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 20 Oct 2020 07:42:47 +0200 Subject: [PATCH] Add lock fetching --- src/store/modules/ftbot.ts | 11 +++++++++++ src/types/trades.ts | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/store/modules/ftbot.ts b/src/store/modules/ftbot.ts index 7d41e2cc..019c9619 100644 --- a/src/store/modules/ftbot.ts +++ b/src/store/modules/ftbot.ts @@ -17,6 +17,7 @@ import { StrategyResult, BalanceInterface, DailyReturnValue, + LockResponse, } from '@/types'; import { @@ -63,6 +64,7 @@ export default { strategyList: [], strategy: {}, pairlist: [], + currentLocks: [], }, getters: { [BotStoreGetters.plotConfig](state) { @@ -99,6 +101,9 @@ export default { updateOpenTrades(state, trades) { state.openTrades = trades; }, + updateLocks(state, locks: LockResponse) { + state.locks = locks; + }, updatePerformance(state, performance) { state.performanceStats = performance; }, @@ -181,6 +186,12 @@ export default { .then((result) => commit('updateTrades', result.data)) .catch(console.error); }, + getLocks({ commit }) { + return api + .get('/locks') + .then((result) => commit('updateLocks', result.data)) + .catch(console.error); + }, getOpenTrades({ commit }) { return api .get('/status') diff --git a/src/types/trades.ts b/src/types/trades.ts index f923147f..88722f97 100644 --- a/src/types/trades.ts +++ b/src/types/trades.ts @@ -65,3 +65,23 @@ export interface ClosedTrade extends Trade { min_rate: number; max_rate: number; } + +export interface Lock { + pair: string; + /** Lock insertion time in the format Y-M-d HH:mm:ss */ + lock_time: string; + /** Time of lock insertion */ + lock_timestamp: number; + + /** Lock end time in the format Y-M-d HH:mm:ss */ + lock_end_time: string; + /** Time of lock end - will be rounded up to the next candle */ + lock_end_timestamp: number; + reason: string; + active: boolean; +} + +export interface LockResponse { + lock_count: number; + locks: Lock[]; +}