Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track the actions of the trade strategy #29

Closed
gnommer opened this issue Nov 22, 2019 · 3 comments · Fixed by #47
Closed

Track the actions of the trade strategy #29

gnommer opened this issue Nov 22, 2019 · 3 comments · Fixed by #47
Labels
question Not a bug, but a FAQ entry

Comments

@gnommer
Copy link

gnommer commented Nov 22, 2019

if we say are defining the next in the strategy class like buy and sell actions how can we track this in the _trade_data object so we can track easily when the order was placed and when the broker executed the buy sell and hold to present in the plots ?

  • Backtesting version: 0.1.2
@gnommer
Copy link
Author

gnommer commented Nov 28, 2019

@kernc any suggestions on the above issue ?

@kernc
Copy link
Owner

kernc commented Nov 29, 2019

results._trade_data, as mentioned in #4, is only available after the simulation run. For the time being, if you need to query state during the simulation, you should look into the properties of Position (Strategy.position) and track state changes manually yourself.

@kernc kernc added the question Not a bug, but a FAQ entry label Nov 29, 2019
@Benouare
Copy link

Benouare commented Jul 9, 2020

Just for help :

trades = _trade_data
final = pd.DataFrame()
final = final.append(trades[trades[["Entry Price"]].notnull().all(1)])
final = final.append(trades[trades[["Exit Price"]].notnull().all(1)])
final = final.sort_index()

It looks like this just shows the buy/close position dates.

@kernc kernc closed this as completed in #47 Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Not a bug, but a FAQ entry
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants