Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
10 'Bit of fun with the SolderCore , LCD/LoL and Share Pries 20 'by Iain Derrington 30 ' 40 'INSTALL "LCD-SHIELD" 50 INSTALL "JIMMIE-RODGERS-LOL-SHIELD" 60 FONT "ROMAN-DUPLEX" 70 ' 80 CLS 90 CLG 100 ' 110 'List of companies I'm interested in. 120 'Feel free to add to this list 130 COMPANIES = ["ARM.L", "GOOG", "AAPL", "MSFT"] 140 'n = name, l1 = value, x = market, h=day high, g = day low 150 FLAGS = ["n", "l1", "x", "h", "g"] 160 ' 170 DIM STOCKINFO(LEN(COMPANIES), LEN(FLAGS)) 180 DIM PREVPRICE(LEN(COMPANIES)) 190 ' 200 REPEAT 210 CLS 220 'Open a socket to Yahoo 230 S = SOCKET("download.finance.yahoo.com", 80) 240 'Did it open? 250 IF S < 0 THEN 260 PRINT $RED; "Failed to open Socker:"; $CYAN; REPORT S 270 PAUSE 2 280 ELSE 290 'Build the request string 300 REQUEST = "GET /d/quotes.csv?s=" 310 FOR EACH C IN COMPANIES 320 REQUEST = REQUEST + C + "+" 330 NEXT C 340 ' 350 'remove the last "+" from the request string 360 REQUEST = LEFT(REQUEST, - 1) 370 ' 380 'Append the rest of the request 390 REQUEST = REQUEST + "&f=" + JOIN(FLAGS) + " HTTP/1.1" 400 ' 410 'Send the request through the socket 420 PRINT #S, REQUEST 430 PRINT #S, "Host: download.finance.yahoo.com" 440 PRINT #S, "Accept: text/html" 450 PRINT #S, 460 ' 470 HEADER = "" 480 ' 490 'Read the header info 500 REPEAT 510 TRY INPUT #S, INP AS STR 520 IF NOT ERROR THEN 530 PRINT; $GREEN; INP 540 HEADER = HEADER + INP 550 ENDIF 560 HDRLEN = HDRLEN + LEN(INP) 570 UNTIL ERROR OR ELSE INP = "" 580 ' 590 'Make sure header was OK 600 IF MATCH("HTTP/1.1 200 OK*", HEADER) < 1 THEN 610 PRINT $RED; "Error: Incorrect Header Response: "; %GREEN; HEADER 620 TRY CLOSE S 630 PAUSE 1 640 ELSE 650 TRY INPUT #S, DUNNOWOTTHISIS 660 IF ERROR THEN 670 PRINT $RED; "Error reading unknown thing:"; $CYAN; REPORT ERROR 680 TRY CLOSE S 690 PAUSE 1 700 ELSE 710 'The next lines from the server will contain the 720 'comma seperted variables 730 FLGERROR = 0 740 FOR I = 0 TO LEN(COMPANIES) - 1 750 TRY INPUT #S, INFO AS STR 760 IF(NOT ERROR AND(LEN(INFO) > 2)) THEN 770 STOCKINFO(I) = SPLIT(INFO, ",") 780 ELSE 790 'If a single error occurs, latch it 800 FLGERROR = 1 810 ENDIF 820 NEXT I 830 ' 840 ' Close the socket. It is no longer required 850 TRY CLOSE S 860 ' 870 'If all OK display the results 880 IF FLGERROR = 0 THEN 890 FOR I = 0 TO LEN(COMPANIES) - 1 900 ' Remove quotes from string 910 STOCKINFO(I, 0) = RIGHT(STOCKINFO(I, 0), - 1) 920 STOCKINFO(I, 0) = LEFT(STOCKINFO(I, 0), - 2) 930 ' Determine market to select between USD/c and GBP/p 940 IF MATCH("*Nasdaq*", STOCKINFO(I, 2)) THEN 950 STOCKINFO(I, 2) = "c" 960 ELSE 970 STOCKINFO(I, 2) = "p" 980 ENDIF 990 ' Update text on console 1000 PRINT $GREEN; STOCKINFO(I, 0); $WHITE; " share price accordig to Yahoo is "; 1010 PRINT $GREEN; STOCKINFO(I, 1); STOCKINFO(I, 2) 1020 ' Display data on LCD 1030 'CALL SLIDER(STOCKINFO(I), VAL(STOCKINFO(I, 1)) - PREVPRICE(I)) 1040 CALL LOL_SLIDER(STOCKINFO(I), VAL(STOCKINFO(I, 1)) - PREVPRICE(I)) 1050 ' save the current price 1060 PREVPRICE(I) = VAL(STOCKINFO(I, 1)) 1070 NEXT I 1080 ELSE 1090 PRINT $RED; "Error reading stock info:"; %CYAN; REPORT ERROR 1100 PAUSE 1 1110 ENDIF 1120 ENDIF 1130 ENDIF 1140 ENDIF 1150 UNTIL 0 1160 END 1170 ' 1180 DEFPROC SLIDER(SHAREINFO, STATE) 1190 'Draw a border, the colour indicating good, bad and indifferent 1200 CASE STATE 1210 WHEN < 0 'Loss ( 1220 COLOR %RED 1230 WHEN > 0 1240 COLOR %GREEN 'Profit ) 1250 WHEN 0 1260 COLOR %BLUE ' Same | 1270 ENDCASE 1280 ' 1290 FILL 0, 0 TO GFX.WIDTH, 30 1300 FILL 0, GFX.HEIGHT TO GFX.WIDTH, GFX.HEIGHT - 35 1310 ' 1320 MOVE 20, GFX.HEIGHT - 20 1330 COLOR %BLACK 1340 SCALE 1 : DRAW "Day High: " + SHAREINFO(3) 1350 MOVE 20, 12 1360 DRAW "Day Low: " + SHAREINFO(4) 1370 ' 1380 'Scroll the string 1390 FOR J = GFX.WIDTH / 5 TO - 500 IN 50 1400 COLOR RGB(1, 1, 1) 1410 MOVE J, 23 1420 SCALE 5 : DRAW SHAREINFO(0) + ": " + SHAREINFO(1) + SHAREINFO(2) + "(" + STR(STATE) + ")" 1430 PAUSE 0.1 1440 COLOR RGB(0, 0, 0) 1450 SCALE 1 : FILL 0, 30 TO GFX.WIDTH, 200 1460 NEXT J 1470 ENDPROC 1480 ' 1490 DEFPROC LOL_SLIDER(SHAREINFO, STATE) 1510 FONT "6x9" 1520 FOR K = GFX.WIDTH TO - 180 STEP - 1 1550 CLG 1560 MOVE K, 8 1570 COLOR 1 : DRAW SHAREINFO(0) + ": " + SHAREINFO(1) + SHAREINFO(2) + "(" + STR(STATE) + ")" 1580 PAUSE 0.1 'quite slow as webcam doesn't work very well with LOL shield 1590 NEXT K 1610 ENDPROC
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
Untitled
Python | 13 min ago | 1.65 KB
vertical listview flutter
Dart | 24 min ago | 2.14 KB
horizontal listview flutter
Dart | 28 min ago | 5.37 KB
Untitled
JavaScript | 1 hour ago | 3.00 KB
music
JavaScript | 2 hours ago | 21.51 KB
admin music
JavaScript | 2 hours ago | 2.41 KB
Untitled
JSON | 2 hours ago | 12.82 KB
APK STRATEGI 5
C++ | 2 hours ago | 0.81 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!