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/

    I can't connect to Gemini Broker using BT and ccxt for live trading.

    General Code/Help
    1
    2
    24
    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.
    • K
      kzbt last edited by

      Hello,

      I would like to connect Backtrader on Gemini using CCXT but I can't figure it out.

      Here is my code:

      Python 3.6.9 (default, Oct  8 2020, 12:12:24) 
      [GCC 8.4.0] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> from __future__ import(absolute_import, division, print_function, unicode_literals)
      >>> from datetime import datetime, timedelta
      >>> import backtrader as bt
      >>> from backtrader import cerebro
      >>> import time
      >>> 
      >>> config = {'urls': {'api': 'https://api.sandbox.gemini.com'},
      ...                          'apiKey': 'master-xxxxxxxxxxxxxxxxxxxxxxxxxxx',
      ...                          'secret': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
      ...                          'nonce': lambda: str(int(time.time() * 1000))
      ...                         }
      >>> broker = bt.brokers.CCXTBroker(exchange='gemini',
      ...                                    currency='USD', config=config)
      >>> 
      >>> cerebro.setbroker(broker)
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      AttributeError: module 'backtrader.cerebro' has no attribute 'setbroker'
      
      

      but when I check my file .local/lib/python3.6/site-packages/backtrader/cerebro.py I can see

          def setbroker(self, broker):
              '''
              Sets a specific ``broker`` instance for this strategy, replacing the
      
      
              one inherited from cerebro.
              '''
              self._broker = broker
              broker.cerebro = self
              return broker
      

      When I try to connect directly without CCXT and Cerebro I have no issue.

      Does anyone have any Idea?

      K 1 Reply Last reply Reply Quote 0
      • K
        kzbt @kzbt last edited by

        Also I would like know how the class gemini get generated ? maybe if I can have working sample of how to config gemini or similar broker this would help me. I'm not having issue of getting the feed.

        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(); }); }