-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[WIP] Feature: Support for multiple Instruments. #641
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
[WIP] Feature: Support for multiple Instruments. #641
Conversation
A parallel effort for the same feature by Robert: #639
@kernc would you be willing to accept this PR (once complete)? If you have a better way in mind, please let me know :)
tumma72
commented
May 24, 2022
Wouldn't it be better to have a _Data structure which allow to have multiple _Data with the name of the instrument, within which the _Array will still contain the various Series data. This way the .data.INSTRUMENT.Close will provide the most accurate data for the back testing and you could cycle through the instruments... It seems less complicated to me, and it will incapsulate the complexity.
How is this coming along? @tumma72 @AgarwalPragy
1 similar comment
luketych
commented
Aug 2, 2022
How is this coming along? @tumma72 @AgarwalPragy
tumma72
commented
Aug 11, 2022
To be honest, I gave up trying to bend the beast, and decided to create my own bot, which support backtesting, paper-trading and live-trading using the CCXT Library which works quite well with a number of Exchanges, and it is well maintained.
60eff81
to
109c352
Compare
dodid
commented
Mar 17, 2023
I made an attempt to support multiple instruments based on kernc's excellent work. See https://github.com/dodid/minitrade The support is quite basic and feedback is welcome on how to make it more useful.
Uh oh!
There was an error while loading. Please reload this page.
An incomplete attempt to add multiple-instrument backtest, which is mentioned in #20 and #418
Aim: full backwards compatibility
How?
class
Backtest
will acceptdata
as either apd.DataFrame
or a dictionary containing instrument names (str
) and corresponding instrument data (pd.DataFrame
). class_Data
will follow suit.class
_Data
will get a propertyis_single_instrument
which tells us if the single-instrument-mode is enabled.Internally, all classes will assume that the data is in multi-instrument mode. However, the signatures for methods in the existing API will be extended to return dictionaries instead of single-value if the multi-instrument mode is enabled.