Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhook, When JSON ENABLE = false, socket is not listening #615

Open
daniel-lucio opened this issue Nov 20, 2021 · 6 comments
Open

Webhook, When JSON ENABLE = false, socket is not listening #615

daniel-lucio opened this issue Nov 20, 2021 · 6 comments
Assignees
Labels
question Further information is requested services

Comments

@daniel-lucio
Copy link

My user/config.json file has the following
"webhook": {
"enabled": true,
"ngrok-token": "Empty",
"webhook-bind-ip": "192.168.7.106",
"webhook-bind-port": 7777
}

2021-11-20 01:24:23 INFO ServiceFactory service_factory.py:54 WebHookService can't be initialized: configuration is missing, wrong or incomplete. This is normal if you did not configure it yet.

I have tried several variants of the json:
"ngrok-token": "",

non-existen "ngrok-token line
"webhook-bind-ip": 0.0.0.0
"webhook-bind-ip": 127.0.0.1


However, putting
"webhook": {
"enabled": false
"ngrok-token": "Empty",
"webhook-bind-ip": "192.168.7.106",
"webhook-bind-port": 7777
}

Returns:
2021-11-20 01:50:53,671 INFO WebHookService Webhook configured on address: 192.168.7.106 and port: 7777

Anyway, port 7777 is still closed.

My wild guess is the error is here https://github.com/Drakkar-Software/OctoBot-Tentacles/blame/master/Services/Services_bases/webhook_service/webhook.py around line 86.

Not a python coder :(

@valouvaliavlo
Copy link
Contributor

"Enabled" in JSON is to enable ngrok. The last config seem to be ok

@Herklos Herklos added question Further information is requested services labels Nov 20, 2021
@daniel-lucio
Copy link
Author

"Enabled" in JSON is to enable ngrok. The last config seems to be ok

Yes, that's what I was reading the code (maybe a better wording).

However, when Enabled is false, the port is closed.

@daniel-lucio daniel-lucio changed the title Webhook ENABLE option works the oposite Webhook, When JSON ENABLE = false, socket is not listening Nov 20, 2021
@valouvaliavlo
Copy link
Contributor

Have your enable "TradingViewSignalsTradingMode" ?

@daniel-lucio
Copy link
Author

Oh, it is open now, This has to be added to the documentation.

The idea is not to use tradeview and let one code it sown signalling code.

@valouvaliavlo
Copy link
Contributor

Oh, it is open now, This has to be added to the documentation.

The idea is not to use tradeview and let one code it sown signalling code.

It's not dependant of TradingViewTradingMode, you can code your own. It just need a subscriber

@valouvaliavlo
Copy link
Contributor

async def create_consumers(self) -> list:
mode_consumer = TradingViewSignalsModeConsumer(self)
await exchanges_channel.get_chan(trading_constants.MODE_CHANNEL, self.exchange_manager.id).new_consumer(
consumer_instance=mode_consumer,
trading_mode_name=self.get_name(),
cryptocurrency=self.cryptocurrency if self.cryptocurrency else channel_constants.CHANNEL_WILDCARD,
symbol=self.symbol if self.symbol else channel_constants.CHANNEL_WILDCARD,
time_frame=self.time_frame if self.time_frame else channel_constants.CHANNEL_WILDCARD)
self.merged_symbol = symbol_util.merge_symbol(self.symbol)
service_feed = services_api.get_service_feed(self.SERVICE_FEED_CLASS, self.bot_id)
feed_consumer = None
if service_feed is not None:
feed_consumer = await channels.get_chan(service_feed.FEED_CHANNEL.get_name()).new_consumer(
self._trading_view_signal_callback
)
else:
self.logger.error("Impossible to find the Trading view service feed, this trading mode can't work.")
return [mode_consumer, feed_consumer]
async def _trading_view_signal_callback(self, data):
parsed_data = {}
for line in data['metadata'].split("\n"):
values = line.split("=")
parsed_data[values[0].strip()] = values[1].strip()
if parsed_data[self.EXCHANGE_KEY].lower() in self.exchange_manager.exchange_name and \
parsed_data[self.SYMBOL_KEY] == self.merged_symbol:
await self.producers[0].signal_callback(parsed_data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested services
Projects
None yet
Development

No branches or pull requests

3 participants