Browse Source

Added orderbook broadcasting to Gekko Cloud

develop
Mark Sch 1 year ago
parent
commit
732601708b
8 changed files with 220 additions and 161 deletions
  1. +6
    -2
      core/markets/cloud.js
  2. +154
    -154
      package-lock.json
  3. +1
    -1
      package.json
  4. +10
    -2
      plugins/cloudConnector/cloudConnector.js
  5. +36
    -1
      plugins/cloudConnector/connection.js
  6. +4
    -1
      plugins/tradingAdvisor/baseTradingMethod.js
  7. +4
    -0
      plugins/tradingAdvisor/tradingAdvisor.js
  8. +5
    -0
      subscriptions.js

+ 6
- 2
core/markets/cloud.js View File

@ -13,6 +13,8 @@ const slug = config.watch.exchange.toLowerCase();
const exchange = exchangeChecker.getExchangeCapabilities(slug);
const log = require('../log.js');
var Readable = require('stream').Readable;
var myPair = config.watch.asset.toLowerCase() + config.watch.currency.toLowerCase();
var myExchange = config.watch.exchange.toLowerCase();
// ****************************************************************************
@ -33,8 +35,10 @@ var Market = function(config, plugins) {
_.each(plugins, function(plugin) {
if (plugin.meta.slug === 'cloudConnector') {
plugin.on('remoteCandle', rcandle => {
log.info(`Gekko Cloud: pipe candle data from remote market: ${rcandle.exchange}/${rcandle.pair}, ${rcandle.candle.close}`);
context.push(rcandle.candle);
if (rcandle.pair == myPair && rcandle.exchange == myExchange) {
log.info(`Gekko Cloud: pipe candle data from remote market: ${rcandle.exchange}/${rcandle.pair}, ${rcandle.candle.close}`);
context.push(rcandle.candle);
}
});
}
});

+ 154
- 154
package-lock.json View File

@ -77,239 +77,232 @@
"integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==",
"dev": true
},
"@xmpp/base64": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@xmpp/base64/-/base64-0.9.0.tgz",
"integrity": "sha512-/Naw/zQB3YryuQvSS3T3TwBV+z29Ox7RxfAs31foRcGblxw9Vkh4arTqwYpd49BLGbUzw+PBhpCgyJ4IrHPeFA==",
"requires": {
"base-64": "^0.1.0"
}
},
"@xmpp/client": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/client/-/client-0.7.0.tgz",
"integrity": "sha512-O256LLh8xdFXs8tknQPMoEQilL/UnEPzi47JjbumxyQtlQHKnah5a1EM7U88M7Lpn21hnwH7W3wgGARS3SvjUQ==",
"requires": {
"@xmpp/client-core": "^0.7.0",
"@xmpp/iq": "^0.7.0",
"@xmpp/middleware": "^0.7.0",
"@xmpp/reconnect": "^0.7.0",
"@xmpp/resolve": "^0.7.0",
"@xmpp/resource-binding": "^0.7.0",
"@xmpp/sasl": "^0.7.0",
"@xmpp/sasl-anonymous": "^0.7.0",
"@xmpp/sasl-plain": "^0.7.0",
"@xmpp/sasl-scram-sha-1": "^0.7.0",
"@xmpp/session-establishment": "^0.7.0",
"@xmpp/starttls": "^0.7.0",
"@xmpp/stream-features": "^0.7.0",
"@xmpp/tcp": "^0.7.0",
"@xmpp/tls": "^0.7.0",
"@xmpp/websocket": "^0.7.0"
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/client/-/client-0.9.1.tgz",
"integrity": "sha512-qguGsMqWldEB6AlSxFHsuiZMAuMEtD76xx+o2XhxZjfAjAoptHDQ2E2hCqDPgY/Pe39WHFMKrJAGKbyJR2tP3Q==",
"requires": {
"@xmpp/client-core": "^0.9.1",
"@xmpp/iq": "^0.9.1",
"@xmpp/middleware": "^0.9.1",
"@xmpp/reconnect": "^0.9.0",
"@xmpp/resolve": "^0.9.1",
"@xmpp/resource-binding": "^0.9.1",
"@xmpp/sasl": "^0.9.1",
"@xmpp/sasl-anonymous": "^0.9.0",
"@xmpp/sasl-plain": "^0.9.0",
"@xmpp/sasl-scram-sha-1": "^0.9.0",
"@xmpp/session-establishment": "^0.9.1",
"@xmpp/starttls": "^0.9.1",
"@xmpp/stream-features": "^0.9.0",
"@xmpp/tcp": "^0.9.1",
"@xmpp/tls": "^0.9.1",
"@xmpp/websocket": "^0.9.1"
}
},
"@xmpp/client-core": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/client-core/-/client-core-0.7.0.tgz",
"integrity": "sha512-jvQ+C3fcIbBOBUmi3Jr5TYI1Q+lJ6IwsmbBRb7Fl81ZJ99Eipsi+Oax+WKS+eJwIH76xnXGCMr6MmynX4Cisvg==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/client-core/-/client-core-0.9.1.tgz",
"integrity": "sha512-c2IMm/z2ZrKHdG/+U7K3OSfNJ7y4SCp9At+mZULVqeRoaU5WuQXgGpZnaKby6jKxZVNffgB0g3K7ey8BH1yMxA==",
"requires": {
"@xmpp/connection": "^0.7.0",
"@xmpp/jid": "^0.7.0",
"@xmpp/xml": "^0.7.0"
"@xmpp/connection": "^0.9.1",
"@xmpp/jid": "^0.9.0",
"@xmpp/xml": "^0.9.1"
}
},
"@xmpp/connection": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/connection/-/connection-0.7.0.tgz",
"integrity": "sha512-kiYJ4SF1lCwKMmaqQxnScDmj5H7sP1hboj8iFAh2uYalosHD6J6MqvcifBwkITpZGp6F5u+qM88XZ9VN6ZTMOA==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/connection/-/connection-0.9.1.tgz",
"integrity": "sha512-ImkqaiIc4xZgO1D8RuJrkWxE95anFScVqV2gsF3N4xCuoZBesUedj5BUwDVrsnDkm0a7cCkpO5oJcQl9CAFvOw==",
"requires": {
"@xmpp/error": "^0.7.0",
"@xmpp/events": "^0.7.0",
"@xmpp/jid": "^0.7.0",
"@xmpp/streamparser": "^0.0.6",
"@xmpp/xml": "^0.7.0"
"@xmpp/error": "^0.9.0",
"@xmpp/events": "^0.9.0",
"@xmpp/jid": "^0.9.0",
"@xmpp/xml": "^0.9.1"
}
},
"@xmpp/connection-tcp": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/connection-tcp/-/connection-tcp-0.7.0.tgz",
"integrity": "sha512-pZNf341JkN01e9+yJB8HsWbGloGPYTFXGazfOALvlv6XmGi/ujsR3GeReHk24MSTMWsvEeXS1tURoCegLolGRg==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/connection-tcp/-/connection-tcp-0.9.1.tgz",
"integrity": "sha512-fXt2CaF7QQAIlGirlxdRILxcad+pAioY5SpP3ImvoxDddm/OEsBDErAX9dOvszZ2WLJSgBuSIQiySRM3Dczx5A==",
"requires": {
"@xmpp/connection": "^0.7.0",
"@xmpp/streamparser": "^0.0.6",
"@xmpp/xml": "^0.7.0"
"@xmpp/connection": "^0.9.1",
"@xmpp/xml": "^0.9.1"
}
},
"@xmpp/error": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/error/-/error-0.7.0.tgz",
"integrity": "sha512-zqGxt/Dxl8zfwDGzmRZjrTjtSIACq+Wit4E54SZywbxiykNkmInNpOIrKP2rsPwi7ghQsc7TfOmZxd9Bmc7Emw=="
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@xmpp/error/-/error-0.9.0.tgz",
"integrity": "sha512-W8gqCwii+SmI8h1fx0HCFgfYMtrO0hjR2DeLHchn89F1x6o2fGisllLQ38vfCZWIqy3wXfLPuf5q6WM6nHe8gQ=="
},
"@xmpp/events": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/events/-/events-0.7.0.tgz",
"integrity": "sha512-KdKxDJxivilbLEZzSRlup2nVr97MQpLuyMYZq/rMMdk8XafwvCKvNWqdfIYUvsFwWQdxbPW2hPoptYZwtdL9pg==",
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@xmpp/events/-/events-0.9.0.tgz",
"integrity": "sha512-ckOtr2u4NfsJxq7cl/6aZbQh3aXkrZHXOmm4Q+hdbUECZxpE1AxRu0QuxVS8yqmx+eVjGzOX98My4c0Dbe6CfQ==",
"requires": {
"events": "^3.0.0"
}
},
"@xmpp/id": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/id/-/id-0.7.0.tgz",
"integrity": "sha512-W2zQPPD6PN7TCaJiKgFaTCnbAMhfGnD2MOhghghoxUzsFepO/RtvfmFBsWbM0cRZZw7bumn0W06Cl2MW0FaaYw=="
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@xmpp/id/-/id-0.9.0.tgz",
"integrity": "sha512-h7ycA0kDYM8fTObqtys92L3JTECnv6TUoUKP7Canq9xQP1k3K//ZMnMMFXc8NlU3Jl2U7V1Ny9zJlYM9gYv25w=="
},
"@xmpp/iq": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/iq/-/iq-0.7.0.tgz",
"integrity": "sha512-StYMHW5P/RTB0duxEMwmEOZHJ4IXhDAwcM6HoS32NppwSkAu4WVDdIRNoLk7G6rVjDsLIftnxMYYph07g4OUIg==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/iq/-/iq-0.9.1.tgz",
"integrity": "sha512-IXCby5CxcdcQcTJ/Dc6QkRK8AjIYBlMxmD23VD7uNeMYrnmSpvzgB6Hy2CCfYBrZPFtyo0cOF+tkKNMb0SQSMw==",
"requires": {
"@xmpp/events": "^0.7.0",
"@xmpp/id": "^0.7.0",
"@xmpp/middleware": "^0.7.0",
"@xmpp/xml": "^0.7.0"
"@xmpp/events": "^0.9.0",
"@xmpp/id": "^0.9.0",
"@xmpp/middleware": "^0.9.1",
"@xmpp/xml": "^0.9.1"
}
},
"@xmpp/jid": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/jid/-/jid-0.7.0.tgz",
"integrity": "sha512-g7nQOYTzJ2aZU9i8zP5QNN4mMyTfSWSWwlcgM8R5rHYe5xqpS51v75tzdaIEEotldLG4KrjFKks9nnSHaxO2lA=="
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@xmpp/jid/-/jid-0.9.0.tgz",
"integrity": "sha512-ZBQS8vNUDwhH0Xtrx5+SUnvQlLvpCJhG59BqlbJe6/6AWWCzclismKGMs7UkzkbnBUhNn0cGmeD4iKrsW96mCA=="
},
"@xmpp/middleware": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/middleware/-/middleware-0.7.0.tgz",
"integrity": "sha512-GW/ZPQUpYYbn2Ehbtca1qKUP0qlJd494YEvttTkFkt+yzNw0GhYAGrqBDrEGcO/Lym+E86DEybovN2q6BFViLg==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/middleware/-/middleware-0.9.1.tgz",
"integrity": "sha512-Phk013PtVM/uJvfwB9+jRQ7R4pA7H/XDN1oatkllm1eb9OthhBedeLg45LV5mxrpQD6CkmJwAo3ijHe3LGYzow==",
"requires": {
"@xmpp/error": "^0.7.0",
"@xmpp/jid": "^0.7.0",
"@xmpp/xml": "^0.7.0",
"@xmpp/error": "^0.9.0",
"@xmpp/jid": "^0.9.0",
"@xmpp/xml": "^0.9.1",
"koa-compose": "^4.1.0"
}
},
"@xmpp/reconnect": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/reconnect/-/reconnect-0.7.0.tgz",
"integrity": "sha512-B/vRM5Pu+qvrUYiYevnCF6AB2OMqo/pOvMCUZ8QYUGK9YK0V2lj/RubB1pdQdkLasVOGR7k9vkCYnkRGiE9IdA==",
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@xmpp/reconnect/-/reconnect-0.9.0.tgz",
"integrity": "sha512-c7SicqcosnXpJ+s4jjGof94FzHEChKiInTf4Colh7WkVWwXtsGrRU1PMYIbX3P/58t5EqgZvfCYQrGjsWSB0kg==",
"requires": {
"@xmpp/events": "^0.7.0"
"@xmpp/events": "^0.9.0"
}
},
"@xmpp/resolve": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/resolve/-/resolve-0.7.0.tgz",
"integrity": "sha512-D5QfMiDWjWsKwK4PNYsfNp849UM4z9n+arlvNneHbj9VlDq/bq0EjUBoW7UlUhaXubWhgimwvO78FrL4+/w3kQ==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/resolve/-/resolve-0.9.1.tgz",
"integrity": "sha512-UTakKMzB0X5yVFsq+O3GzIQFgAxgIRy1t/SSN5ako5AwdIMbFkpzHMCASnfyKjDlVNdNiZoCcZQRv5ew0Xq8Mw==",
"requires": {
"@xmpp/connection": "^0.7.0",
"@xmpp/xml": "^0.7.0",
"@xmpp/connection": "^0.9.1",
"@xmpp/xml": "^0.9.1",
"node-fetch": "^2.3.0"
}
},
"@xmpp/resource-binding": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/resource-binding/-/resource-binding-0.7.0.tgz",
"integrity": "sha512-WvAJl2J9O7pkkw405HoBVgmZGjNFlayvUeyaaH7qhKmAdz0klNonzjadaMpBgH/b7kEJTjFY4sLvXh1pTJR+mg==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/resource-binding/-/resource-binding-0.9.1.tgz",
"integrity": "sha512-4jlO94wmijFslwFO5oxrbbbR7iNdSpmFcdTlXoOiLNG2zivGuS11slzXjQ6izV+mug+aaE8sD6cpgG48ras/Yg==",
"requires": {
"@xmpp/xml": "^0.7.0"
"@xmpp/xml": "^0.9.1"
}
},
"@xmpp/sasl": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/sasl/-/sasl-0.7.0.tgz",
"integrity": "sha512-q2RbKVCwHoEnMsWaoXbxQt6kaMp8k/8h16vmNB0Rdr7GZE7DfJuQrqIpCdkiFNqQzkCmUBcb6QtrmSzbpgKYpg==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/sasl/-/sasl-0.9.1.tgz",
"integrity": "sha512-lroLCF1Vnq2OK9Yy9o1CxrCC0TzonEMKKvbN8TCS7i6S3xRr5I5uUVOI74F1hYdOIM6ixlS52oFyt/TQgYOLiA==",
"requires": {
"@xmpp/error": "^0.7.0",
"@xmpp/xml": "^0.7.0",
"js-base64": "^2.5.1",
"@xmpp/base64": "^0.9.0",
"@xmpp/error": "^0.9.0",
"@xmpp/xml": "^0.9.1",
"saslmechanisms": "^0.1.1"
}
},
"@xmpp/sasl-anonymous": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/sasl-anonymous/-/sasl-anonymous-0.7.0.tgz",
"integrity": "sha512-0NhGR1vvQ6Wmso5Lrz0udJUQ1H90ZcHXEm/+/4mqSdDUaT8H2zRs7leQ7AHzTrWjY+KR42n6Prbjj1jzwpSd0w==",
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@xmpp/sasl-anonymous/-/sasl-anonymous-0.9.0.tgz",
"integrity": "sha512-F7t5LnSfmvybLBUsEOFkhvEJgY+CKdO09r5lmup5SvtYPIXMjLOb26qS+hn68woz2s1sk+tj5VUzEm/NbmfgAQ==",
"requires": {
"sasl-anonymous": "^0.1.0"
}
},
"@xmpp/sasl-plain": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/sasl-plain/-/sasl-plain-0.7.0.tgz",
"integrity": "sha512-YrYpefnpYlHRg61hd5M1Tfas4Zyx3L5zb+nhPfu34mmScF0zXc+lolJKLj7/PTUdSFujBuftWr59SSK9ycPIFg==",
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@xmpp/sasl-plain/-/sasl-plain-0.9.0.tgz",
"integrity": "sha512-7Jn34z88cy1khFYYFCnRQw0K10O+XxDKK13ImuOOS+tag+7ulvd2wT1cWJFcRIBsDvZJSqqROBfqXwHgd4PrYg==",
"requires": {
"sasl-plain": "^0.1.0"
}
},
"@xmpp/sasl-scram-sha-1": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/sasl-scram-sha-1/-/sasl-scram-sha-1-0.7.0.tgz",
"integrity": "sha512-uV8RJjxWI//RvhyqCVNZSl6gxHVsZxb/7fnLRvB1enCRDcfnXw7lghAXM9xPKm39kQZQnCDhdP0WZ4FOVQ9fvQ==",
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@xmpp/sasl-scram-sha-1/-/sasl-scram-sha-1-0.9.0.tgz",
"integrity": "sha512-AXV+Z5nwKKfkqg/XKsVi/fpJrJvhwUdZHxz84+cSskmfmD47cZw07eWkbFubs551qlAKeM/viSRE0WEaZqe4mA==",
"requires": {
"sasl-scram-sha-1": "^1.2.0"
}
},
"@xmpp/session-establishment": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/session-establishment/-/session-establishment-0.7.0.tgz",
"integrity": "sha512-5MWsySCd5nwnC8XmSfT9HdpsLzt5qBKiog6Uv7oplUz18AuKYHKmFVX4wR75cAXYzEvhQyp34XOrCaXuUEdEIw==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/session-establishment/-/session-establishment-0.9.1.tgz",
"integrity": "sha512-XIXZ0m8sy3n1XFMlWExYTCgfN0YCz7qG9+m3tSjW6ALg/YhMQ9Pe0wskXE8ragbjXFwZSnsr83Qc+gVUZpXrYg==",
"requires": {
"@xmpp/xml": "^0.7.0"
"@xmpp/xml": "^0.9.1"
}
},
"@xmpp/starttls": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/starttls/-/starttls-0.7.0.tgz",
"integrity": "sha512-XR+fQcmgTFZo9V94iG3AL+aLsRUT7glWG2LgILQsN0Mu9JtDpWc7JJuabS/JkSyMp0q8TlsEc6ZnVuz0yzT/qQ==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/starttls/-/starttls-0.9.1.tgz",
"integrity": "sha512-1alXPfWR1vrmjLvPSv5YqhVn1FMCisEE733QIpy7zLg9nBlTMlrcAfmSYUdpyfvXLx9G3wTPKKC0iyPkbqJ6rw==",
"requires": {
"@xmpp/xml": "^0.7.0"
"@xmpp/xml": "^0.9.1"
}
},
"@xmpp/stream-features": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/stream-features/-/stream-features-0.7.0.tgz",
"integrity": "sha512-0pyyfAHoTl/936soSI/8CbMObqerWsNN3tMu9wBgLrMN3F2At23yrEoshD/NOCpAHah9CQEyrnv8X6CJKPgkSA=="
},
"@xmpp/streamparser": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/@xmpp/streamparser/-/streamparser-0.0.6.tgz",
"integrity": "sha1-EYAz6p23yGoctGED8mnr/3n28eo=",
"requires": {
"@xmpp/xml": "^0.1.3",
"inherits": "^2.0.3",
"ltx": "^2.5.0"
},
"dependencies": {
"@xmpp/xml": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@xmpp/xml/-/xml-0.1.3.tgz",
"integrity": "sha1-HxQ5nlPkGWiFWGmPbGLnHjmoam4=",
"requires": {
"inherits": "^2.0.3",
"ltx": "^2.6.2"
}
}
}
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@xmpp/stream-features/-/stream-features-0.9.0.tgz",
"integrity": "sha512-kO3sUE9+E1/0SoVe5KVbA/jrMIUp8vkk7kcEIzv3TBLQLlA0nnrbaTh3Wf1fvuOtJ8L2Tj1J06haLORY6h6rHQ=="
},
"@xmpp/tcp": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/tcp/-/tcp-0.7.0.tgz",
"integrity": "sha512-ByphSJ70KNOYBV1OTsodkpZs/L7P2d9okO5+5yUj6ZONuFL4aJ9UzdIyAYNotBnZUU/JDvPqrry2GhJK+z64uA==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/tcp/-/tcp-0.9.1.tgz",
"integrity": "sha512-nLLZt+PBBwJDy/zAd60Xro3IRBco1iAiCQfq9Q+cWlPUPgYbMcUeiMATljryt3dVUwZ4HEjJYAo/ha9s9CeQ7w==",
"requires": {
"@xmpp/connection-tcp": "^0.7.0"
"@xmpp/connection-tcp": "^0.9.1"
}
},
"@xmpp/tls": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/tls/-/tls-0.7.0.tgz",
"integrity": "sha512-M1cggy7WaUPE5+xJtJuXTz6Saf3Z+fCiWoh1fo7dWxSd4eiMfO/1iW3jq3IUgYsb9zFloGRtxL70ey2W+pvu8Q==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/tls/-/tls-0.9.1.tgz",
"integrity": "sha512-fRdo3lrFj2KVI9Nj3DmGmsOSYi9+c2dJ5mDgdxzdwHgkVvcZr4yBOMIvRCK2xpXiuaniPfUiO3HW8d6sySBMyg==",
"requires": {
"@xmpp/connection-tcp": "^0.7.0"
"@xmpp/connection": "^0.9.1",
"@xmpp/connection-tcp": "^0.9.1"
}
},
"@xmpp/websocket": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/websocket/-/websocket-0.7.0.tgz",
"integrity": "sha512-Axr0mA+ip8lA32yMyERT1exGvQ7l3VgPobGnTa4FFem7Dl551NPyFdx6IHXzU0ybzsG1t7qRFh8tLjR9yI81OQ==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/websocket/-/websocket-0.9.1.tgz",
"integrity": "sha512-Z+iKHzJDHKWV54MVdBpHauENQcDZLrZQO59a/xUZhzd5ZcxTJbbGXkXDg2Yl49FtTsFyC4JbAwC6BF5KkZpSuA==",
"requires": {
"@xmpp/connection": "^0.7.0",
"@xmpp/xml": "^0.7.0",
"ws": "^6.1.2"
"@xmpp/connection": "^0.9.1",
"@xmpp/xml": "^0.9.1",
"ws": "^7.0.0"
},
"dependencies": {
"ws": {
"version": "7.2.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.2.1.tgz",
"integrity": "sha512-sucePNSafamSKoOqoNfBd8V0StlkzJKL2ZAhGQinCfNQ+oacw+Pk7lcdAElecBF2VkLNZRiIb5Oi1Q5lVUVt2A=="
}
}
},
"@xmpp/xml": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@xmpp/xml/-/xml-0.7.0.tgz",
"integrity": "sha512-NMMoR++PV2LKHViHdDy+rF+k1zWMDb4l6nICmK+0T+DeFRiHGaD1ik6sqfvSJDyOFynP1nBjnWKxQbfbQOAaBw==",
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@xmpp/xml/-/xml-0.9.1.tgz",
"integrity": "sha512-1603DMqNfSJ+0bVHph6AbxHZ49oTCmnKaZdhnhnKTKTnPy4YkJrL7sZSgVwWuy4kEDNJbxlnr4VubPU7l4wp2A==",
"requires": {
"ltx": "^2.8.1"
}
@ -1559,6 +1552,11 @@
}
}
},
"base-64": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/base-64/-/base-64-0.1.0.tgz",
"integrity": "sha1-eAqZyE59YAJgNhURxId2E78k9rs="
},
"bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
@ -3875,11 +3873,6 @@
"resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz",
"integrity": "sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k="
},
"js-base64": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.1.tgz",
"integrity": "sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw=="
},
"js-tokens": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
@ -4188,11 +4181,18 @@
}
},
"ltx": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/ltx/-/ltx-2.8.1.tgz",
"integrity": "sha512-l4H1FS9I6IVqwvIpUHsSgyxE6t2jP7qd/2MeVG1UhmVK6vlHsQpfm2KNUcbdImeE0ai04vl1qTCF4CPCJqhknQ==",
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/ltx/-/ltx-2.9.2.tgz",
"integrity": "sha512-llB7HflFhlfsYYT1SAe80elCBO5C20ryLdwPB/A/BZk38hhVeZztDlWQ9uTyvKNPX4aK6sA+JfS1f/mfzp5cxA==",
"requires": {
"inherits": "^2.0.1"
"inherits": "^2.0.4"
},
"dependencies": {
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
}
}
},
"manakin": {
@ -4609,9 +4609,9 @@
}
},
"node-fetch": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.3.0.tgz",
"integrity": "sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA=="
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
},
"node-pre-gyp": {
"version": "0.11.0",

+ 1
- 1
package.json View File

@ -14,7 +14,7 @@
"start": "node ./gekko --config config.js --ui"
},
"dependencies": {
"@xmpp/client": "^0.7.0",
"@xmpp/client": "^0.9.1",
"async": "2.1.2",
"axios": "^0.18.0",
"bfx-hf-indicators": "git+https://github.com/mark-sch/bfx-hf-indicators.git",

+ 10
- 2
plugins/cloudConnector/cloudConnector.js View File

@ -6,7 +6,7 @@ var warmupCompleted = false;
const Connector = function(done) {
_.bindAll(this);
this.mycon = new Connection();
this.mycon.registerListener(this.onRemoteCandle, this.onRemoteAdvice);
this.mycon.registerListener(this.onRemoteCandle, this.onRemoteAdvice, this.onRemoteOrderbook);
done();
};
@ -17,7 +17,6 @@ Connector.prototype.onRemoteCandle = function(remoteCandle) {
this.emit('remoteCandle', remoteCandle);
};
Connector.prototype.onRemoteAdvice = function (remoteAdvice) {
if (!warmupCompleted) {
log.info('Candle warmup is not completed yet, skipping remote advice!');
@ -28,6 +27,10 @@ Connector.prototype.onRemoteAdvice = function (remoteAdvice) {
this.emit('remoteAdvice', remoteAdvice);
};
Connector.prototype.onRemoteOrderbook = function(remoteOB) {
this.emit('remoteOrderbook', remoteOB);
};
// *********************************************************
// *** attach to core events
@ -46,6 +49,11 @@ Connector.prototype.processAdvice = function(advice) {
};
Connector.prototype.processOrderbook = function(ob) {
this.mycon.publishOrderbook(ob);
};
Connector.prototype.processStratWarmupCompleted = function(advice) {
warmupCompleted = true;
}

+ 36
- 1
plugins/cloudConnector/connection.js View File

@ -7,6 +7,7 @@ const config = util.getConfig();
var lastRemoteCandle = { start: moment(0) };
var onRemoteCandle;
var onRemoteAdvice;
var onRemoteOrderbook;
const xmpp = client({
service: 'xmpp://www.think5.de:5230',
@ -39,6 +40,16 @@ xmpp.on('offline', () => {
})
xmpp.on('online', () => {
log.info('☁ Gekko Cloud server connected.');
})
xmpp.on('disconnect', () => {
log.info('☁ Gekko Cloud server disconnected.');
})
xmpp.on('stanza', async stanza => {
// *******************************
// *** request server login
@ -153,6 +164,11 @@ xmpp.on('mucmessage', (strMsg, from, to) => {
log.debug('\n⮈ ☁ ' + strMsg);
onRemoteAdvice(msg);
}
if (onRemoteOrderbook !== undefined && msg.remote !== undefined && msg.remote === 'orderbook') {
msg.orderbook.start = moment(Number(msg.orderbook.start) * 1000);
log.debug('\n⮈ ☁ ' + strMsg.substr(0,80) + '...');
onRemoteOrderbook(msg);
}
})
xmpp.on('status', async status => {
@ -244,6 +260,7 @@ Conn.prototype.publishAdvice = async function(advice) {
`"remote": "advice", ` +
`"pair": "${config.watch.asset.toLowerCase()}${config.watch.currency.toLowerCase()}", ` +
`"exchange": "${config.watch.exchange.toLowerCase()}", ` +
`"strategy": "${config.tradingAdvisor.method}", ` +
`"time": "${moment().utc().format()}", ` +
`"advice": ${JSON.stringify(advice)}` +
`}`
@ -253,9 +270,27 @@ Conn.prototype.publishAdvice = async function(advice) {
}
Conn.prototype.registerListener = function(candle, advice) {
Conn.prototype.publishOrderbook = async function(ob) {
if (!config.cloudConnector.publishOrderbook) return;
let msg =
`{ ` +
`"remote": "orderbook", ` +
`"pair": "${config.watch.asset.toLowerCase()}${config.watch.currency.toLowerCase()}", ` +
`"exchange": "${config.watch.exchange.toLowerCase()}", ` +
`"time": "${moment().utc().format()}", ` +
`"orderbook": ${JSON.stringify(ob)}` +
`}`
log.debug('\n⮊ ☁ { "remote": "orderbook" ...}');
this.sendChannelMsg(msg, config.cloudConnector.publishChannel + '@www.think5.de');
}
Conn.prototype.registerListener = function(candle, advice, orderbook) {
onRemoteCandle = candle;
onRemoteAdvice = advice;
onRemoteOrderbook = orderbook;
}

+ 4
- 1
plugins/tradingAdvisor/baseTradingMethod.js View File

@ -69,9 +69,12 @@ var Base = function(settings) {
if(!this.onAdvice)
this.onAdvice = function() {};
if(!this.onRemoteAdvice)
if(!this.onRemoteAdvice)
this.onRemoteAdvice = function() {};
if(!this.onRemoteOrderbook)
this.onRemoteOrderbook = function() {};
if(!this.onCandle)
this.onCandle = function() {};

+ 4
- 0
plugins/tradingAdvisor/tradingAdvisor.js View File

@ -154,6 +154,10 @@ Actor.prototype.processOrderbook = function(ob) {
this.strategy.onOrderbook(ob);
}
Actor.prototype.processRemoteOrderbook = function(rob) {
this.strategy.onRemoteOrderbook(rob);
}
// pass through shutdown handler
Actor.prototype.finish = function(done) {
this.strategy.finish(done);

+ 5
- 0
subscriptions.js View File

@ -59,6 +59,11 @@ var subscriptions = [
event: 'remoteCandle',
handler: 'processRemoteCandle'
},
{
emitter: 'cloudConnector',
event: 'remoteOrderbook',
handler: 'processRemoteOrderbook'
},
{
emitter: 'tradingAdvisor',
event: 'stratCandle',

Loading…
Cancel
Save