Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.39 KB | None | 0 0
  1. tracked = {
  2.     SPBFUT = {
  3.         RIZ4 = {},
  4.         SiZ4 = {}
  5.     },
  6.     SPBOPT = {
  7.         RI95000BL4 = {}
  8.     },
  9.     TQBR = {
  10.         SBER = {},
  11.         VTBR = {}
  12.     }
  13. }
  14.  
  15. stopped = false
  16. f = nil
  17.  
  18. function myLog(entry)
  19.     f:write(os.date())
  20.     f:write(" ")
  21.     if type(entry) == "table" then
  22.         for i = 1, #entry do
  23.             if entry[i] == nil then
  24.                 f:write("<nil>")
  25.             else
  26.                 f:write(entry[i])
  27.             end
  28.         end
  29.     else
  30.         f:write(entry)
  31.     end
  32.     f:write("\n")
  33.     f:flush()
  34. end
  35.  
  36. function repr(p)
  37.     return p.param_value .. " (" .. p.param_image .. ") [type=" .. p.param_type .. "]"
  38. end
  39.  
  40. function OnInit()
  41.     f = io.open(getScriptPath() .. "\\track-params.txt", "w")
  42. end
  43.  
  44. function OnParam(class_code, sec_code)
  45.     if tracked[class_code] and tracked[class_code][sec_code] then
  46.         local t = tracked[class_code][sec_code]
  47.         for _, param in ipairs({"status", "tradingstatus", "stepprice"}) do
  48.             local r = repr(getParamEx(class_code, sec_code, param))
  49.             if r ~= t[param] then
  50.                 myLog({sec_code, "@", class_code, ": ", param, ": ", t[param], " -> ", r})
  51.                 t[param] = r
  52.             end
  53.         end
  54.     end
  55. end
  56.  
  57. function OnStop(signal)
  58.     stopped = true
  59. end
  60.  
  61. function main()
  62.     while not stopped do
  63.         sleep(100)
  64.     end
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement