NaN on PerformanceAnalyzer log
Hi, after some weeks of paper trading, today I started to use gekko for real trading with trader plugin on bitstamp exchange.
I noticed a problem on log produced by performanceAnalyzer plugin:
P&L and profit columns reports NaN value.

(PROFIT REPORT) original simulated balance:      1000.00000000 USD
(PROFIT REPORT) current simulated balance:       1033.44000000 USD
(PROFIT REPORT) simulated profit:                33.44000000 USD (3.34400000%)
(ROUNDTRIP) entry date (UTC)    exit date (UTC)         exposed duration        P&L     profit
(ROUNDTRIP) 2018-02-05 00:28    2018-02-05 01:04        36 minutes              NaN     NaN

It's my problem or common problem?
How can I solve?

Thanks in advance.

PS: - with paperTrader I can see correct numerical values
- I'm running the stable branch (1cde4c4) on raspberry
Hey! Would you be able to upload more debug logs? Perfect would be a snippet from the point where it started going wrong (assuming it worked fine for a while).
Hi, for real operations with Trader plugin it works correctly before and after, but always reports NaN.

Here is more debug log.
I added a debug line in performanceAnalyzer.prototype.logRoundtripPart in order to log trade object and I discovered a NaN value for price atttibute.
2018-02-06 10:52:18 (INFO):     Trader Received advice to go short. Selling  ETH
2018-02-06 10:52:19 (INFO):     Attempting to SELL 1.46884272 ETH at Bitstamp price: 647.79
2018-02-06 10:52:36 (DEBUG):    Requested ETH/USD trade data from Bitstamp ...
2018-02-06 10:52:37 (DEBUG):    No new trades.
2018-02-06 10:52:56 (DEBUG):    Requested ETH/USD trade data from Bitstamp ...
2018-02-06 10:52:58 (DEBUG):    Processing 42 new trades. From 2018-02-06 09:52:08 UTC to 2018-02-06 09:52:35 UTC. (a few seconds)
2018-02-06 10:53:16 (DEBUG):    Requested ETH/USD trade data from Bitstamp ...
2018-02-06 10:53:18 (DEBUG):    Processing 41 new trades. From 2018-02-06 09:52:36 UTC to 2018-02-06 09:53:02 UTC. (a few seconds)
2018-02-06 10:53:19 (INFO):     SELL was successfull
2018-02-06 10:53:20 (INFO):     (PROFIT REPORT) original simulated balance:      1000.00000000 USD
2018-02-06 10:53:20 (INFO):     (PROFIT REPORT) current simulated balance:       961.01000000 USD
2018-02-06 10:53:20 (INFO):     (PROFIT REPORT) simulated profit:                -38.99000000 USD (-3.89900000%)
2018-02-06 10:53:20 (DEBUG):    trade { date: moment("2018-02-06T09:52:26.000"), price: NaN, portfolio: { currency: 961.01, asset: 0, balance: 961.01 }, balance: 961.01, action: 'sell' }
2018-02-06 10:53:20 (INFO):     (ROUNDTRIP) entry date (UTC)    exit date (UTC)         exposed duration        P&L     profit
2018-02-06 10:53:20 (INFO):     (ROUNDTRIP) 2018-02-06 00:34    2018-02-06 08:52        8 hours                 NaN     NaN
Maybe a problem on PortfolioManager when doing or checking order?

Instead, the simulation with PaperTrader reports correct P&L and profit values:
2018-02-05 21:08:11 (DEBUG):    Requested BTC/USD trade data from Bitstamp ...
2018-02-05 21:08:15 (DEBUG):    Processing 87 new trades. From 2018-02-05 20:07:47 UTC to 2018-02-05 20:08:06 UTC. (a few seconds)
2018-02-05 21:08:15 (INFO):     (PROFIT REPORT) original simulated balance:      1000.00000000 USD
2018-02-05 21:08:15 (INFO):     (PROFIT REPORT) current simulated balance:       1058.05192644 USD
2018-02-05 21:08:15 (INFO):     (PROFIT REPORT) simulated profit:                58.05192644 USD (5.80519264%)
2018-02-05 21:08:15 (INFO):     (ROUNDTRIP) entry date (UTC)    exit date (UTC)         exposed duration        P&L     profit
2018-02-05 21:08:15 (INFO):     (ROUNDTRIP) 2018-02-05 18:58    2018-02-05 19:58        an hour                 27.21   2.64
Gekko calculates profit based on a trade summary: if your strategy adviced "short" Gekko will wait to hear back from a trader (either live trader or paper trader) to hear how the trade went.

The problem comes from the live trader not properly emitting this trade summary. Strange that you had this happen on bitstamp, I will run a live trader there as well and try to reproduce.
This is a bug, I've submitted an issue on github to track it there as well, see here:
It looks like bitstamp has changed their API a little bit, since this was working before. It's now fixed in the latest develop release, see this link for details:

If you want to run the new version, note that you have to run the latest develop version, it's not part of a stable release yet (let me know if you are unsure about this).
Hi, I will put the correction manually in bitstamp.js file of my current local stable version.
Thank you.

Forum Jump:

Users browsing this thread: