Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. BorutF
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    B
    • Profile
    • Following 0
    • Followers 0
    • Topics 12
    • Posts 23
    • Best 2
    • Groups 0

    BorutF

    @BorutF

    2
    Reputation
    1
    Profile views
    23
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    BorutF Unfollow Follow

    Best posts made by BorutF

    • RE: How to get the index of the current iteration in next?

      @run-out said in How to get the index of the current iteration in next?:

      @borutf You can get the current bar but using len(self)

      Thanks.

      posted in General Code/Help
      B
      BorutF
    • RE: 5min data from yahoo

      @anders_lind

      2022-05-17 23:59:59.999989

      This happens to every datetime??

      I always use bt.feeds.PandasData , it can work on yfinance downloads as well.

      posted in General Code/Help
      B
      BorutF

    Latest posts made by BorutF

    • RE: Pyfolio export output
      strat = results[0]
      pyfoliozer = strat.analyzers.getbyname('pyfolio')
      returns, positions, transactions, gross_lev = pyfoliozer.get_pf_items()
      

      This is what the backtrader analyzer can return and then you can the returns, positions, transactions, gross_lev as arguments for the pyfolio library.

      posted in General Code/Help
      B
      BorutF
    • Reduce the number of requests in ccxt live feed?

      I am using the ccxbt library to retrieve live-data from binance. The problem is that my strategy only uses 15 minute intervals, so there is no need to make requests for the OHCLV every second, which it appears to be doing. I want to later scale the project to run several strategies concurrently and I am worried this calls will exceed Binance's limit of 1200 per minute.

      Is there any way to limit this calls, the strategy run only on full intervals anyway.

      posted in General Code/Help
      B
      BorutF
    • Is there an analyzer that saves all the orders?

      So, I know about pyfolio, where you can get all the transactions with the get_pf_items, however I would like to see all the orders and that were made.

      I am particularly interested in the Stop and Limit orders placed through buy_bracket/sell_bracket, I want to see the stop/limit prices they set.

      I guess I could use notify_order to append the data to a pandas dataframe and save to csv in the end, but I would prefer a made solution before go deep into that.

      posted in General Code/Help
      B
      BorutF
    • RE: Backtrader python client library Bracket orders limit is not working

      @sunny-p for buy a limit order limits the price upwards.

      you can do an Order.Stop that will be triggered at the price, however it will behave like a market order after that.

      posted in General Code/Help
      B
      BorutF
    • Anybody using backtrader to live-trade on Binance? Problem with bracket orders.

      This Library is suggested one the website.

      The data-connection works fine and normal market orders as well.

      But for stop-orders I get this strange error that all required parameters are not set, stopPrice in the case STOP/TAKE_PROFIT, even though they are.

      I went through the traceback and I found that the broker has this in the code:

                  try:
                      # all params are exchange specific: https://github.com/ccxt/ccxt/wiki/Manual#custom-order-params
                      params['created'] = created  # Add timestamp of order creation for backtesting
                      ret_ord = self.store.create_order(symbol=data.p.dataname, order_type=order_type, side=side,
                                                        amount=amount, price=price, params=params)
                  except:
                      # save some API calls after failure
                      self.use_order_params = False
                      return None
      

      If an error occurs it returns None and then sets the class variable use_order_params to False, which means additional parameters are not used anymore which leads to the error. It makes it impossible to debug what went wrong in the first call.

      Anybody dealt with the STOP/TAKE_PROFIT ? It seems like a limitation of bt-ccxt.

      posted in General Discussion
      B
      BorutF
    • RE: Backtrader python client library Bracket orders limit is not working

      @sunny-p You said it buys at 77.62 instead of 77.91, that is correct as when you have a buy limit order you specify the worst(maximum) possible price you would want to buy at.

      posted in General Code/Help
      B
      BorutF
    • RE: Guideline/ quickstart on coding a new broker

      What API do you want to connect to?

      I want to do SFOX and I will try to model it on the way CCXT connects to different exchanges.

      posted in General Code/Help
      B
      BorutF
    • RE: Guideline/ quickstart on coding a new broker

      @rb88 I don't know any. But I am very interested in doing something similar myself.

      Let me know if you would be interested in collaborating. I have a decent knowledge of backtrader and I think I am very experienced with dealing with different types of APIs.

      posted in General Code/Help
      B
      BorutF
    • RE: Can we write Celebro engine data in the excel ?

      @varsha-shingade with the help of analyzers:

      cerebro.addanalyzer(bt.analyzers.PyFolio, _name='pyfolio')
      strat = cerebro.run(tradehistory=True)
      
      pyfoliozer = strat[0].analyzers.getbyname('pyfolio')
      returns, positions, transactions, gross_lev = pyfoliozer.get_pf_items()
      transactions.to_csv("transactions.csv")
      

      There are other options with analyzers, because there is so much data you can save.

      posted in General Discussion
      B
      BorutF
    • RE: sell_bracket() order: sell() got an unexpected keyword argument 'size'

      Seems unusual to me.

      May I ask why do you even call super().sell_bracket ?

      Why not just self.sell_bracket ? Did you change sell_bracket somehow?

      posted in General Code/Help
      B
      BorutF