Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (VoroneTZ, monk12, Quad), 829 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Need help with BrokerAsset workaround #483540
06/11/21 18:48
06/11/21 18:48
Joined: Feb 2021
Posts: 19
C
CpOo Offline OP
Newbie
CpOo  Offline OP
Newbie
C

Joined: Feb 2021
Posts: 19
Hi,

I need some ideas / help to bypass a problem with BrokerAsset (Error 053) while trading a multi Asset strategy using the Binance Futures Plugin.

The problem is that when an Asset becomes unavailable or unsubscribed from the websocket, the connection stopped as a whole and trading stops not only for the unavailable assets, but for all:

From the _diag log:

Code
Load ETCUSDT
BrokerAsset ETCUSDT 0 => 
printf: 
!§s0  (494.990800 ms)
printf: 
Error 053: §s unavailable at this time


From the _real log (Debug 7):

Code
!FEED_WS: readloop_handler: unspecified system error
!BrokerAccount: 'stopped' detected!
!BrokerAsset: stopped
!BrokerAsset: stopped
!BrokerAsset: stopped
!BrokerAsset: stopped
!BrokerAsset: stopped
!BrokerAsset: stopped
!BrokerAsset: stopped
!BrokerAsset: stopped
!BrokerAsset: stopped
!BrokerAsset: stopped
!BrokerAsset: stopped
!BrokerAsset: stopped
!BrokerAsset: stopped
!BrokerAsset: stopped
...


As for the BrokerPlugin docs (https://manual.zorro-project.com/brokerplugin.htm) when an Asset is unavailable it returns Error 053 and trading with that asset is disabled. That's Ok, and perfectly fine, but as my understanding trading should be disabled only for that asset, and not the remaining ones that are Ok and available IMHO. I debug that and If I comment the affected asset and connect again the system resume the trading session without problem.

I talked with support about this and they were very helpful, but unfortunately I am not a very good coder, and not sure what are the best way to setup this workaround, as it is more complex than expected.

Option 1: Use Ignore(53) to continue trading with the other assets: This option is not working (in my test) maybe because it only have effect at the start of the trading session: https://manual.zorro-project.com/errors.htm

Option 2: Detect that the Asset is unavailable by script and exclude it from the trading session, restarting the connection with the broker again.

This is a complex thing because it is necessary to do in the error() or callback() function and then connect again without the unavailable Assets. It could be something like this:

1.- Detect the error
2.- Check and Stop the connection with the broker if already open with login(2); or login(4);
3.- Exclude the affected asset
4.- Start again the connection with the broker with login(1)

If someone have a better idea, or similar experiences and can share some code it would be great as I am a bit desperate with this problem.

Thank you so much

Re: Need help with BrokerAsset workaround [Re: CpOo] #483559
06/15/21 07:31
06/15/21 07:31
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Error 53 does not stop a session. It only returns 0 when asset() is called. If that stops the session or not depends on the script. Of course it's also possible that the broker API then throws an internal error from which it does not recover.


Re: Need help with BrokerAsset workaround [Re: jcl] #483564
06/15/21 11:27
06/15/21 11:27
Joined: Feb 2021
Posts: 19
C
CpOo Offline OP
Newbie
CpOo  Offline OP
Newbie
C

Joined: Feb 2021
Posts: 19
Hi,

Yes, in my understanding Error 53 (BrokerAsset == 0) should only stop trading with the Asset that has problems, but continue trading with the other ones. I think that session with the broker is not completely closed (because I can see that the affected Asset re-subscribed again few minutes later), but somewhat freeze, and if one asset loose the subscription everything is stopped until that asset is subscribed again. Support and developer are looking into it.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1