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

Small fix for Cexio #299

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more cexio edits and portfolioManager fix
  • Loading branch information
horsecoin committed Mar 26, 2016
commit dd70d024fdaf63868a732142707c09e78dbd99ef
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Important note

You are looking at the brand new and completetly different version of Gekko. We've tested it for quite a while though it might be possible that you encounter bugs. If you encounter a bug: check out in [the issues](https://github.com/askmike/gekko/issues/) if we are aware of it and if not create a new one :)
You are looking at the brand new and completetly different version of Gekko. We've tested it for quite a while though it might be possible that you encounter bugs. If you encounter a bug: check out in [the issues](https://github.com/askmike/gekko/issues/) if we are aware of it and if not create a new one :) This fork provided by Horsecoin. This fork is to keep track of my changes. So far a few miniscule changes were needed to get the Cexio trader working on Ubuntu 15.10 (GNU/Linux 4.2.0-27-generic x86_64) with nodejs Please use your own DD when using this code, please check changes over and submit bugs.

# Gekko [![Build Status](https://travis-ci.org/askmike/gekko.png)](https://travis-ci.org/askmike/gekko)

Expand Down Expand Up @@ -93,7 +93,7 @@ Read the [configuring Gekko documentation](https://github.com/askmike/gekko/tree

To run the bot you just have to start Gekko:

node gekko
nodejs gekko

You can also run Gekko silently or use more complex features, for examples check out the [advanced features](https://github.com/askmike/gekko/tree/master/docs/Advanced_features.md).

Expand Down
6 changes: 3 additions & 3 deletions core/portfolioManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ Manager.prototype.setTicker = function(callback) {
this.exchange.getTicker(_.bind(set, this));
}

// return the [fund] based on the data we have in memory
// return the [fund] based on the data we have in memory small edit below fix for TypeError: Cannot read property 'amount' of undefined
Manager.prototype.getFund = function(fund) {
return _.find(this.portfolio, function(f) { return f.name === fund});
}
Manager.prototype.getBalance = function(fund) {
return this.getFund(fund).amount;
return this.getFund(fund);
}

// This function makes sure order get to the exchange
Expand Down Expand Up @@ -156,7 +156,7 @@ Manager.prototype.trade = function(what) {
if(this.infinityOrderExchange)
amount = 10000;
else
amount = this.getBalance(this.asset);
amount = this.getBalance(this.currency) / this.ticker.ask;//updated by nt

// can we just create a MKT order?
if(this.directExchange)
Expand Down
18 changes: 10 additions & 8 deletions exchanges/cexio.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ Trader.prototype.getTrades = function(since, callback, descending) {
Trader.prototype.buy = function(amount, price, callback) {
// Prevent "You incorrectly entered one of fields."
// because of more than 8 decimals.
amount *= 100000000;
amount = Math.floor(amount);
amount /= 100000000;

//amount *= 100000000;
//amount = Math.floor(amount);
//amount /= 100000000;
// set below to static small amount example for testing, above was throwing errors, i.e. this will sell max 10 GHS for each trade
amount = 10

log.debug('BUY', amount, 'GHS @', price, 'BTC');

var set = function(err, data) {
Expand All @@ -64,10 +66,10 @@ Trader.prototype.buy = function(amount, price, callback) {
Trader.prototype.sell = function(amount, price, callback) {
// Prevent "You incorrectly entered one of fields."
// because of more than 8 decimals.
amount *= 100000000;
amount = Math.floor(amount);
amount /= 100000000;

//amount *= 100000000;
//amount = Math.floor(amount);
//amount /= 100000000;
amount = 10
// test placing orders which will not be filled
//price *= 10; price = price.toFixed(8);

Expand Down