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

Add support for QuadrigaCX API #342

Merged
merged 14 commits into from
Jul 3, 2017
Merged

Add support for QuadrigaCX API #342

merged 14 commits into from
Jul 3, 2017

Conversation

cmroche
Copy link
Contributor

@cmroche cmroche commented Jun 29, 2017

Adding support for the Quadruga API

  • Does not support update_products.sh, no API with info
  • Does not support backfill, no API with info
  • Quadriga API has very low rate limits, fixed bug in engine.js which was spamming calls getOrder
  • Corrected description of -markup_pct option in buy.js. This is actually a mark down percentage. I will probably separate out the options for buy/sell percentages in the future. But the option name is still the same.. I don't like it, but I think this is less confusing overall for now.
  • Added a .jsbeautifyrc file for project formatting. Up to you if you want to keep this, but I find it helpful.
  • Change to docker compose file to prevented exporting the MongoDB data onto the host file system, and instead map a folder into the DB container for easier backup and restore. Entirely up to you if you wish to keep this, but it would fix issue 241 as well as prevent accidental corruption to the DB by trying to hot copy/restore.

Quadriga API public and private queries are working, testing the getQuote and getBalance.
* Fix bug in buy function (typo) prevent callback
* Change formatting to follow the rest of zenbot
There is a general fall through to setTimer at the end of the function that must always run, the conditionals were causing additional uncessary checks which increases probability of hitting API rate limits.
@cmroche cmroche closed this Jun 29, 2017
@cmroche
Copy link
Contributor Author

cmroche commented Jun 29, 2017

Accidentally closed, sorry

@cmroche cmroche reopened this Jun 29, 2017
Copy link
Contributor Author

@cmroche cmroche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to remove the update-products.sh script from the pull request. But it isn't really related to the change and certainly you don't want it.

}

if (err) return retry('getTrades', func_args, err)
if (trades.error) return retry('getTrades', func_args, trades.error)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird indenting

var client = authedClient()
client.api('balance', function(err, wallet) {
if (err) return retry('getBalance', null, err)
if (wallet.error) return retry('getBalance', null, wallet.error)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird indenting

var client = publicClient()
client.api('ticker', params, function(err, quote) {
if (err) return retry('getQuote', func_args, err)
if (quote.error) return retry('getQuote', func_args, quote.error)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird indenting

var client = authedClient()
client.api('cancel_order', params, function(err, body) {
if (err) return retry('cancelOrder', func_args, err)
if (body.error) return retry('cancelOrder', func_args, body.error)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird indenting

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(more weird indenting problems down below)

node ./zenbot.sh backfill kraken.XETH-ZUSD --days 365
node ./zenbot.sh backfill kraken.XXBT-ZCAD --days 365
node ./zenbot.sh backfill kraken.XXBT-ZCAD --days 365
node ./zenbot.sh backfill kraken.XETH-XXBT --days 365
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you do not wish to include this file in your PR, you can just git rm update-selectors.sh and the usual git add --all git commit git push

@@ -12,10 +12,12 @@ mongodb:
image: mongo:latest
volumes_from:
- mongodb-data
volumes:
- ./data/archive:/archive
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what the point of this is, as far as I know mongo does nothing with /archive, so your ./data/archive is most likely empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, entirely. I use it to store a mongodump archive and to restore on the occasion I clear the volume (or want to restart from my snapshot). This isn't necessary, but I would recommend not exposing the db data files to the external host since Mongo uses memory mapped files and that isn't compatible in virtualized environments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove this since it isn't strictly related

@DeviaVir DeviaVir merged commit b4eceb9 into DeviaVir:master Jul 3, 2017
supersabbath pushed a commit to supersabbath/zenbot that referenced this pull request Oct 2, 2017
* Docker compose update to use internal data volume. Makes it work with Docker for Windows

* Initial exchange implemented

Quadriga API public and private queries are working, testing the getQuote and getBalance.

* JS Beautifier Config

* Adjusting minimum and increments for quadriga products

* Bug fixes and formatting

* Fix bug in buy function (typo) prevent callback
* Change formatting to follow the rest of zenbot

* Fix markdown percentage option description

* Fixed issues with buy command

* Fix error handling in API calls

* Prevent spamming calls to getOrder

There is a general fall through to setTimer at the end of the function that must always run, the conditionals were causing additional uncessary checks which increases probability of hitting API rate limits.

* Sell function tested and fixes

* Fix formatting remove update-selectors script

* Remove archives mapping from docker-compose.yml

Not related to this chance, didn't serve a particularly usefull purpose

* Update docker-compose.yml
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants