MiniXC / simple-back

A simple daily python backtester that works out of the box.
Mozilla Public License 2.0
59 stars 12 forks source link

add section in documentation for common accessible attributes #22

Open R-K-H opened 4 years ago

R-K-H commented 4 years ago

I spent quite a bit of time last evening running through the code to find things which I think others might readily need and adding some support to the documentation for some of it would save the time for the next user.

For example:

b.portfolio.attr('value')

bt.balance.current

bt.balance.start

b.portfolio['XXX'].short.attr('num_shares')

b.portfolio['XXX'].long.attr('num_shares')

These are all very useful data points and I know you use them in your Performance analysis, I would like to see some place which just helps guide users for how to access things like this from the get go.

Thanks for the work you put into this, I was really impressed once I got the caching in and how thought out a lot if this is.

MiniXC commented 4 years ago

Thank you, this is the kind of stuff I seem to have gotten a bit blind to after developing this for a while. Do you think a "cheatsheet" type page in the documentation would be a good place to explain attr, metric.... Or would it be more effective throughout the quickstart example?

R-K-H commented 4 years ago

So this is just me, but I learn by example quite a bit. So if somewhere I'd expect to see it in a codebase I can find it.

However, a cheatsheet sounds awesome, in that you could provide details about such properties as well.. (Is it a str or float, can it be fractional (was a big question I had about num_shares, especially with crypto))...

The other thing is, like if I don't have enough cash, or if I want to adjust a position, not just entirely liquidate, some of these attr are things you'd want or need to for sizing.

MiniXC commented 4 years ago

So this is just me, but I learn by example quite a bit. So if somewhere I'd expect to see it in a codebase I can find it.

Fair point, I'll prioritize using those properties in the examples more, that is the most intutive for me as well.

The other thing is, like if I don't have enough cash, or if I want to adjust a position, not just entirely liquidate, some of these attr are things you'd want or need to for sizing.

I opened an issue for specifying target weights for assets (#25)

Is it a str or float, can it be fractional (was a big question I had about num_shares, especially with crypto)

I expect there are a few things that need adjusting for crypto - I'm happy to work on them, and would be thankful for any input. Issue is here #26

I will keep this issue open until I have added the parts of the api you mentioned to the documentation.