2 registered members (AndrewAMD, VoroneTZ),
831
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Some questions for BrokerAPI(1.96.4)
#475575
12/26/18 10:15
12/26/18 10:15
|
Joined: Dec 2014
Posts: 56
ibne
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2014
Posts: 56
|
Hi, I have some questions regarding the BrokerAPI for Zorro 1.96.4, while testing my plugin: 1) The TradeTest script seems broken. I can only open trades, but not closing them for a hedged account. Zorro keeps on saying that one needs to check the NFA flag. But NFA is set to Off and the hedge mode is set to 2. The function "BrokerSell" gets never called. Even when setting AUTO=on, Zorro opens some trades but can not close them, since the NFA is "wrong". I remember that the TradeTest script was working fine in previous versions; would be very helpful if the developers could fix this. Edit: I even created a dedicated Accounts.csv entry where NFA compliance is explicitly turned off(0) with no success. Zorro still says "Closing prohibited - check NFA flag!" 2) Semantics of function brokerCommand (int nCommand, DWORD dwParameter) is sometimes unclear. The manual says that "they return 0 when they are not supported or no broker connection is established", so returning 0 is for signaling error. But what about commands which can return 0 as a value? Take GET_NTRADES as an example. It should return the number of open trades...but what if there are no open trades currently? What does a return of 0 mean here, an error or zero trades? 3) Again regarding brokerCommand: it is unclear for some commands if the value should stay fix for the entire trading session. Take SET_ORDERTEXT as an example. Should I set the orderText for the next trade which gets opened or should it be set to every upcoming orders? Or what about SET_LIMIT? To me this makes only sense for the next trade related command and not for every other. So, I invalidate the limit after applying it and the script has to set a new value again. The documentation should make it clear on the lifetime of the command values. Thx for help and have nice holidays Juergen
Last edited by ibne; 12/26/18 11:03.
|
|
|
Re: Some questions for BrokerAPI(1.96.4)
[Re: Spirit]
#475587
12/27/18 08:59
12/27/18 08:59
|
Joined: Dec 2014
Posts: 56
ibne
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2014
Posts: 56
|
Luckily, the problem with NFA was on my side In general, I think the entire specification of the Broker API needs an update, specifically the brokerCommand part. Mixing error codes with values is bad programming style IMHO.
|
|
|
Re: Some questions for BrokerAPI(1.96.4)
[Re: AndrewAMD]
#475604
12/27/18 21:12
12/27/18 21:12
|
Joined: Dec 2014
Posts: 56
ibne
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2014
Posts: 56
|
I disagree in a very general context. Mixing different types of results is in general a bad programming style. Btw, it would be very easy to change the API here with no drawbacks.
Further, returning 0 could also mean that the connection is lost. So, one has to figure out if 0 means: 1) 0 open trades 2) Connection lost 3) Command not supported
Having to look up various other places what 0 could possibly mean defeates the purpose of pure function call.
Last edited by ibne; 12/27/18 21:17.
|
|
|
Re: Some questions for BrokerAPI(1.96.4)
[Re: jcl]
#475648
12/31/18 11:44
12/31/18 11:44
|
Joined: Dec 2014
Posts: 56
ibne
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2014
Posts: 56
|
Thx, the update stop button is back Regarding BrokerAsset: so when the data for the asset is available, but the asset itself is currently not tradeable, then the plugin should return 1 anyway? I think I will add additional checks for tradeability for all order related commands(BrokerBuy, BrokerStop, BrokerSell). This is beneficial in giving back a more detailed failure description.
|
|
|
Re: Some questions for BrokerAPI(1.96.4)
[Re: ibne]
#475712
01/04/19 16:21
01/04/19 16:21
|
Joined: Dec 2014
Posts: 56
ibne
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2014
Posts: 56
|
Ok, now I see in the log that the other pointers are valid only sometimes. When looking at timestamps, I would guess that Zorro queries the other values only once per minute. Now I can see that all values are set correct and everything works
|
|
|
Re: Some questions for BrokerAPI(1.96.4)
[Re: kvm]
#475798
01/08/19 13:16
01/08/19 13:16
|
Joined: Dec 2014
Posts: 56
ibne
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2014
Posts: 56
|
So we can join forces on trying to undertsand the Zoro API Not filtering these ticks might look very strange on a tick chart, with periods of a "flat" line. I guess this defeates the purpose of a "tick", which to me means a price change. Btw: when you also work with Dukascopy, you will agree that their API is even more broken...
|
|
|
Re: Some questions for BrokerAPI(1.96.4)
[Re: kvm]
#475802
01/08/19 14:48
01/08/19 14:48
|
Joined: Dec 2014
Posts: 56
ibne
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2014
Posts: 56
|
The latest one: DDS2-jClient-JForex 3.4.13 JForex-API 2.13.62 Their API is overloaded and not very user friendly. Take for example the IEngine.executeTask() method. Why should the user take care on which thread he is when executing order related tasks? The API could handle this easily... This is just one of the many shortcomings. Ok, back to Zorro Here we urgently need some reply on how to correctly implement the API functions. What is also not so good is that Zorro queries ticks, instead of getting them pushed by default. This means that the tick history of Zorro is very different to the brokers history with many missed ticks. That makes comparison of tick based backtests impossible.
|
|
|
Re: Some questions for BrokerAPI(1.96.4)
[Re: ibne]
#475803
01/08/19 15:02
01/08/19 15:02
|
Joined: Feb 2017
Posts: 1,718 Chicago
AndrewAMD
Serious User
|
Serious User
Joined: Feb 2017
Posts: 1,718
Chicago
|
What is also not so good is that Zorro queries ticks, instead of getting them pushed by default. This means that the tick history of Zorro is very different to the brokers history with many missed ticks. That makes comparison of tick based backtests impossible. It is not impossible... in fact, I get every tick in my plugin: https://github.com/AndrewAMD/SierraChartZorroPluginTo get all ticks, you must implement SET_HWND. You must send a message to Zorro from another thread or process. Then Zorro will go ahead and collect that tick.
|
|
|
Re: Some questions for BrokerAPI(1.96.4)
[Re: ibne]
#475809
01/08/19 16:09
01/08/19 16:09
|
Joined: Feb 2017
Posts: 1,718 Chicago
AndrewAMD
Serious User
|
Serious User
Joined: Feb 2017
Posts: 1,718
Chicago
|
Calling the windows handle will make zorro call all subscribed assets.
Perhaps it is overkill, but if you're streaming your data, then you already have the data in-memory.
For the other questions, ask jcl.
EDIT: Clarity and correctness
Last edited by AndrewAMD; 01/08/19 16:14.
|
|
|
Re: Some questions for BrokerAPI(1.96.4)
[Re: AndrewAMD]
#475810
01/08/19 16:22
01/08/19 16:22
|
Joined: Dec 2014
Posts: 56
ibne
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2014
Posts: 56
|
Andrew, your plugin is written in native C/C++, which is a big advantage over plugins which relay on JVM languages. Dukascopy is using Java and so we end up with a very high latency regarding tick fetching, because we must use a Java to C/C++ bridge. I think that the most useful solution would be that Zorro provides update methods which get called by the plugin. Currently it is the other way round
|
|
|
Re: Some questions for BrokerAPI(1.96.4)
[Re: ibne]
#475811
01/08/19 16:32
01/08/19 16:32
|
Joined: Feb 2017
Posts: 1,718 Chicago
AndrewAMD
Serious User
|
Serious User
Joined: Feb 2017
Posts: 1,718
Chicago
|
You do also have the option of writing a bridge in Java, and have your plugin communicate with it. The java bridge would be a server to zorro and a client to the broker. This way, you can: * Have the Java bridge send PostMessage, and * Both the plugin and the bridge can be single-threaded (usually ideal) * Have a native C++ plugin. If you're not sure which protocol to use between the two, just use the DTC protocol and recycle my plugin. Rationale is similar to what you see here: https://www.sierrachart.com/index.php?page=doc/helpdetails76.html(Mind you, these people have strong opinions, but I share some sentiment.)
|
|
|
Re: Some questions for BrokerAPI(1.96.4)
[Re: AndrewAMD]
#475812
01/08/19 16:37
01/08/19 16:37
|
Joined: Dec 2014
Posts: 56
ibne
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2014
Posts: 56
|
I can't follow you currently My plugin for Dukascopy was already bundled with Zorro in former versions. I'm using JNI as the C++ bridge, quite normal when using Java with native code.
|
|
|
Re: Some questions for BrokerAPI(1.96.4)
[Re: ags]
#475852
01/10/19 08:43
01/10/19 08:43
|
Joined: Dec 2014
Posts: 56
ibne
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2014
Posts: 56
|
Hi, I just created an early release and it would be great if there are some testers Project/Source code is here: DukascopyPluginProject Distribution zip: PluginZip Just download the zip file and extract into your zorro installation folder.
|
|
|
|