Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    perpetual futures equivalent on backtrader

    General Code/Help
    binance commission futures leverage
    1
    1
    26
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      stonks last edited by

      Hello everyone,

      First of all, thanks for this awesome platform and this community forum. I have been a silent reader up until now but could need some help with the issue below to continue my algo trading journey:

      What I want to do:
      Test various trading strategies on perpetual future contracts as offered on Binance.

      What I can do:
      I understand the basic platform concepts (as far as i know, please correct me on this one if I'm mistaken) and can code up strategies for stock like assets, code up indicators, load data etc.

      What doesn't work / what I'm unsure about:
      I would like to configure the platform in a way that most accurately replicates cryptocurrency future trading on Binance. The discussion given in https://community.backtrader.com/topic/2132/unable-to-figure-out-leverage didn't help me to figure out what exactly i need in my case.

      From my understanding I need the following settings:

      1

      cerebro.broker.set_shortcash(False)
      

      (we don't actually receive cash when we buy perpetual short contracts on Binance)

      2

      cerebro.broker.setcommission(commission=0.0015, margin = None, mult = 2)
      

      (indicates the commission for futures trades and the "leverage" on binance which is actually a multiplier if I get that right.)

      Has anyone configured the platform for this case before? I'm running into trouble with rejected orders especially when trading several assets. On Binance, if I have 100$ and set the leverage to 2X that means that I can buy future contracts with a value of 110$ without any risk of rejection. It seems like this doesn't work on backtrader (using target_order_value or target_order_percent) with my current settings. If required, I will provide a code example but I presume this is a fairly general problem that is better described without example.

      Thanks for your help,
      stonks

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
      $(document).ready(function () { app.coldLoad(); }); }