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

py-trading-bot discord for discussion #43

Open
786449611 opened this issue Jul 29, 2024 · 13 comments
Open

py-trading-bot discord for discussion #43

786449611 opened this issue Jul 29, 2024 · 13 comments

Comments

@786449611
Copy link

786449611 commented Jul 29, 2024

hi, I am a vectorbtpro user but could hardly find a good one for live-trading. Your work saved me, thanks for sharing! But unluckily i have not got it work yet. I want a place to discuss with guys who use py-trading-bot, and I think many others also want too,

Is it OK for you to create a discord server to communicate? or use the one I created below?

[py-trading-bot]
https://discord.gg/emfCWD7hrr

Thank you!

@Fun1628
Copy link

Fun1628 commented Jul 30, 2024

He is doing a fantastic job. Read all the md under Doc to understand the process.

@786449611
Copy link
Author

hi, thanks,
i am now stuck in installing IB gateway in wsl2.
searched some materials but not worked as expected, how did you make it?

@Fun1628
Copy link

Fun1628 commented Jul 30, 2024

Read some of the closed issues

@psemdel
Copy link
Owner

psemdel commented Jul 31, 2024

Hi, sorry that I am really not so reactive... I have no problem that you make a discord, but presently I can really not promess to be online and I fear it will be a while until I am available again.
There surely are many things to be improved. I am not a professional coder.
Installing IB gateway, so it is not related to this bot I would say right? Or is the problem the communication between the bot and the running gateway?

@786449611
Copy link
Author

786449611 commented Aug 3, 2024

hi, I have successfully installed IB gateway in Ubuntu. refering this link.
https://medium.com/@FMZQuant/instructions-for-installing-interactive-brokers-ib-gateway-in-linux-bash-feca03350844

but Got error after ./start_bot.sh in WSL2 ubuntu terminial (Win11)
it says ModuleNotFoundError: No module named 'telegram'

and then browser opened http://localhost:8000/start_bot
showing "Unable to connect".

In my settings, i have used simple database as the guides says. PostgresQL is not installed/set.
image
here is my setting file:settings.txt

and, my IBgateway port is 4002 shown in IB, not 4001.
Could you check where is the problem is? Thank you very much!

log details:
[2024-08-03 06:00:12] INFO 668 Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/home/wiki/.local/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/wiki/.local/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
autoreload.raise_last_exception()
File "/home/wiki/.local/lib/python3.10/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
raise _exception[1]
File "/home/wiki/.local/lib/python3.10/site-packages/django/core/management/init.py", line 394, in execute
autoreload.check_errors(django.setup)()
File "/home/wiki/.local/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/wiki/.local/lib/python3.10/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/wiki/.local/lib/python3.10/site-packages/django/apps/registry.py", line 124, in populate
app_config.ready()
File "/home/wiki/py-trading-bot/py-trading-bot/orders/apps.py", line 11, in ready
from reporting.views import create_ss_sub
File "/home/wiki/py-trading-bot/py-trading-bot/reporting/views.py", line 3, in
from reporting.telegram import start, cleaning_sub
File "/home/wiki/py-trading-bot/py-trading-bot/reporting/telegram.py", line 29, in
from telegram.ext import CommandHandler
ModuleNotFoundError: No module named 'telegram'

@psemdel
Copy link
Owner

psemdel commented Aug 3, 2024

telegram not found is because you did not install python-telegram-bot, which is normally included in vbtpro.

my IBgateway port is 4002 shown in IB, not 4001.-> set the right one in the bot in settings. Maybe it was a mistake from my side, who knows?

@786449611
Copy link
Author

786449611 commented Aug 3, 2024

Hi, thank you, i installed python-telegram-bot mannualy and start again . New errors... do i need to restart?

1.6379: bind: Address already in use
2. sudo apt install tightvncserver# Generated by Django 5.0.6 on 2024-07-06 03:41
SyntaxError: invalid syntax

[updated]
After uncomment this line, this error disappeared. and finanally, the browser has something shown.
but, No.1 error still exsits.
image


wiki@LegionPC:~/py-trading-bot/py-trading-bot$ ./start_bot.sh
8542:C 03 Aug 2024 17:50:09.270 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
8542:C 03 Aug 2024 17:50:09.270 # Redis version=6.0.16, bits=64, commit=00000000, modified=0, pid=8542, just started
8542:C 03 Aug 2024 17:50:09.270 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
8542:M 03 Aug 2024 17:50:09.271 * Increased maximum number of open files to 10032 (it was originally set to 1024).
8542:M 03 Aug 2024 17:50:09.271 # Could not create server TCP listening socket *:6379: bind: Address already in use
[2024-08-03 09:50:09] INFO 148 Note: NumExpr detected 20 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
[2024-08-03 09:50:09] INFO 160 NumExpr defaulting to 8 threads.
/home/wiki/.local/lib/python3.10/site-packages/django/db/backends/utils.py:98: RuntimeWarning: Accessing the database during app initialization is discouraged. To fix this warning, avoid executing queries in AppConfig.ready() or when your app modules are imported.
warnings.warn(self.APPS_NOT_READY_WARNING_MSG, category=RuntimeWarning)
[2024-08-03 09:50:11] INFO 148 Note: NumExpr detected 20 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8.
[2024-08-03 09:50:11] INFO 160 NumExpr defaulting to 8 threads.
/home/wiki/.local/lib/python3.10/site-packages/django/db/backends/utils.py:98: RuntimeWarning: Accessing the database during app initialization is discouraged. To fix this warning, avoid executing queries in AppConfig.ready() or when your app modules are imported.
warnings.warn(self.APPS_NOT_READY_WARNING_MSG, category=RuntimeWarning)
Watching for file changes with StatReloader
[2024-08-03 09:50:13] INFO 668 Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Error: That port is already in use.

[03/Aug/2024 09:50:31] "GET /start_bot HTTP/1.1" 301 0

@psemdel
Copy link
Owner

psemdel commented Aug 3, 2024

Error: That port is already in use.

Means that you have already the bot / django running.

@psemdel
Copy link
Owner

psemdel commented Aug 3, 2024

Hi, thank you, i installed python-telegram-bot mannualy and start again . New errors... do i need to restart?

1.6379: bind: Address already in use
2. sudo apt install tightvncserver# Generated by Django 5.0.6 on 2024-07-06 03:41
SyntaxError: invalid syntax

This part, I did not understand. What did you comment out?

@786449611
Copy link
Author

786449611 commented Aug 3, 2024

image
this!
because if not, it will generate SyntaxError: invalid syntax at [apt]

Error: That port is already in use.
Means that you have already the bot / django running.

So, no problem here? maybe because i have started bot several times.

by the way,
after this bot starts(broswer opened), I am not sure what to do next. It seems need to connect IB first, it seems no specific guides for this?

@ben1628
Copy link

ben1628 commented Aug 4, 2024

You are jumping too quickly, you need to make sure your telegram is working first

That means you have to talk to bot father and setup your telegram bot.
Google on how to!

  1. Go to test telegram to make sure you get a response from your own telegram bot

  2. Use test ib to make sure you are communicating with IB

  3. Read the installation guide, the documents under doc folder

It's a powerful bot which requires some effort to set it up properly

@ben1628
Copy link

ben1628 commented Aug 4, 2024

If everything is working you will see something similar to bot interface1.png after do http to startbot

@psemdel
Copy link
Owner

psemdel commented Aug 4, 2024

The file of the migration is generated by django when you made the first migration. It is not coming from my repo.

About IB, you should start it before the bot (but it will work also if you do it afterwards, there is a fallback on YF).

You can create a report to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants