Skip to content

Instantly share code, notes, and snippets.

@samescolas
Created March 9, 2017 20:23
Show Gist options
  • Save samescolas/06f202108727fa8eb2852fde1ed478b9 to your computer and use it in GitHub Desktop.
Save samescolas/06f202108727fa8eb2852fde1ed478b9 to your computer and use it in GitHub Desktop.
t time
fig = plt.figure()
ax1 = fig.add_subplot(1, 1, 1)
ax1.axis([0,100,130,150])
def animate(i):
getData = open("data.txt", "r").read()
arr = getData.split('\n')
xar = []
yar = []
for line in arr:
if len(line) > 1:
x,y = line.split(',')
xar.append(float(x))
yar.append(float(y))
ax1.clear()
if (len(xar) < 100):
ax1.axis([0, 100, min(yar) - .1, max(yar) + .1])
else:
ax1.axis([0,xar[-1],min(yar) - .1,max(yar) + .1])
ax1.plot(xar, yar)
ani = animation.FuncAnimation(fig, animate, interval=1000)
plt.show()
### shell script
function AAPL { curl -s "https://api.robinhood.com/quotes/AAPL/" };
i=0;
AAPL
while true;
do
a=($i,$(python robinhood.py $(AAPL) last_trade_price))
echo $a >> data.txt
i=$((i+1));
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment