Closed peterpme closed 6 years ago
Hey,
I've reset my log and db, not do any trading on the UI and let this console work and see what happens.
I'll confirm end of day!
Thanks!
on initial load / clean slate:
all overview columns CORRECT
if i close and re-open, all values INCORRECT
If i close, edit my initial cash to the correct value, and open it up, the values are even more skewed
Hmm, I've definitely seen something like this maybe twice before. I haven't been able to reproduce it enough to really figure out where the problem is though.
Negative contributions to cash on hand etc. are always buys. So this is definitely a case of the app thinking there's more buys than there really were. I'll continue to look into this when I have time, but see if you can determine what specific conditions reproduce this behavior.Many, including myself, have restarted the app plenty of times without this error; so there are definitely unique conditions that cause this to occur. We need to pin down what those conditions are. Full buckets? Pending buys? Maybe it just happens in the edge case where the app is restarted but the database is being written to...?
To get an idea of how these values are computed, what's rendered in the UI itself is determined by the code here: https://github.com/msolters/gdax-multipong/blob/master/ui.js#L129
Most of those numbers are coming from a struct trades.figures
, which is computed here:
https://github.com/msolters/gdax-multipong/blob/master/trades.js#L16
"Profit" is defined as trades.figures.net_gain+trades.figures.unrealized_buys
. This can be re-written
account.account.sells-account.account.buys-account.account.fees+trades.figures.unrealized_buys
I think we can eliminate account.account.fees
, which seems to be accurate as you point out. Since this bug presents as something which is caused be restarting the app, it stands to reason we're looking for some quantity which is being written to disk that keeps getting updated.
So, really, we're looking at the following variables. Do any of these get written back to disk in a way that is inconsistent with the actual trades being placed, causing a feedback loop?
account.account.sells
account.account.buys
trades.figures.unrealized_buys
Aha! account.account.buys
and account.account.sells
is being updated in the local DB whenever trade_fill
is called: https://github.com/msolters/gdax-multipong/blob/1b7f543c099bf25da4ad24647dca4c7b609b0626/trades.js#L104
~However, the GDAX websocket listener will call trade_fill
for incoming messages without first checking that the message corresponds to a GDAX trade originating from the bot. I am confident doing a quick existence check on trades.trades
array will fix this.~ On further digging, this can't be the issue. I'll keep looking!
Hey,
Thanks for putting together this awesome tool! It's been a real treat!
I'm not sure if something is off with my database or if I'm losing money, so I'd just like to make sure:
-14806.12
but I don't even have anywhere near there-10359.17
, but same idea. Is this the value from GDAX.com?When I pull down my FILLED orders as a CSV and add them up, I'm assuming I'm getting the total amount of money that was bought vs. sold and not the profiit right?
Sorry for these noob-ish questions but hopefully you can provide some insight!
I'd be happy to help adjust these values if they're right / wrong.
Perhaps I'm just reading them wrong?
Thanks again!