Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Commit

Permalink
handle gekko delete, minor UI tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
askmike committed Jul 3, 2018
1 parent 7686fea commit 518a6c6
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 5 deletions.
2 changes: 2 additions & 0 deletions strategies/DEBUG_toggle-advice.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ var method = {
log.info('iteration:', i);

if(i % settings.each === 0) {
log.debug('trigger SHORT');
this.advice('short');
} else if(i % settings.each === settings.each / 2) {
log.debug('trigger LONG');
this.advice('long');
}

Expand Down
4 changes: 2 additions & 2 deletions web/vue/src/components/gekko/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
th last update
th duration
tbody
tr.clickable(v-for='gekko in watchers', v-on:click='$router.push({path: `live-gekkos/${gekko.id}`})')
tr.clickable(v-for='gekko in watchers', v-on:click='$router.push({path: `/live-gekkos/${gekko.id}`})')
td {{ gekko.config.watch.exchange }}
td {{ gekko.config.watch.currency }}
td {{ gekko.config.watch.asset }}
Expand All @@ -41,7 +41,7 @@
th type
th trades
tbody
tr.clickable(v-for='gekko in stratrunners', v-on:click='$router.push({path: `live-gekkos/${gekko.id}`})')
tr.clickable(v-for='gekko in stratrunners', v-on:click='$router.push({path: `/live-gekkos/${gekko.id}`})')
td {{ gekko.config.watch.exchange }}
td {{ gekko.config.watch.currency }}
td {{ gekko.config.watch.asset }}
Expand Down
2 changes: 1 addition & 1 deletion web/vue/src/components/gekko/new.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default {
return _.find(
this.gekkos,
g => {
if(g.logType === 'watcher' && g.config.watch.exchange === this.exchange) {
if(g.logType === 'tradebot' && g.config.watch.exchange === this.exchange) {
return true;
}
Expand Down
27 changes: 25 additions & 2 deletions web/vue/src/components/gekko/singleGekko.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
| .
p(v-if='!isArchived')
a(v-on:click='stopGekko', class='w100--s my1 btn--red') Stop Gekko
p(v-if='isArchived')
a(v-on:click='deleteGekko', class='w100--s my1 btn--red') Delete Gekko
p(v-if='isStratrunner && watcher && !isArchived')
em This gekko gets market data from
router-link(:to='"/live-gekkos/" + watcher.id') this market watcher
Expand Down Expand Up @@ -181,6 +183,10 @@ export default {
return false;
}
if(this.isArchived) {
return false;
}
if(this.initialEvents.stratWarmupCompleted) {
return false;
}
Expand Down Expand Up @@ -318,11 +324,28 @@ export default {
return alert('This Gekko is fetching market data for multiple stratrunners, stop these first.');
}
confirm('Are you sure you want to stop this Gekko?');
if(!confirm('Are you sure you want to stop this Gekko?')) {
return;
}
post('stopGekko', { id: this.data.id }, (err, res) => {
console.log('stopped gekko');
})
});
},
deleteGekko: function() {
if(!this.isArchived) {
return alert('This Gekko is still running, stop it first!');
}
if(!confirm('Are you sure you want to delete this Gekko?')) {
return;
}
post('deleteGekko', { id: this.data.id }, (err, res) => {
this.$router.push({
path: `/live-gekkos/`
});
});
}
}
}
Expand Down
1 change: 1 addition & 0 deletions web/vue/src/components/global/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const connect = () => {
}
socket.onmessage = function(message) {
const payload = JSON.parse(message.data);
console.log('ws message:', payload);
bus.$emit(payload.type, payload);
};
}
9 changes: 9 additions & 0 deletions web/vue/src/store/modules/gekkos/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,14 @@ export const errorGekko = (state, data) => {
}
}

return state;
}

export const deleteGekko = (state, id) => {
if(!_.has(state.archivedGekkos, id)) {
return console.error('cannot delete unknown gekko..');
}

state.archivedGekkos = _.omit(state.archivedGekkos, id);
return state;
}
1 change: 1 addition & 0 deletions web/vue/src/store/modules/gekkos/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const sync = () => {
bus.$on('gekko_event', data => store.commit('updateGekko', data));
bus.$on('gekko_archived', data => store.commit('archiveGekko', data.id));
bus.$on('gekko_error', data => store.commit('errorGekko', data));
bus.$on('gekko_deleted', data => store.commit('deleteGekko', data.id));

// unused:
// bus.$on('gekko_stopped', data => store.commit('x', data.id));
Expand Down

0 comments on commit 518a6c6

Please sign in to comment.