Skip to content

Commit

Permalink
add cap for market graph
Browse files Browse the repository at this point in the history
  • Loading branch information
Etienne Gobeli committed Nov 13, 2017
1 parent ce04159 commit 634916b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 33 deletions.
24 changes: 8 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
# pump-and-dump
# pump-and-dump [![Build status](https://ci.appveyor.com/api/projects/status/7o7kpe26ejv5d09j?svg=true)](https://ci.appveyor.com/project/gobeli/pump-and-dump) #

> An electron-vue project
A pump and dump application for cryptocurrencies using the bittrex API

#### Build Setup
Setup generated with [electron-vue](https://github.com/SimulatedGREG/electron-vue)

``` bash
# install dependencies
npm install
## [Releases](https://github.com/gobeli/pump-and-dump/releases) ##

# serve with hot reload at localhost:9080
npm run dev
## Screenshots ##
![alt text](https://raw.githubusercontent.com/gobeli/pump-and-dump/master/static/screen1.png)

# build electron application for production
npm run build
![alt text](https://raw.githubusercontent.com/gobeli/pump-and-dump/master/static/screen2.png)


```

---

This project was generated with [electron-vue](https://github.com/SimulatedGREG/electron-vue)@[f5d9648](https://github.com/SimulatedGREG/electron-vue/tree/f5d9648e169a3efef53159823cc7a4c7eb7221d1) using [vue-cli](https://github.com/vuejs/vue-cli). Documentation about the original structure can be found [here](https://simulatedgreg.gitbooks.io/electron-vue/content/index.html).
_Use at your own risk_
37 changes: 20 additions & 17 deletions src/renderer/components/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</div>
<div class="container" style="margin-top: 1rem;" v-else>
<execute-modal :market="selectedMarket" :strategy="strategy" :open="executeModalShown" @close-modal="executeModalShown = false"></execute-modal>

<el-dialog
title="Use Strategy"
:visible.sync="strategyModalShown"
Expand All @@ -15,9 +15,9 @@
<div slot="header" class="clearfix">
<h3>Market</h3>
</div>
<el-autocomplete class="inline-input"
<el-autocomplete class="inline-input"
:disabled="$store.state.running"
@select="update($event.value)"
@select="update($event.value)"
v-model="market"
:fetch-suggestions="findMarket" placeholder="Market" :trigger-on-focus="false"></el-autocomplete>
</el-card>
Expand All @@ -27,9 +27,9 @@
<el-col :span="12">
<el-card>
<div slot="header" class="clearfix">
<h3>Strategy</h3>
</div>
<strategy-form :strategy-model="strategy" @strategy-changed="submitStrategy"></strategy-form>
<h3>Strategy</h3>
</div>
<strategy-form :strategy-model="strategy" @strategy-changed="submitStrategy"></strategy-form>
<el-button style="float: right; margin-bottom: 20px" type="primary" v-if="!$store.state.running" @click="useStrategy">Use</el-button>
<el-button-group style="float: right; margin-bottom: 20px" v-if="$store.state.running">
<el-button type="danger" @click="cancel(false)">Cancel</el-button>
Expand All @@ -40,7 +40,7 @@
<el-col :span="12">
<el-card>
<div slot="header" class="clearfix">
<h3>BTC-{{market}}</h3>
<h3>BTC-{{market}}</h3>
</div>
<vue-chart
:rows="marketData.map(x => [null, x.ask, x.buy, x.sell])"
Expand All @@ -54,17 +54,17 @@
<el-col :span="12">
<el-card>
<div slot="header" class="clearfix">
<h3>Open Orders</h3>
<h3>Open Orders</h3>
</div>
<orders :orders="openOrders"></orders>
<orders :orders="openOrders"></orders>
</el-card>
</el-col>
<el-col :span="12">
<el-card>
<div slot="header" class="clearfix">
<h3>Order History</h3>
<h3>Order History</h3>
</div>
<orders :orders="orderHistory"></orders>
<orders :orders="orderHistory"></orders>
</el-card>
</el-col>
</el-row>
Expand Down Expand Up @@ -133,14 +133,14 @@
const strategy = JSON.parse(localStorage.getItem(`${storePrefix}STRATEGY`));
if (strategy && strategy !== 'null') {
this.strategy = strategy;
}
}
if (this.apiSecret && this.apiKey) {
this.$bittrex.options({
'apikey' : this.apiKey,
'apisecret' : this.apiSecret,
'apisecret' : this.apiSecret,
});
this.$bittrex.getmarkets((data, err) => this.markets = handleResponse(data, err, this));
this.update(localStorage.getItem(`${storePrefix}CURRENCY`));
this.update(localStorage.getItem(`${storePrefix}CURRENCY`));
}
},
Expand All @@ -150,11 +150,14 @@
const date = new Date();
const hours = date.getHours(), minutes = date.getMinutes(), seconds = date.getSeconds();
this.marketData.push({ ask: tick.Ask, buy: this.$store.state.running ? this.$store.state.settings.buy : null, sell: this.$store.state.running ? this.$store.state.settings.sell : null });
if (this.marketData.length > 100) {
this.marketData.splice(0, 1);
}
});
},
update(market) {
if (!!market === true) {
this.marketData = [];
localStorage.setItem(`${storePrefix}CURRENCY`, market);
Expand All @@ -169,10 +172,10 @@
return
}
this.$bittrex.getopenorders({ market: `BTC-${this.market}` },
this.$bittrex.getopenorders({ market: `BTC-${this.market}` },
(data, err) => this.openOrders = handleResponse(data, err, this));
this.$bittrex.getorderhistory({market: `BTC-${this.market}`},
this.$bittrex.getorderhistory({market: `BTC-${this.market}`},
(data, err) => this.orderHistory = handleResponse(data, err, this).slice(0, 5));
},
Expand Down

0 comments on commit 634916b

Please sign in to comment.