Hello,
I'm writing options features into the Ally Invest plugin, and I have three questions:
#1 - What is the correct procedure for writing the BrokerCommand GET_OPTIONS function? Am I supposed to build up an array of CONTRACT's and then copy it to the DWORD like so...
BrokerCommand (int nCommand, DWORD dwParameter)
{
// the below code is for nCommand=="GET_OPTIONS"
std::vector <CONTRACT> contracts;
// send request to server,
// get response from server
// parse data into contracts vector
// here's the part I'm not sure about:
dwParameter = (DWORD)contracts.data();
return contracts.size();
}
If not, please point me in the right direction.
#2 - I see that I have two symbol definitions... One is in SET_SYMBOL, and one is char* Asset. If a user wants to buy/sell an option, would the option symbol be defined in SET_SYMBOL or in char* Asset? Will there be cases where I would have to use one and override the other? Is SET_SYMBOL strictly for usage with BrokerCommand?
#3 - Will a user need the options symbols all individually in the AssetFix.csv file?
I appreciate any clarifications. Thanks.
Andrew
EDIT - I did eventually fix the above snippet. I'll document it here.
BrokerCommand (int nCommand, DWORD dwParameter)
{
// the below code is for nCommand=="GET_OPTIONS"
//this next line is a pointer to an array of 10,000 elements.
CONTRACT* contracts_ptr = (CONTRACT*)dwParameter;
std::vector <CONTRACT> contracts;
// send request to server,
// get response from server
// parse data into contracts vector
// I copied vector elements to the pointer, not to exceed 10,000 elements.
int i;
for (i = 0; i < Contracts.size() && i < 10000; i++)
{
contracts_ptr[i] = Contracts[i];
}
return i;
}