BrokerHistory2 - nTicks more than 1?

Posted By: byakuren81

BrokerHistory2 - nTicks more than 1? - 07/28/20 20:19

Hello, I am writing a plugin for IQFeed and I would like to know if it is possible to set the parameter nTicks of the function BrokerHistory to more than one when being called by assetHistory. My implementation works but it is very slow to fill the database with years of minute data as BrokerHistory2 is called for every single minute...
Posted By: AndrewAMD

Re: BrokerHistory2 - nTicks more than 1? - 07/28/20 20:26

Zorro automatically calls the GET_MAXTICKS broker command to size its tick buffer. If you support the command, nTicks will be equal to the output of the command.
Posted By: byakuren81

Re: BrokerHistory2 - nTicks more than 1? - 08/01/20 15:10

When returning 1000 from BrokerCommand for GET_MAXTICKS, I can get 900 ticks from BrokerHistory2 in one call, but it crashes when trying to get 1000. Clearly the tick buffer has not been sized with 1000 or something unexplained in the manual is going on...
FYI I counted the number of ticks it could process to guess the tick buffer size and I got different results before crashing for different call to Download like 943 or 956.
Posted By: AndrewAMD

Re: BrokerHistory2 - nTicks more than 1? - 08/01/20 15:18

Does nTicks change to 1000 when GET_MAXTICKS returns 1000?

Also, did you configure your DLL's struct alignment correctly per the Zorro manual?
Posted By: byakuren81

Re: BrokerHistory2 - nTicks more than 1? - 08/01/20 15:31

nTicks remains constant equal to 1. I did not configure my DLL struct alignment, I missed that point in the manual, sorry my bad.
I just made sure under VisualStudio this alignment was set to 1 or 4 bytes but it did not change anything. I still get nTicks=1 even if BrokerCommand returns 1000 in ther case of GET_MAXTICKS.
Posted By: AndrewAMD

Re: BrokerHistory2 - nTicks more than 1? - 08/01/20 15:48

Definitely adjust the struct alignment.

Something else is not right here.

How exactly are you causing BrokerHistory2 to be invoked?

Also, are you 100% sure BrokerCommand is returning 1000 for GET_MAXTICKS? Verify this from a Zorro script.
Posted By: byakuren81

Re: BrokerHistory2 - nTicks more than 1? - 08/01/20 16:15

You are absolutely right, something was wrong with my implementation of BrokerCommand, now I get nTicks=1000.
Thanks a lot for your time and your help.
© 2024 lite-C Forums