Gekko Forum
Listening for trade events in strategy ? - Printable Version

+- Gekko Forum (https://forum.gekko.wizb.it)
+-- Forum: Gekko (https://forum.gekko.wizb.it/forum-13.html)
+--- Forum: Technical Support (https://forum.gekko.wizb.it/forum-19.html)
+--- Thread: Listening for trade events in strategy ? (/thread-57753.html)



Listening for trade events in strategy ? - wereii - 11-02-2018

Hello,
how am I supposed to register handler for `tradeInitialized`, `tradeCompleted`... events within my strategy file?
I have tried this.on('tradeInitialized', <callback>) and this.addListener('tradeInitialized', <callback>) but nothing gets ever called, I have console.log() in the callback function but it never writes to console. 
Thx for any advice


RE: Listening for trade events in strategy ? - askmike - 11-03-2018

Hey! Within Gekko there are plugins: these are the main internal modules. Information is shared between them via events.

Note that your strategy is not a plugin (but it's wrapped inside a plugin). The plugins & event system is used internally as well as for external "plugins" (telegram bot, etc).

----

That said: the tradeCompleted event is exposed to your strategy. You can create a function called onTrade which will receive the tradeCompleted event. If you need more events let me know and we figure out a clean interface for that.


RE: Listening for trade events in strategy ? - askmike - 11-03-2018

<form debug test>


RE: Listening for trade events in strategy ? - lucifar - 11-14-2020

Particular interviews furnish firsthand message on mart size, industry trends, ontogeny trends, capitalist landscape and outlook, etc. 토토사이트


RE: Listening for trade events in strategy ? - thorsten - 11-18-2020

Wow, cool post. I’d like to write like this too – taking time and real hard work to make a great article… but I put things off too much and never seem to get started. Thanks though. 먹튀