guanquann / Stocksera

Finance application that provides more than 60 different alternative data to retail investors
MIT License
661 stars 107 forks source link

Tickers and Repo page errors in django #11

Closed CodeInFilth closed 3 years ago

CodeInFilth commented 3 years ago

Receiving many OperationalError at /ticker/ I have tried restarting creation and still cant clear up the errors on multiple pages

/tickers/

Environment:

Request Method: GET
Request URL: http://localhost:3131/ticker/

Django Version: 3.1.6
Python Version: 3.7.5
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'templatetags.filter',
 'ViewStocks']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'whitenoise.middleware.WhiteNoiseMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/root/_startUp/Stocksera/ViewStocks/views.py", line 43, in stock_price
    information = check_market_hours(ticker_selected)
  File "/root/_startUp/Stocksera/helpers.py", line 84, in check_market_hours
    "DO UPDATE SET count=count+1", (ticker_selected, information["longName"]))

Exception Type: OperationalError at /ticker/
Exception Value: near "ON": syntax error

/reverse_repo/

Environment:

Request Method: GET
Request URL: http://localhost:3131/reverse_repo/

Django Version: 3.1.6
Python Version: 3.7.5
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'templatetags.filter',
 'ViewStocks']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'whitenoise.middleware.WhiteNoiseMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/root/_startUp/Stocksera/ViewStocks/views.py", line 777, in reverse_repo
    with open(r"database/economic_date.json", "r+") as r:

Exception Type: FileNotFoundError at /reverse_repo/
Exception Value: [Errno 2] No such file or directory: 'database/economic_date.json'
guanquann commented 3 years ago

For /ticker/, in helpers.py uncomment out line72-82. Comment out line 83-74. I'm not sure why, but line 83-84 doesn't work for some people.

For /reverse_repo/, run python scheduled_tasks/economy/get_upcoming_events_date.py

CodeInFilth commented 3 years ago

For /ticker/, in helpers.py uncomment out line72-82. Comment out line 83-74. I'm not sure why, but line 83-84 doesn't work for some people.

For /reverse_repo/, run python scheduled_tasks/economy/get_upcoming_events_date.py I notice that ucommenting 72-> 82 and then commenting 83-74 is redundant and not to mention missing line 84 which finishes the query on 83.

Does the random error have something to do with line 85 being commented out?

83        db.execute("INSERT INTO stocksera_trending (symbol, name, count) VALUES (?, ?, 1) ON CONFLICT (symbol) "
84                   "DO UPDATE SET count=count+1", (ticker_selected, information["longName"]))
85        # db.execute("UPDATE stocksera_trending SET next_update=?", (next_update_time, ))
86        conn.commit()
87
88    return information
CodeInFilth commented 3 years ago

46

For /ticker/, in helpers.py uncomment out line72-82. Comment out line 83-74. I'm not sure why, but line 83-84 doesn't work for some people.

For /reverse_repo/, run python scheduled_tasks/economy/get_upcoming_events_date.py

after apply your comment

CLOV not bought, since it is already Top-10 in the previous day!
AMC not bought, since it is already Top-10 in the previous day!
Ticker TTCF to be bought on 2021-09-03 for $24.1.
Traceback (most recent call last):
  File "tasks_to_run.py", line 90, in <module>
    buy_trending_tickers.buy_new_ticker(db_date)
  File "/root/_startUp/Stocksera/scheduled_tasks/reddit/buy_trending_tickers.py", line 54, in buy_new_ticker
    "N/A", "N/A", "N/A", "N/A", "Open"))
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 10, and there are 9 supplied.
guanquann commented 3 years ago

Look at your reddit_etf database. I used to have logo_url column. I have already removed it in the latest commit. What you need to do is to simply remove that column in your database.

CodeInFilth commented 3 years ago

now I am recieving a Key error?

Screen Shot 2021-09-04 at 1 53 42 AM

No clue what this could be...

I am on Ubuntu 18.04, after this you should be cross compatible I usually run on Mac OS -> Ubuntu

guanquann commented 3 years ago

You didn't use my latest commit. Replace your current scheduled_tasks/buy_trending_tickers.py with my newest version

CodeInFilth commented 3 years ago

You didn't use my latest commit. Replace your current scheduled_tasks/buy_trending_tickers.py with my newest version

