SHOW:
|
|
- or go back to the newest paste.
| 1 | m1 = peripheral.wrap("left")
| |
| 2 | m2 = peripheral.wrap("right")
| |
| 3 | ||
| 4 | m1.setTextScale(2) | |
| 5 | m1.clear() | |
| 6 | term.redirect(m1) | |
| 7 | ||
| 8 | term.setBackgroundColor(colors.yellow) | |
| 9 | term.setTextColor(colors.black) | |
| 10 | term.setCursorPos(1,1) | |
| 11 | term.write("INFORMAZIONI BORSA ")
| |
| 12 | term.setBackgroundColor(colors.black) | |
| 13 | term.setTextColor(colors.white) | |
| 14 | - | print("Apertura mercati: 10:00")
|
| 14 | + | |
| 15 | print("Apertura mercati: 9:30")
| |
| 16 | print("Chiusura mercati: 17:30")
| |
| 17 | ||
| 18 | print("Mercati chiusi sabato e domenica")
| |
| 19 | print("\nTutti i tempi sono da intendersi come reali")
| |
| 20 | - | term.restore() |
| 20 | + | |
| 21 | term.restore() | |
| 22 | while true do | |
| 23 | m2.setBackgroundColor(colors.black) | |
| 24 | m2.setTextColor(colors.white) | |
| 25 | m2.clear() | |
| 26 | term.redirect(m2) | |
| 27 | term.setCursorPos(1,1) | |
| 28 | term.write("Andamento titolo NRI - New Radeon Industrial Index")
| |
| 29 | rest_andamento = http.get("http://rest.rgbcraft.com/borsa/?richiesta=lua_grafico&azione=NRI&intervallo=43")
| |
| 30 | andamento = textutils.unserialize(rest_andamento.readAll()) | |
| 31 | rest_andamento.close() | |
| 32 | ||
| 33 | rest_minmax = http.get("http://rest.rgbcraft.com/borsa/?richiesta=lua_minmax&azione=NRI&intervallo=43")
| |
| 34 | minmax = textutils.unserialize(rest_minmax.readAll()) | |
| 35 | rest_minmax.close() | |
| 36 | ||
| 37 | for k, v in ipairs(andamento) do | |
| 38 | y = (((v - minmax.min) * (3 - 17)) / (minmax.max - minmax.min)) + 17 | |
| 39 | paintutils.drawPixel(k+7, y, colors.lime) | |
| 40 | sleep(0.1) | |
| 41 | end | |
| 42 | term.setBackgroundColor(colors.black) | |
| 43 | term.setTextColor(colors.white) | |
| 44 | term.setCursorPos(1,3) | |
| 45 | term.write(math.floor(tonumber(minmax.max))) | |
| 46 | term.setCursorPos(1,17) | |
| 47 | term.write(math.floor(tonumber(minmax.min))) | |
| 48 | term.setCursorPos(8,18) | |
| 49 | term.write(minmax.start) | |
| 50 | term.setCursorPos(46,18) | |
| 51 | term.write(minmax.finish) | |
| 52 | term.restore() | |
| 53 | term.clear() | |
| 54 | term.setCursorPos(1,1) | |
| 55 | print("OK")
| |
| 56 | sleep(180) | |
| 57 | end |