Gekko Forum
How to reference portfolio.assets? - Printable Version

+- Gekko Forum (https://forum.gekko.wizb.it)
+-- Forum: Gekko (https://forum.gekko.wizb.it/forum-13.html)
+--- Forum: Technical Discussion (https://forum.gekko.wizb.it/forum-23.html)
+--- Thread: How to reference portfolio.assets? (/thread-57937.html)



How to reference portfolio.assets? - gekko_user_h477150n - 06-03-2019

Hi all,

I'm working on a strategy and can't figure out how to reference the portfolio.assets. I just want to simply assign it to a variable like so:

var assets = portfolio.assets;


RE: How to reference portfolio.assets? - Rovarn - 06-03-2019

(06-03-2019, 04:41 AM)gekko_user_h477150n Wrote: Hi all,

I'm working on a strategy and can't figure out how to reference the portfolio.assets. I just want to simply assign it to a variable like so:

var assets = portfolio.assets;

I have exactly the same question, I have been searching for two days without finding how to do it.


(Are we working on a similar strategy? [Image: wink.png] ) 

/ Micke


RE: How to reference portfolio.assets? - gekko_user_h477150n - 06-09-2019

Yeah Micke, I will definitely let you know if I ever figure it out Wink


RE: How to reference portfolio.assets? - Hallonstedt - 09-06-2019

I would like to bump this question. 

It would be very useful to be able to check the portfolio asset and balance within the strategy and I have failed to figure out how to read the this.portfolio.currency, this.portfolio.asset and this.balance that are used in trader.js for example. I am sure it is not that difficult but my java-skills are not there yet. My work-around is to edit trader.js so it is writing the portfolio data to a tmp-file that my strategy keeps reading. It is not pretty!