nicolasbonnici / cryptobot

Crypto trading bot wrote using Python 3.9.
https://nbonnici.info/
MIT License
209 stars 89 forks source link

Import and backtest throws an error #16

Open letsautom8 opened 3 years ago

letsautom8 commented 3 years ago

When I run the project with mode backtest, it throws connection error. Do I need to run the REST api server and how do i do that?

tixel1 commented 3 years ago

In this line. response = http_method(self.build_url(self.resource_name, iri), data=data, headers=headers).json()

waldhari81 commented 3 years ago

I had the same issue, so I set up a rest api server (binance swagger), but he kept asking for datasets and they're not available. Any thoughts?

nicolasbonnici commented 3 years ago

Hey there sorry for the delay, no the REST API usage is optional you can just comment this line and avoid using persistence layer with an API or just a database. The downside is you will query Binance API to gather data at each usage.

letsautom8 commented 3 years ago

i see. are there rough steps to setup the api?

nicolasbonnici commented 3 years ago

Nothing trivial here, the data model I chose is quite simple, feel free if you have any question about yours. The main concept here is to persist prices from an exchange pair then store it with a reference to a "dataset" entity that persist price related data (mostly exchange and base/quote assets pair) and allow you to group prices.

What is more complicated is to compute and store indicators you wanna use.

ChristopheDD commented 2 years ago

Hi Nicolas, thank you for sharing your code. I have tried to setup the bot, but importing the datasets returns this error :

Exception has occurred: ConnectionError HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /api/datasets (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe2a160d320>: Failed to establish a new connection: [Errno 111] Connection refused'))

i'm quite new to client-server architecture, but to me the issue is that /api/dataset URI does not point to any location in particular (whether a csv file or a database) to store the incoming data, hence the connection refused. Welcome any help, thanks