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

Такая ошибка при соединении #22

Open
Maksim-Sheyngalts opened this issue Jan 28, 2023 · 4 comments
Open

Такая ошибка при соединении #22

Maksim-Sheyngalts opened this issue Jan 28, 2023 · 4 comments

Comments

@Maksim-Sheyngalts
Copy link

Traceback (most recent call last):
at block 1, line 17
at /var/datalore/manager/.pip/apimoex/requests.py, line 377, in get_board_candles(session, security, interval, start, end, columns, board, market, engine)
at /var/datalore/manager/.pip/apimoex/requests.py, line 126, in _get_long_data(session, url, table, query)
at /var/datalore/manager/.pip/apimoex/client.py, line 124, in get_all(self)
at /var/datalore/manager/.pip/apimoex/client.py, line 62, in iter(self)
at /var/datalore/manager/.pip/apimoex/client.py, line 97, in get(self, start)
at /var/datalore/manager/.pip/requests/sessions.py, line 600, in get(self, url, **kwargs)
at /var/datalore/manager/.pip/requests/sessions.py, line 587, in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
at /var/datalore/manager/.pip/requests/sessions.py, line 701, in send(self, request, **kwargs)
at /var/datalore/manager/.pip/requests/adapters.py, line 565, in send(self, request, stream, timeout, verify, cert, proxies)
ConnectionError: HTTPSConnectionPool(host='iss.moex.com', port=443): Max retries exceeded with url: /iss/engines/stock/markets/shares/boards/TQBR/securities/MGNT/candles.json?iss.json=extended&iss.meta=off&interval=10&from=2022-08-01&till=2023-01-26&iss.only=candles%2Chistory.cursor&candles.columns=begin%2Copen%2Cclose%2Chigh%2Clow%2Cvalue (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9b62e6dd90>: Failed to establish a new connection: [Errno 110] Connection timed out'))

@Maksim-Sheyngalts
Copy link
Author

Maksim-Sheyngalts commented Jan 28, 2023

import requests
import apimoex
import pandas as pd

share_name = 'MGNT'
xls_name = 'sberp.xlsx'
end_date = '2023-01-26'
with requests.Session() as session:
    data = apimoex.get_board_candles(session, share_name, interval=10, start='2022-08-01', end=end_date)
    df = pd.DataFrame(data)
    
    print(df.head())
    print(df.tail())    
    df.info()

@WLM1ke
Copy link
Owner

WLM1ke commented Jan 28, 2023

У меня работает. Тут несколько вариантов:

  1. Попробовать еще - просто был временный сбой
  2. Некоторое время назад не работало, если вы не в России - тут сложно чем-то помочь
  3. Вы много чего качали и MOEX вас заблокировало - можно подождать, через некоторое время разблокируют, а впредь сохранять необходимые данные локально, а не качать одно и то же по много раз и часто

@Maksim-Sheyngalts
Copy link
Author

Maksim-Sheyngalts commented Feb 4, 2023

А через proxy ?
session.proxies.update(proxies)

не работает, такая же ошибка, но платный proxy ещё не использовал

@WLM1ke
Copy link
Owner

WLM1ke commented Feb 4, 2023

Не знаю, у меня все работает. По какому принципу MOEX банит не знаю.

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

2 participants