Skip to content

Instantly share code, notes, and snippets.

@aeron7
Created February 17, 2019 21:24

Revisions

  1. aeron7 created this gist Feb 17, 2019.
    14 changes: 14 additions & 0 deletions dynamic-heatmap-loop.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    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>")