Made all changes still after an error is getting thrown

Traceback (most recent call last):
  File "tasks_to_run.py", line 74, in <module>
    scrape_reddit_stocks.main()
  File "/root/_startUp/Stocksera/scheduled_tasks/reddit/get_reddit_trending_stocks/scrape_reddit.py", line 26, in main
    print_df(results_df, file_name, save_to_sql, save_to_csv, subreddit)
  File "/root/_startUp/Stocksera/scheduled_tasks/reddit/get_reddit_trending_stocks/AutoDD.py", line 396, in print_df
    tuple(df.loc[row_num].tolist()))
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 27, and there are 28 supplied.

*note that only after I edited line 395 did this get thrown prior it was The current statement uses 27, and there are 28 supplied. so I am switching back currecntly but thanks for the help

guanquann commented 3 years ago

Receiving many OperationalError at /ticker/ I have tried restarting creation and still cant clear up the errors on multiple pages

/tickers/

Environment:

Request Method: GET
Request URL: http://localhost:3131/ticker/

Django Version: 3.1.6
Python Version: 3.7.5
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'templatetags.filter',
 'ViewStocks']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'whitenoise.middleware.WhiteNoiseMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/root/_startUp/Stocksera/ViewStocks/views.py", line 43, in stock_price
    information = check_market_hours(ticker_selected)
  File "/root/_startUp/Stocksera/helpers.py", line 84, in check_market_hours
    "DO UPDATE SET count=count+1", (ticker_selected, information["longName"]))

Exception Type: OperationalError at /ticker/
Exception Value: near "ON": syntax error

/reverse_repo/

Environment:

Request Method: GET
Request URL: http://localhost:3131/reverse_repo/

Django Version: 3.1.6
Python Version: 3.7.5
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'templatetags.filter',
 'ViewStocks']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'whitenoise.middleware.WhiteNoiseMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/root/_startUp/Stocksera/ViewStocks/views.py", line 777, in reverse_repo
    with open(r"database/economic_date.json", "r+") as r:

Exception Type: FileNotFoundError at /reverse_repo/
Exception Value: [Errno 2] No such file or directory: 'database/economic_date.json'

Hi please refer to https://stackoverflow.com/questions/51531207/on-conflict-not-even-compile-with-error-syntax for your very first issue. It turns out that your SQLite version might be too old!

CodeInFilth commented 3 years ago

Receiving many OperationalError at /ticker/ I have tried restarting creation and still cant clear up the errors on multiple pages /tickers/

Environment:

Request Method: GET
Request URL: http://localhost:3131/ticker/

Django Version: 3.1.6
Python Version: 3.7.5
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'templatetags.filter',
 'ViewStocks']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'whitenoise.middleware.WhiteNoiseMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/root/_startUp/Stocksera/ViewStocks/views.py", line 43, in stock_price
    information = check_market_hours(ticker_selected)
  File "/root/_startUp/Stocksera/helpers.py", line 84, in check_market_hours
    "DO UPDATE SET count=count+1", (ticker_selected, information["longName"]))

Exception Type: OperationalError at /ticker/
Exception Value: near "ON": syntax error

/reverse_repo/

Environment:

Request Method: GET
Request URL: http://localhost:3131/reverse_repo/

Django Version: 3.1.6
Python Version: 3.7.5
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'templatetags.filter',
 'ViewStocks']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'whitenoise.middleware.WhiteNoiseMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.7/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/root/_startUp/Stocksera/ViewStocks/views.py", line 777, in reverse_repo
    with open(r"database/economic_date.json", "r+") as r:

Exception Type: FileNotFoundError at /reverse_repo/
Exception Value: [Errno 2] No such file or directory: 'database/economic_date.json'

Hi please refer to stackoverflow.com/questions/51531207/on-conflict-not-even-compile-with-error-syntax for your very first issue. It turns out that your SQLite version might be too old!

the issue seems to be that I am lacking a economic_date.json. Where does this populate?

guanquann commented 3 years ago

Run python scheduled_tasks/economy/get_upcoming_events_date.py

I have uploaded a completely new set of database to my Google Drive (https://drive.google.com/drive/u/0/folders/1qR7ssxnNzOUuvYCWR-kEajyoRoGKjbcT). You can copy it to your directory if you want. Cheers