-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Emit trade and trade errors via Telegram #2385
Conversation
Added missing semi-colons in processTradeCompleted and processTradeErrored methods.
Great stuff, I can merge this as is, just a quick note: Instead of registering a method and returning if the setting is false, you can also only register it if the setting is true. See this plugin for example: https://github.com/askmike/gekko/blob/develop/plugins/eventLogger.js Right now there most likely won't a noticeable difference (as v8 will probably optimize all these functions away if emit is of). But I have some optimizations planned. @crypto49er I love this PR and will merge it anyway - and apologies for you having to find all of this out like this. I think I need to sit down and write some better documentation! |
@askmike Let me play around with this for a few days to see if I can register only if setting is true. I actually did see how eventLogger.js works and thought it is pretty neat but didn't quite know how to implement it. But on second look, I think I can implement it in telegrambot.js. |
So it's a bit tricky, but basically a plugin is a constructor function with
a bunch of methods (for listening to specific events). And based on wether
these methods exist Gekko will setup event binding between the event and
the plugin. So you can dynamically build your constructor function based on
the config. Something like:
if(config.emitTrades) {
TelegramBot.prototype.processTradeAborted = function() ...
}
Pseudo code but you'll get the gist.
…On Tue, Jul 31, 2018 at 5:58 AM, Jack Crypto49er ***@***.***> wrote:
@askmike <https://github.com/askmike> Let me play around with this for a
few days to see if I can register only if setting is true. I actually did
see how eventLogger.js works and thought it is pretty neat but didn't quite
know how to implement it. But on second look, I think I can implement it in
telegrambot.js.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2385 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA7MD4R3qWEYPjR5sxV5p8Wqf7XGyKFQks5uL4FvgaJpZM4VlpGB>
.
--
PGP key at keybase.io/mikevanrossum
<https://keybase.io/mikevanrossum/key.asc>
|
Thanks for the clear explanation! I'm testing out my modifications right now. |
👍 perfect! |
* [docs] install indicator libs without updating package.json * add tulip example strat configs, see #2341 * uppercase default macd strat * temp revert bfx dep to main repo (fixes importer) * binance set default fee as percentage * rename bitx to luno (#2352) * v0.6 support for bitx (aka Luno) * v0.6 support for bitx (aka Luno) * remove log * move dependency to gb * rename bitx to luno * rename bitx to luno * make sure we pass amount as positive value * make sure we overlap when importing trades * rm 500 as retryable error, see #2354 * only try to set fee when live trading, see #2358 * make gekko pic path relative * make select arrow path relative * Fix method name for stratNotification event * make sure we parse both TS (backtest) & moment strings (live) * make sure GB throws errors * only render warmup warning when there is required history * v0.6.4 * fix plugin event wire warning * check portfolio data before calculating report (#2369) * Changed several log messages from debug to warn (#2374) Changed "Not creating order" message and "exchange did not provide fee info" from debug to warn messages so users can see these issues even when debug is set to false. * make sure we pass on exchange error (#2379) * fix backtest result exporter in standalone mode (#2382) * make sure to pass order id in cancel edge flow, fix #2386 (#2387) * Emit trade and trade errors via Telegram (#2385) * Emit trade and trade errors via Telegram * Added semi-colons Added missing semi-colons in processTradeCompleted and processTradeErrored methods. * Register methods only if set to true in config * catch undefined CPU cores on ARM (#2391) * export portfolio values as part of stratCandles (#2402) * rm space in backtest export file location * [GB/Binance] retry on 403 (#2404) * completely disable broken limit order for now, fix #2398 * rewire cancelfix cb, see #2386 * remove slack dependency that is triggering warnings (#2408) * move slack plugin dep out of main repo * remove twitter & pushbullet plugin dependencies from main repo (#2409) * move slack dependency out of main repo * rm slack dep from main repo * also remove pushbullet & twitter deps from main repo * use forked bittrex dep with updated dependencies (#2410) * use bittrex fork with updated deps * [GB] introduce optimizedConnection flag in binance * [GB] catch strange networking error * update binance market files, see #2406 * [GB] point to supported_exchanges doc * [GB] add example usage, fix #2414 * assume CF maintainance to be recoverable, fix #2407 * use npm version of of forked bittrex dep * catch gb init errors * [sqlite] wait for 10 seconds on busy * throw errors, not strings * [GB] update bfx & cf markets * Update Luno (#2417) * v0.6 support for bitx (aka Luno) * v0.6 support for bitx (aka Luno) * remove log * move dependency to gb * rename bitx to luno * rename bitx to luno * temp fix simultaneous advice error * - re-add logging - Retry insufficient balance due to server update delay - Enhanced getPorfolio - getOrder now return fees * update * update * update * revert 4b5d09f * v.0.6.5
feature
Trade events cannot be emitted from Telegram.
If user chooses to via the config file, trade events are emitted from Telegram.