Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, Quad, EternallyCurious, 1 invisible), 726 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Broker API - Live tick volume -> BrokerAsset *pVolume #469018
11/02/17 13:54
11/02/17 13:54
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
jcl,

Background:

In my DLL, I have two TCP sockets, one for history and one for everything else. I do not want Zorro to make BrokerHistory2 calls just to get volume, because it would have to reconnect the history socket just to get a tiny bit of data - and then disconnect. Alas, this is in the manual:

Quote:
pVolume: Optional output, recent trade volume of the asset per minute, or 0 when the volume is unavailable. If no volume is returned in this function, Zorro retrieves it with a BrokerHistory2 call.


On the main socket, I have to subscribe to an asset. This will cause the server to stream an endless number of updates for that asset. Thus, I might have to set up a listener on its own thread (or otherwise buffer messages upon every DLL call).

Question #1
: How do I set the pVolume value? The below algorithm is a reset once-per-minute scheme. Is this the correct approach?

1. Assume BrokerAsset is called frequently.
2. Upon subscription, set pVolume to 0.
3. As ticks arrive, increment pVolume by new volume received this minute.
4. At the beginning of every minute, reset pVolume to 0.
5. Repeat steps 3 & 4 for the duration of trading.

Question #2
: If I initially set pVolume to 0 (with the intent of updating it later), is Zorro always going to call BrokerHistory2?

Re: Broker API - Live tick volume -> BrokerAsset *pVolume [Re: AndrewAMD] #469036
11/03/17 14:59
11/03/17 14:59
Joined: Feb 2017
Posts: 369
D
Dalla Offline
Senior Member
Dalla  Offline
Senior Member
D

Joined: Feb 2017
Posts: 369
I asked this during development of the IG plugin
"... related to the BrokerAsset call, variable pVolume.
The manual states:

"Optional output, recent trade volume of the asset per minute, or 0 when the volume is unavailable. If no volume is returned in this function, Zorro retrieves it with a BrokerHistory2 call."

Ig provides volume, but I'm unsure what is meant by "recent trade volume of the asset per minute".
Should I just put the total volume for the previous minute, or an average over the previous X minutes, or accumulated volume for the current minute?"


And the answer
"We recommend returning the average volume of the previous 5 minutes divided by 5. That's what the BrokerHistory2 call does."

In the IG plugin I make one initial call to brokerHistory2 to initialize the pVolume, then update it every limit with the rolling 5 min average.

Hope this helps.

Re: Broker API - Live tick volume -> BrokerAsset *pVolume [Re: Dalla] #469037
11/03/17 15:28
11/03/17 15:28
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
This is helpful.

Question #3: What if the market is dead for some reason, and the volume is actually zero, so I say *pVolume = 0 in the middle of trading.

In this case, would Zorro start getting volume from BrokerHistory2 (much to my chagrin)?

Re: Broker API - Live tick volume -> BrokerAsset *pVolume [Re: AndrewAMD] #469042
11/03/17 20:57
11/03/17 20:57
Joined: Feb 2017
Posts: 369
D
Dalla Offline
Senior Member
Dalla  Offline
Senior Member
D

Joined: Feb 2017
Posts: 369
I haven't really thought about this, but the manual says
"Optional output, recent trade volume of the asset per minute, or 0 when the volume is unavailable. If no volume is returned in this function, Zorro retrieves it with a BrokerHistory2 call."

I would think that returning 0. Not returning anything at all is what triggers a call to BrokerHistory2.

Re: Broker API - Live tick volume -> BrokerAsset *pVolume [Re: Dalla] #469044
11/03/17 23:05
11/03/17 23:05
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
This info in the manual was in fact outdated. Zorro does not call BrokerHistory2 when no volume is available. The volume is then zero.

Also, the volume is not strictly volume per minute anymore. It is up to the plugin what's returned in the fVol and pVolume parameters. It can be volume per minute, trade volume, quote volume, tick frequency, or anything that has something to do with supply and demand that asset. It should only be consistent in history and live trading.

Re: Broker API - Live tick volume -> BrokerAsset *pVolume [Re: jcl] #469154
11/06/17 17:54
11/06/17 17:54
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online OP
Serious User
AndrewAMD  Online OP
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
Obligatory relevant thread cross-reference:

Feature request: new brokercommand GET_BROKERASSET_VOLUME_TYPE


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