Gekko Forum
What's the variable holding the last filled buy order price? - Printable Version

+- Gekko Forum (https://forum.gekko.wizb.it)
+-- Forum: Gekko (https://forum.gekko.wizb.it/forum-13.html)
+--- Forum: General Discussion (https://forum.gekko.wizb.it/forum-14.html)
+--- Thread: What's the variable holding the last filled buy order price? (/thread-58012.html)



What's the variable holding the last filled buy order price? - orpheous - 09-20-2019

Is there a feature that holds the last filled buy order price that I can include in my strategy?


RE: What's the variable holding the last filled buy order price? - Hallonstedt - 09-23-2019

(09-20-2019, 02:30 AM)orpheous Wrote: Is there a feature that holds the last filled buy order price that I can include in my strategy?

Yes, call the onTrade function for all sorts of trade information. The onTrade function is called every time an advice is acted upon.

Example code;

Code:
strat.onTrade = function(trade) {
 if (trade.action == 'buy') {
   log.info('trade price: ', trade.effectivePrice);
 }
}