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.
-
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?
-
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.