Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m1 = peripheral.wrap("left")
- m2 = peripheral.wrap("right")
- m1.setTextScale(2)
- m1.clear()
- term.redirect(m1)
- term.setBackgroundColor(colors.yellow)
- term.setTextColor(colors.black)
- term.setCursorPos(1,1)
- term.write("INFORMAZIONI BORSA ")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- print("\n")
- print("Apertura mercati: 9:30")
- print("Chiusura mercati: 17:30")
- print("Mercati chiusi sabato e domenica")
- print("\nTutti i tempi sono da intendersi come reali")
- term.restore()
- while true do
- m2.setBackgroundColor(colors.black)
- m2.setTextColor(colors.white)
- m2.clear()
- term.redirect(m2)
- term.setCursorPos(1,1)
- term.write("Andamento titolo NRI - New Radeon Industrial Index")
- rest_andamento = http.get("http://rest.rgbcraft.com/borsa/?richiesta=lua_grafico&azione=NRI&intervallo=43")
- andamento = textutils.unserialize(rest_andamento.readAll())
- rest_andamento.close()
- rest_minmax = http.get("http://rest.rgbcraft.com/borsa/?richiesta=lua_minmax&azione=NRI&intervallo=43")
- minmax = textutils.unserialize(rest_minmax.readAll())
- rest_minmax.close()
- for k, v in ipairs(andamento) do
- y = (((v - minmax.min) * (3 - 17)) / (minmax.max - minmax.min)) + 17
- paintutils.drawPixel(k+7, y, colors.lime)
- sleep(0.1)
- end
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(1,3)
- term.write(math.floor(tonumber(minmax.max)))
- term.setCursorPos(1,17)
- term.write(math.floor(tonumber(minmax.min)))
- term.setCursorPos(8,18)
- term.write(minmax.start)
- term.setCursorPos(46,18)
- term.write(minmax.finish)
- term.restore()
- term.clear()
- term.setCursorPos(1,1)
- print("OK")
- sleep(180)
- end
Add Comment
Please, Sign In to add comment