MetaTrader 5 Python User Group - como usar o Python no Metatrader - página 28

 
Bem, se todos os dados são de um terminal, então é evidente que a mudança de hora não é importante. Mas isto é suposto ser uma ferramenta analítica (por exemplo, ligação a notícias ou outros dados) - e o tempo é lá diferente, por isso tem de se converter.
 
Lyuk:
Bem, se todos os dados são de um terminal, então é evidente que a mudança de hora não é importante. Mas isto é suposto ser um instrumento de análise (por exemplo, ligação a notícias ou outros dados) - e o tempo é lá diferente, por isso temos de o converter.

Parece fácil

pd.tz_convert(None)
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.dt.tz_convert.html
 
Não é difícil, quando já se encontrou um bug que precisa de tempo para corrigir, a depuração é difícil.
 

A biblioteca não está instalada ou mesmo actualizada. A versão actual que estou a utilizar é a 5.0.4 e a última versão é a 5.0.8.

É um ficheiro de registo. O que devo fazer?

Collecting MetaTrader5
  Downloading https: //files.pythonhosted.org/packages/56/76/58682d9a70b8eea2a707634125fb495bf457b21fef565d2d4bac559aad94/MetaTrader5-5.0.8.tar.gz
Building wheels for collected packages: MetaTrader5
  Building wheel for MetaTrader5 (setup.py) ... error
  ERROR: Command errored out with exit status 1 :
   command: 'c:\python35\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = ' "'" 'C:\\Users\\la\\AppData\\Local\\Temp\\pip-install-s2bqudzg\\MetaTrader5\\setup.py' "'" '; __file__=' "'" 'C:\\Users\\la\\AppData\\Local\\Temp\\pip-install-s2bqudzg\\MetaTrader5\\setup.py' "'" ';f=getattr(tokenize, ' "'" 'open' "'" ', open)(__file__);code=f.read().replace(' "'" '\r\n' "'" ', ' "'" '\n' "'" ');f.close();exec(compile(code, __file__, ' "'" 'exec' "'" '))'  bdist_wheel -d  'C:\Users\la\AppData\Local\Temp\pip-wheel-6x877lgv'  --python-tag cp35
        cwd: C:\Users\la\AppData\Local\Temp\pip-install-s2bqudzg\MetaTrader5\
  Complete output ( 10 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64- 3.5
  creating build\lib.win-amd64- 3.5 \MetaTrader5
  copying MetaTrader5\__init__.py -> build\lib.win-amd64- 3.5 \MetaTrader5
  running build_ext
  building 'MetaTrader5.C' extension
  error: [WinError 2 ] The system cannot find the file specified
  ----------------------------------------
  ERROR: Failed building wheel for MetaTrader5
  Running setup.py clean for MetaTrader5
Failed to build MetaTrader5
Installing collected packages: MetaTrader5
  Found existing installation: MetaTrader5 5.0 . 4
    Uninstalling MetaTrader5- 5.0 . 4 :
      Successfully uninstalled MetaTrader5- 5.0 . 4
    Running setup.py install for MetaTrader5 ... error
    ERROR: Command errored out with exit status 1 :
     command: 'c:\python35\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = ' "'" 'C:\\Users\\la\\AppData\\Local\\Temp\\pip-install-s2bqudzg\\MetaTrader5\\setup.py' "'" '; __file__=' "'" 'C:\\Users\\la\\AppData\\Local\\Temp\\pip-install-s2bqudzg\\MetaTrader5\\setup.py' "'" ';f=getattr(tokenize, ' "'" 'open' "'" ', open)(__file__);code=f.read().replace(' "'" '\r\n' "'" ', ' "'" '\n' "'" ');f.close();exec(compile(code, __file__, ' "'" 'exec' "'" '))' install --record 'C:\Users\la\AppData\Local\Temp\pip-record-7ohhmuga\install-record.txt'  --single-version-externally-managed --compile
          cwd: C:\Users\la\AppData\Local\Temp\pip-install-s2bqudzg\MetaTrader5\
    Complete output ( 10 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64- 3.5
    creating build\lib.win-amd64- 3.5 \MetaTrader5
    copying MetaTrader5\__init__.py -> build\lib.win-amd64- 3.5 \MetaTrader5
    running build_ext
    building 'MetaTrader5.C' extension
    error: [WinError 2 ] The system cannot find the file specified
    ----------------------------------------
  Rolling back uninstall of MetaTrader5
  Moving to c:\python35\lib\site-packages\metatrader5- 5.0 . 4 .dist-info\
   from c:\python35\lib\site-packages\~etatrader5- 5.0 . 4 .dist-info
  Moving to c:\python35\lib\site-packages\metatrader5\
   from c:\python35\lib\site-packages\~-tatrader5
ERROR: Command errored out with exit status 1 : 'c:\python35\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = ' "'" 'C:\\Users\\la
 \\AppData\\Local\\Temp\\pip-install-s2bqudzg\\MetaTrader5\\setup.py' "'" '; __file__=' "'" 'C:\\Users\\la
 \\AppData\\Local\\Temp\\pip-install-s2bqudzg\\MetaTrader5\\setup.py' "'" ';f=getattr(tokenize, ' "'" 'open' "'" ', open)(__file__);code=f.read().replace(' "'" '\r\n' "'" ', ' "'" '\n' "'" ');f.close();exec(compile(code, __file__, ' "'" 'exec' "'" '))' install --record 'C:\Users\la \AppData\Local\Temp\pip-record-7ohhmuga\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
 
jaffer wilson:

A biblioteca não está instalada ou mesmo actualizada. A versão actual que estou a utilizar é a 5.0.4 e a última versão é a 5.0.8.

É um diário de bordo. O que devo fazer?

Reinstale Python (3,7 ou 3,8 é melhor) e tente novamente, por favor.

 
MetaQuotes Software Corp. :

Reinstale Python (de preferência 3,7 ou 3,8) e tente novamente, por favor.

Estou a usar o Python 3.5.0. A versão anterior funciona bem. Mas a última actualização não é actualizada. O que poderá estar a causar isto?

 
jaffer wilson:

Estou a usar o Python 3.5.0. A versão anterior funciona bem. Mas a última actualização não é actualizada. Qual poderia ser a razão para isto?

Reinstale Python 3.5.0 x64 e tente novamente.

 
MetaQuotes Software Corp. :

Reinstale Python 3.5.0 x64 e tente novamente.

Obrigado pela sua resposta. Já o fiz. Mas o problema continua a ser o mesmo.

 
jaffer wilson:

A biblioteca não está instalada ou mesmo actualizada. A versão actual que estou a utilizar é a 5.0.4 e a última versão é a 5.0.8.

É um diário de bordo. O que devo fazer?

A julgar pelos registos que está a tentar construir um módulo a partir da fonte, deve ter o Visual Studio 2017/2019 ou o Visual C++ Build Tools para isso.

Tente entrar:

pip uninstall MetaTrader5
pip install MetaTrader5

a instalação deve ser feita a partir de whl:

E:\>pip install MetaTrader5
Collecting MetaTrader5
  Downloading https://files.pythonhosted.org/packages/e4/fc/dc782c6b6b1c9270b8efbca08b2304150354a87fff5695671f930af8f0ad/MetaTrader5-5.0.9-cp37-cp37m-win_amd64.whl
Installing collected packages: MetaTrader5
Successfully installed MetaTrader5-5.0.9
 
Almaz :

A julgar pelos registos que está a tentar construir um módulo a partir da fonte, deve ter o Visual Studio 2017/2019 ou o Visual C++ Build Tools para isso.

Tente entrar:

a instalação deve ser feita a partir de whl:

Eu também tentei isso. Mas não compreendo porque é que isto está a acontecer. Se eu desinstalar o Metatrader e tentar reinstalar, recebo o mesmo erro. Mesmo para a versão 5.0.4.

E estou a usar o Python 3.5.0 estritamente.

Razão: