[WIP] Feature: Support for multiple Instruments.#641
[WIP] Feature: Support for multiple Instruments.#641AgarwalPragy wants to merge 1 commit intokernc:masterfrom AgarwalPragy:feature-multiple-instruments
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 :) |
|
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
|
How is this coming along? @tumma72 @AgarwalPragy |
|
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
|
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. |
An incomplete attempt to add multiple-instrument backtest, which is mentioned in #20 and #418
Aim: full backwards compatibility
How?
class
Backtestwill acceptdataas either apd.DataFrameor a dictionary containing instrument names (str) and corresponding instrument data (pd.DataFrame). class_Datawill follow suit.class
_Datawill get a propertyis_single_instrumentwhich 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.