forked from askmike/gekko
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
254 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<template lang='jade'> | ||
.grd.contain | ||
h3 Add an API key | ||
p Make sure that the API key has the permissions to create and cancel orders and view balances. | ||
.grd-row | ||
.grd-row-col-3-6.mx1 | ||
h3 Exchange | ||
exchange-picker.contain(v-on:exchange='updateExchange', only-tradable='true') | ||
.grd-row-col-3-6.mx1 | ||
h3 Credentials | ||
template(v-for='cred in requires') | ||
label {{ cred }} | ||
input(v-model='credentials[cred]') | ||
.txt--center | ||
a.w100--s.my1.btn--blue(href='#', v-on:click.prevent='upload') Add | ||
</template> | ||
|
||
<script> | ||
import exchangePicker from '../global/configbuilder/exchangepicker.vue' | ||
import _ from 'lodash' | ||
import { post } from '../../tools/ajax'; | ||
export default { | ||
data: () => { | ||
return { | ||
exchange: false, | ||
credentials: {} | ||
} | ||
}, | ||
components: { | ||
exchangePicker | ||
}, | ||
computed: { | ||
exchanges: function() { | ||
return this.$store.state.exchanges; | ||
}, | ||
requires: function() { | ||
if(!this.exchanges) | ||
return []; | ||
if(!this.exchange) | ||
return []; | ||
return this.exchanges[this.exchange].requires; | ||
}, | ||
config: function() { | ||
let config = { | ||
exchange: this.exchange, | ||
values: this.credentials | ||
}; | ||
return config; | ||
} | ||
}, | ||
watch: { | ||
credentials: function() { | ||
this.emitConfig(); | ||
} | ||
}, | ||
methods: { | ||
updateExchange: function(exchange) { | ||
this.credentials = {}; | ||
this.exchange = exchange; | ||
this.emitConfig(); | ||
}, | ||
emitConfig: function() { | ||
this.$emit('config', this.config); | ||
}, | ||
upload: function() { | ||
let exchange = this.config.exchange; | ||
if( | ||
this.exchanges && | ||
this.exchanges[exchange] && | ||
!confirm(`You already have API keys for ${exchange} defined, want to overwrite them?`) | ||
) | ||
return; | ||
post('addApiKey', this.config, (error, response) => { | ||
if(error) | ||
return alert(error); | ||
this.credentials = {}; | ||
}); | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
web/vue/src/components/global/configbuilder/exchangepicker.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<template lang='jade'> | ||
div | ||
.mx1 | ||
label(for='exchange').wrapper Exchange: | ||
.custom-select.button | ||
select(v-model='exchange') | ||
option(v-for='(market, e) in exchanges') {{ e }} | ||
</template> | ||
|
||
<script> | ||
import _ from 'lodash' | ||
import rangePicker from './rangepicker.vue' | ||
import rangeCreator from './rangecreator.vue' | ||
import { get } from '../../../tools/ajax' | ||
export default { | ||
props: ['onlyTradable', 'onlyImportable'], | ||
data: () => { | ||
return { | ||
exchange: 'poloniex', | ||
}; | ||
}, | ||
created: function() { | ||
this.emitExchange(); | ||
}, | ||
computed: { | ||
exchanges: function() { | ||
let exchanges = Object.assign({}, this.$store.state.exchanges); | ||
if(_.isEmpty(exchanges)) | ||
return false; | ||
if(this.onlyTradable) { | ||
_.each(exchanges, (e, name) => { | ||
if(!e.tradable) | ||
delete exchanges[name]; | ||
}); | ||
} | ||
if(this.onlyImportable) { | ||
_.each(exchanges, (e, name) => { | ||
if(!e.importable) | ||
delete exchanges[name]; | ||
}); | ||
} | ||
return exchanges; | ||
} | ||
}, | ||
watch: { | ||
exchanges: function() { this.emitExchange() }, | ||
exchange: function() { this.emitExchange() } | ||
}, | ||
methods: { | ||
emitExchange: function() { | ||
this.$emit('exchange', this.exchange); | ||
} | ||
} | ||
} | ||
</script> | ||
</style> |
Oops, something went wrong.