Closed eabase closed 3 years ago
hmm, from #63
QuoteUpdate , QuoteUpdated ??
Maybe use this:
@vdemydiuk Does this mean that the tickevent is not avaiable in MT4 API?
vs.
How are the different DLL calls supposed to be used?
If we set c=MtApi.MtApiClient
, then we have the following QuoteUpdate
related attributes:
attr: QuoteAdded type: <class 'CLR.EventBinding'> doc: <n/a>
attr: QuoteRemoved type: <class 'CLR.EventBinding'> doc: <n/a>
attr: QuoteUpdate type: <class 'CLR.EventBinding'> doc: <n/a>
attr: QuoteUpdated type: <class 'CLR.EventBinding'> doc: <n/a>
attr: add_QuoteAdded type: <class 'CLR.MethodBinding'> doc: Void add_QuoteAdded(System.EventHandler`1[MtApi.MtQuoteEventArgs])
attr: add_QuoteRemoved type: <class 'CLR.MethodBinding'> doc: Void add_QuoteRemoved(System.EventHandler`1[MtApi.MtQuoteEventArgs])
attr: add_QuoteUpdate type: <class 'CLR.MethodBinding'> doc: Void add_QuoteUpdate(System.EventHandler`1[MtApi.MtQuoteEventArgs])
attr: add_QuoteUpdated type: <class 'CLR.MethodBinding'> doc: Void add_QuoteUpdated(MtApi.MtApiQuoteHandler)
attr: remove_QuoteAdded type: <class 'CLR.MethodBinding'> doc: Void remove_QuoteAdded(System.EventHandler`1[MtApi.MtQuoteEventArgs])
attr: remove_QuoteRemoved type: <class 'CLR.MethodBinding'> doc: Void remove_QuoteRemoved(System.EventHandler`1[MtApi.MtQuoteEventArgs])
attr: remove_QuoteUpdate type: <class 'CLR.MethodBinding'> doc: Void remove_QuoteUpdate(System.EventHandler`1[MtApi.MtQuoteEventArgs])
attr: remove_QuoteUpdated type: <class 'CLR.MethodBinding'> doc: Void remove_QuoteUpdated(MtApi.MtApiQuoteHandler)
I have solved the issue! The problem was over-complicating the delegates while trying to understand and use the far more complex nature of the underlying .NET code. The example VB code was trivial to implement, once it was understood.
To get OnTick() ticks, all you have to do is this:
...
import MtApi as mt
def printTick2(source, *args):
print('source: {}\nargs: {}'.format(source, list(args)))
mtc = mt.MtApiClient()
mtc.BeginConnect('127.0.0.1', 8222);
mtc.QuoteUpdated += printTick2
# Run the loop forever waiting for and printing new ticks
while 1:
pass
time.sleep(0.1)
...
I will post a PR with more python code in a few days.
Right now I am simply polling for new ticks by doing the following (in Python):
This is stupid, and should be implement as a thread or something.
The problem is, I don't know how to emulate the
OnTick()
signal, to tell me when there is a new tick.@vdemydiuk How can I make or implement a listener that will tell me when there is actually a new tick? Is there anything in the API I can use for this?