Баг SearchItems с datetime.mcs

Страницы: 1
RSS
Баг SearchItems с datetime.mcs
 
Скрипт:
Код
function main()

SearchItems("all_trades", 0, getNumberOf("all_trades") - 1,
function(sec, mcs, qty, price)
    PrintDbgStr(tostring(sec))
    PrintDbgStr(tostring(mcs))
    PrintDbgStr(tostring(qty))
    PrintDbgStr(tostring(price))
    local ok, err = pcall(function() PrintDbgStr(string.format("%02d\t%06d\t%d\t%f", sec, mcs, qty, price)) end)
    if not ok then
        PrintDbgStr(err)
        return nil
    end
    return false
end,
"datetime.sec,datetime.mcs,qty,price")

local t = getItem("all_trades", 0)
PrintDbgStr(tostring(t.datetime.sec))
PrintDbgStr(tostring(t.datetime.mcs))
PrintDbgStr(tostring(t.qty))
PrintDbgStr(tostring(t.price))

end

Результат:

Код
1   23:03:44.848   31036   info.exe   14
2   23:03:44.848   31036   info.exe   1.0
3   23:03:44.848   31036   info.exe   2789.61
4   23:03:44.848   31036   info.exe   nil
5   23:03:44.848   31036   info.exe   C:\BCS_Work10\QUIK_BCS\lua\MA server\searchitems-bug.lua:10: bad argument #4 to 'format' (number has no integer representation)
6   23:03:44.848   31036   info.exe   14
7   23:03:44.848   31036   info.exe   0
8   23:03:44.848   31036   info.exe   1.0
9   23:03:44.848   31036   info.exe   2789.61

Во-первых, внутри SearchItems почему-то поле datetime.mcs судя по симптомам равно nil, а при получении через getItem оно равно 0.
Во-вторых, идёт смещение переданных параметров в функции: поле qty присваивается переменной mcs, поле price присваивается переменной qty, а переменной price ничего не достаётся.
В документации написано, что никакого сдвига не должно быть и mcs должно было бы получить nil

Quik 12.2.2.8, брокер БКС, подписка на обезличенные сделки по классу INDX (печатается первая сделка за день по IMOEX2).
Страницы: 1
Читают тему
Наверх