Closed alsopgroup closed 1 year ago
I had to change the dependencies to include 1.93 for CCXT to get the more recent exchanges - such as FTX.
I get this when sending orders to Ngrok with a /webhook to POST to:
[Alert Received] POST Received: {'type': 'market', 'side': 'buy', 'amount': '0.01', 'symbol': 'BTC-PERP', 'price': 'None', 'key': 'd16fc5157c8bb83570dc90e63bf927ba0926fafb15e66503711dba6b'} Sending: BTC-PERP market buy 0.01 None [2019-11-21 16:37:19,833] ERROR in app: Exception on /webhook [POST] Traceback (most recent call last): File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise raise value File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "webhook-bot.py", line 35, in webhook send_order(data) File "/home/ubuntu/projects/tradingview-webhooks-bot/tradingview-webhooks-bot/actions.py", line 49, in send_order order = exchange.create_order(data['symbol'], data['type'], data['side'], data['amount'], calc_price(data['price'])) File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/ccxt/ftx.py", line 830, in create_order priceToPrecision = float(self.price_to_precision(symbol, price)) File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/ccxt/base/exchange.py", line 1188, in price_to_precision return self.decimal_to_precision(price, ROUND, self.markets[symbol]['precision']['price'], self.precisionMode) File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/ccxt/base/decimal_to_precision.py", line 55, in decimal_to_precision dec = decimal.Decimal(str(n)) decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>] 127.0.0.1 - - [21/Nov/2019 16:37:19] "POST /webhook HTTP/1.1" 500 -
Sorry for the very delayed response, did you eventually get this working?
I'm not sure if ccxt added FTX support yet.
Nope, I didn't. Yup, FTX is added to CCXT
I had to change the dependencies to include 1.93 for CCXT to get the more recent exchanges - such as FTX.
I get this when sending orders to Ngrok with a /webhook to POST to:
[Alert Received] POST Received: {'type': 'market', 'side': 'buy', 'amount': '0.01', 'symbol': 'BTC-PERP', 'price': 'None', 'key': 'd16fc5157c8bb83570dc90e63bf927ba0926fafb15e66503711dba6b'} Sending: BTC-PERP market buy 0.01 None [2019-11-21 16:37:19,833] ERROR in app: Exception on /webhook [POST] Traceback (most recent call last): File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise raise value File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "webhook-bot.py", line 35, in webhook send_order(data) File "/home/ubuntu/projects/tradingview-webhooks-bot/tradingview-webhooks-bot/actions.py", line 49, in send_order order = exchange.create_order(data['symbol'], data['type'], data['side'], data['amount'], calc_price(data['price'])) File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/ccxt/ftx.py", line 830, in create_order priceToPrecision = float(self.price_to_precision(symbol, price)) File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/ccxt/base/exchange.py", line 1188, in price_to_precision return self.decimal_to_precision(price, ROUND, self.markets[symbol]['precision']['price'], self.precisionMode) File "/home/ubuntu/.local/share/virtualenvs/tradingview-webhooks-bot-KPgcNiaq/lib/python3.7/site-packages/ccxt/base/decimal_to_precision.py", line 55, in decimal_to_precision dec = decimal.Decimal(str(n)) decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>] 127.0.0.1 - - [21/Nov/2019 16:37:19] "POST /webhook HTTP/1.1" 500 -