-
Notifications
You must be signed in to change notification settings - Fork 185
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
Enhance the broker mappings and store them for multiple exchanges #7
Comments
On the other hand, maybe there is a more object oriented approach where we only overwrite methods that are different for a specific exchange. This way we would be more flexible because the mapping file could grow arbitrarily complex. |
I guess I'll need to understand CCXT better first. |
Ok, so at least we have to unify stop orders ourselves somehow. |
Good thinking... I agree that a more user friendly way of handling the mappings would be helpful. In the last commit, I tried to add more debugs to help this but it isn't really a good solution. More of stop gap until a better approach is found. Regarding number 3 - As a temporary workaround, you might be able to use the private end point function. This is useful for the special order types that are not supported in backtrader. Of course, if we can think of a nice way to include the things you need without breaking things for others, that would be ideal. On BitFinex I used a private end point to completely close a position. This is because Backtrader tries to close positions using a buy/sell market order with the correct size but if I remember correctly, the size was not perfect as commissions were taken out leaving me with a little bit left. In the end, using the private endpoint worked.
|
@Dave-Vallance BTW: My personal driver for that is that I currently have a Backtrader Strategy that uses Binance specific parameters for stop-limit orders. This prevents that I can backtest the Strategy with Backtrader as it is as it expects different parameters. |
…tore them for multiple exchanges“
@Dave-Vallance |
This is about three aspects of the broker mappings.
Currently the user of the library would need to figure out by himself what the correct broker mappings for his exchange are. But we already have this settings in the code here and there. And in my case I always have to figure out which one are the correct ones. This is why I suggest to move them out into a JSON file and commit them.
Having a separate file would make it easy to store the mappings per exchange to have a single source of truth for multiple exchanges.
For Binance I need additional properties to be mapped. E.g. the parameter for the stop price is different between Backtrader and what Binance expects. Additionally Binance differentiates its stop-limit order types further by having
TAKE_PROFIT_LIMIT
sell orders andSTOP_LOSS_LIMIT
buy orders that should be used for stop losses above the market price andTAKE_PROFIT_LIMIT
buy orders andSTOP_LOSS_LIMIT
sell orders that should be used for stop losses below the market pricesee https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md#new-order--trade
I can implement that for Binance in way compatible with other exchanges and make a pull request if you don't have a veto @Dave-Vallance .
The text was updated successfully, but these errors were encountered: