Skip to content

Instantly share code, notes, and snippets.

@aeron7
Created February 17, 2019 21:24
Show Gist options
  • Save aeron7/8e92ea2a187745b3b7fa2628e255b83a to your computer and use it in GitHub Desktop.
Save aeron7/8e92ea2a187745b3b7fa2628e255b83a to your computer and use it in GitHub Desktop.
Code for Dynamic Heatmap as described in Unofficed
f.write("<table><tbody><tr>")
i,j,k=0,0,0
for x in range(i, endp):
symbol = positions['data'][x]['symbol']
value = float(positions['data'][x]['per'])
if (i!=0 and i%13 == 0) : f.write("</tr><tr>")
if value >= 0 : f.write('<td style="background: '+str(positive_colors[j])+'; ">'+symbol+'<div class="per">'+str(value)+'%<div></td>')
j = j+1
else :
f.write('<td style="background: '+str(negative_colors[k])+'; ">'+symbol+'<div class="per">'+str(value)+'%<div></td>')
k=k+1
i=i+1
f.write("</tr></tbody></table>")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment