MetaTrader 5 Python 사용자 그룹 - Metatrader에서 Python을 사용하는 방법 - 페이지 61

 
Vladimir Perervenko :

설치 실패

Win10, Py3.6.10 및 WinPy3.7.7.

다시 시도하십시오. Python < 3.8에서 작동하도록 리팩토링해야 했습니다.

 
nicholi shen :

다시 시도하십시오. Python < 3.8에서 작동하도록 리팩토링해야 했습니다.

확인

Successfully built pymt5adapter
Installing collected packages: pymt5adapter
Successfully installed pymt5adapter- 0.2 . 1
----- Установка "pymt5adapter" выполнена. -

릴리스의 새로운 기능은 무엇입니까?

행운을 빕니다

 
Vladimir Perervenko :

확인

릴리스의 새로운 기능은 무엇입니까?

행운을 빕니다

Calendar_events https://github.com/nicholishen/pymt5adapter/blob/master/pymt5adapter/calendar.py

 from datetime import datetime
from datetime import timedelta

import pymt5adapter as mt5
from pymt5adapter.calendar import calendar_events
from pymt5adapter.calendar import Currency
from pymt5adapter.calendar import Importance


def forex_symbol(s):
    modes = [mt5.SYMBOL_CALC_MODE_FOREX, mt5.SYMBOL_CALC_MODE_FOREX_NO_LEVERAGE]
     return s.trade_calc_mode in modes


def main():
    symbol = mt5.symbols_get(function=forex_symbol)[ 0 ]
    one_week = timedelta(weeks= 1 )
    now = datetime.now()
    default_one_week_ahead_all_events = calendar_events()
    filtered_by_callback = calendar_events(function=lambda e: 'fed' in e[ 'event_name' ].lower())
    filtered_by_flags = calendar_events(importance=Importance.MEDIUM | Importance.HIGH,
                                        currencies=Currency.USD | Currency.JPY)
    filtered_by_strings = calendar_events(importance= 'medium high' ,
                                          currencies= 'usdjpy' )
    filtered_by_iterables = calendar_events(importance=( 'medium' , ' high' ),
                                            currencies=( 'usd' , 'jpy' ))
    filtered_by_specific_times = calendar_events(time_from=now, time_to=now + one_week)
    filtered_by_timedeltas = calendar_events(time_from=(-one_week), time_to=one_week)
    filtered_by_timedelta_lookback = calendar_events(-one_week)
    calendar_events_in_russian = calendar_events(language= 'ru' )

    employment_events_next_month = calendar_events(
        currencies=Currency.USD,
        importance=Importance.HIGH
        function=lambda e: 'employment' in (name:=e[ 'event_name' ].lower()) or 'payroll' in name
    )

    next_event = employment_events_next_month[ 0 ]

     for k, v in next_event.items():
        print(k, v)


if __name__ == '__main__' :
    with mt5.connected():
        main()
nicholishen/pymt5adapter
nicholishen/pymt5adapter
  • nicholishen
  • github.com
A drop-in pythonic adapter for the MetaTrader5 package to enhance usability. - nicholishen/pymt5adapter
 

안녕하세요! TRADE_ACTION_CLOSE_BY로 작업하는 방법 ??? 또는 누가 모든 오픈 포지션 을 마감하고 어떻게 마감합니까?

 
9805244 :

안녕하세요! TRADE_ACTION_CLOSE_BY로 작업하는 방법 ??? 또는 누가 모든 오픈 포지션 을 마감하고 어떻게 마감합니까?

파이썬 사용?

 

이 줄은 VS2019(WinPy3.7.7)에서 꾸짖습니다(밑줄):

"예기치 않은 토큰 '기능'"

예기치 않은 토큰 ':"

예기치 않은 토큰 '='

잘못된 구문

employment_events_next_month = calendar_events(
        currencies=Currency.USD,
        importance=Importance.HIGH
        
function =lambda e: 'employment' in (name
:=e ['event_name'].lower()) 
or 'payroll' in name
    )
 
Vladimir Perervenko :

이 줄은 VS2019(WinPy3.7.7)에 의해 꾸지람을 받았습니다(밑줄):

"예기치 않은 토큰 '기능'"

예기치 않은 토큰 ':"

예기치 않은 토큰 '='

잘못된 구문

이것은 python >=3.8에 대한 새로운 할당 표현식이며 훌륭합니다. 귀하의 버전에서 작동하도록 하려면 라이브러리에서 모든 항목을 제거해야 했지만 작동하도록 해당 예제 스크립트를 리팩토링할 수 있다고 생각합니다. 파이썬 인터프리터를 최신 버전으로 업그레이드하는 것을 고려해야 합니다. :)

https://www.python.org/dev/peps/pep-0572/

PEP 572 -- Assignment Expressions
PEP 572 -- Assignment Expressions
  • www.python.org
PEP: Title: Author: Status: Type: Created: Python-Version: Post-History: Resolution:
 
nicholi shen :

이것은 python >=3.8에 대한 새로운 할당 표현식이며 훌륭합니다. 귀하의 버전에서 작동하도록 하려면 라이브러리에서 모든 항목을 제거해야 했지만 작동하도록 해당 예제 스크립트를 리팩토링할 수 있다고 생각합니다. 파이썬 인터프리터를 최신 버전으로 업그레이드하는 것을 고려해야 합니다. :)

https://www.python.org/dev/peps/pep-0572/

나는 할 수 없다. 너무 많은 패키지가 3.7.7 및 3.6.10에 묶여 있습니다.

가능하면 무엇을 또는 어떻게 교체해야 하는지 알려주십시오. 그렇지 않은 경우 문제가 없습니다.

저는 파이썬 전문가가 아닙니다. 내 언어는 R/

행운을 빕니다.

 
Vladimir Perervenko :

할 수 없어. 너무 많은 패키지가 3.7.7 및 3.6.10에 묶여 있습니다.

가능하면 무엇을 또는 어떻게 교체해야 하는지 알려주십시오. 그렇지 않은 경우 문제가 없습니다.

저는 파이썬 전문가가 아닙니다. 내 언어는 R /

행운을 빕니다.

def employment_event(e):
    event_name = e[ 'event_name' ].lower()
     return 'payroll' in event_name or 'employment' in event_name


employment_events_next_month = calendar_events(
    currencies=Currency.USD,
    importance=Importance.HIGH,
    function=employment_event
)
 
Vladimir Perervenko :

파이썬 사용?