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?