Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Save history of executed trades (trade & sim mode) in a json file #1131

Open
firepol opened this issue Jan 14, 2018 · 2 comments
Open

Save history of executed trades (trade & sim mode) in a json file #1131

firepol opened this issue Jan 14, 2018 · 2 comments

Comments

@firepol
Copy link
Contributor

firepol commented Jan 14, 2018

Now, the simulations are saved in the simulations folder as html file called e.g. sim_result_exchange.XYZ-BTC_180113_195655_UTC.html

trades are also saved in the simulations folder, but the file has a name e.g. trade_result_binance.XYZ-BTC_180114_UTC.html which I think should be saved under "stats" (I think this is a minor bug, I think I'll fix that: paper trades should be saved under simulations, but real trades under stats).

When opening the HTML I see many little green arrows and red arrows showing when zenbot did buy and when it sold.

What I'd like to see is to see a history of executed trades, at best as a JSON file.
In paper mode I can receive a notification on telegram to know what the bot would have done, so it's possible to append the data also to a json.

Ideally it should show everything, also failed attempts to buy e.g. when placing a limit order that was not filled. So e.g. the object should have a property called "executed" : true, false if not executed (so you see probably another request a few seconds later where executed is true, because thew previous one didn't go through, is this how the slippage works?)

The HTML should load the json and display the history at the bottom, just after "error rates".

The advantage of this:

  • better understanding on how zenbot works
  • spot issues / bugs
  • easier sharing (when reporting a bug)
  • testing/unit testing: I've seen @T-rav started adding tests, tests are a great idea and if results are saved in a json it's possible to make tests and modify the engine with confidence. If a test breaks then we know that something went wrong when fixing this or that
  • tests can parse the json (and ignore the HTML)
@firepol
Copy link
Contributor Author

firepol commented Jan 30, 2018

@defkev I see that you just submitted a pull request to load previous trades: #1243

So I was wondering if that could help maybe in regards of this suggestion?

Are previous trades saved only in live mode or also in simulation / paper?
Because my suggestion here is to save them on file, but if they are saved in the DB, then this should be an easy task?

Thought / ideas? Thx for sharing

@defkev
Copy link
Contributor

defkev commented Jan 30, 2018

Trades are only saved/loaded in live/paper mode.

Including sim would clutter up the mongo collection as each simulation would generate more and more new trades, including possible duplicates, we definitely don't want to pop up in live mode.

Any specific reason you want to store this from a simulation?

I am personally more interested in the result of a sim run than its trade history 😄

But i actually was thinking about implementing some kind of trade log for executed/open orders (including slippage/loss protection, sell-stop and re-orders) to get an idea what the bot did between two trades but then again the moment you would look at this info its already outdated and you wouldn't be able to do anything about it anyway.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants