Example #1
0
std::vector<TickData> GtaStockQuoter::querySnap(const std::vector<Contract> &contracts)
{
    std::string codes = contracts2string(contracts);
    std::vector<TickData> vec;
    CDataBuffer<CQuotationDataPtr> lst;
    RetCode code = api_->QuerySnap(Category_Quotation, const_cast<char*>(codes.c_str()), lst);
    int cnt = lst.Size();
    for (int i = 0; i< cnt; i++)
    {
        IQuotationData& quo_data = *lst[i];
        TickData tick;
        fromGtaStockTick(quo_data, &tick);
        vec.push_back(tick);
    }
    return vec;
}
Example #2
0
std::vector<Contract> GtaStockQuoter::getStockList(const char* market)
{
    char* market_tag = const_cast<char*>(market);
    std::vector<Contract> contracts;
    CDataBuffer<StockSymbol> list;
    api_->GetStockList(market_tag,list);
    int cnt = list.Size();
    
    for (int i = 0; i < cnt; i++)
    {
        std::vector<std::string> c = Util::split(list[i].Symbol, '.');
        Contract contract(map2QDExchType(c[1].c_str()), c[0]);
        contract.volume_multiple = 100;
        contracts.push_back(contract);
    }
    return contracts;
}