budget_history.py 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. from datetime import datetime
  2. theme = {1:None}
  3. series = 'series'
  4. name = 'name'
  5. data = 'data'
  6. negativeColor = 'negativeColor'
  7. plotOptions = 'negativeColor'
  8. line = 'line'
  9. color = 'color'
  10. threshold = 'threshold'
  11. HISTORY = {
  12. series: [{ name: 'Uranium', data: [[1563306003000, 208303288], [1563304804000, 208246084], [1563303604000, 207388125], [1563302403000, 204387945], [1563301203000, 200049415], [1563300004000, 197628149], [1563298804000, 195893778], [1563297604000, 194104404], [1563296404000, 192390950], [1563295203000, 190649371], [1563294004000, 189450495], [1563289204000, 189449439], [1563280803000, 189446023], [1563276003000, 189442904], [1563272403000, 189428591], [1563271203000, 189200380], [1563270004000, 188980256], [1563268803000, 188770693], [1563267604000, 188565096], [1563266404000, 188367783], [1563265203000, 188172094], [1563264003000, 187978042], [1563262804000, 187785627], [1563261603000, 187594862], [1563260403000, 187405757], [1563259203000, 187218330], [1563258003000, 186994607], [1563256803000, 186810545], [1563255603000, 186628191], [1563254404000, 186447544], [1563253203000, 186357867], [1563252003000, 186179812], [1563250803000, 186003492], [1563249604000, 185828924], [1563248403000, 185656118], [1563247204000, 185485086], [1563246004000, 185315843], [1563244804000, 185148403], [1563243603000, 184982769], [1563242404000, 184818964], [1563241203000, 184657002], [1563240004000, 184496895], [1563238803000, 184338655], [1563237603000, 184182298], [1563236403000, 184027841], [1563235203000, 183875298], [1563234003000, 183724678], [1563232803000, 183502411], [1563231604000, 182833196], [1563226804000, 182830743], [1563219603000, 182829336], [1563218403000, 182325813], [1563217204000, 180678744], [1563216004000, 179171897], [1563214805000, 177850865], [1563213604000, 176365590], [1563212405000, 175121646], [1563211204000, 173572694], [1563210003000, 172308990], [1563208804000, 171687679], [1563205204000, 171455056], [1563204003000, 171242283], [1563202804000, 171238687], [1563201604000, 171016783], [1563199204000, 170670434], [1563198004000, 170402593], [1563194404000, 170399000], [1563193204000, 170377548], [1563192003000, 170119113], [1563188403000, 169445926], [1563178804000, 169126014], [1563134403000, 168762062], [1563133203000, 168313273], [1563132004000, 167889669], [1563130803000, 167664741], [1563129603000, 167505737], [1563128403000, 167348481], [1563127203000, 167056848], [1563126004000, 166905579], [1563124804000, 166738124], [1563123603000, 166098252], [1563122405000, 165953890], [1563121204000, 165790357], [1563120003000, 165783487], [1563118803000, 165641111], [1563117603000, 165635965], [1563109205000, 165376820], [1563108003000, 164969705], [1563100803000, 164476426], [1563097203000, 164334581], [1563074403000, 163841511], [1563063604000, 163511564], [1563054004000, 163319224], [1563052805000, 163126981], [1563051606000, 162793514], [1563050403000, 162598029], [1563049203000, 162201636], [1563046803000, 161906806], [1563040804000, 161633594], [1563039603000, 161227769], [1563034804000, 161036641], [1563033603000, 160845607], [1563032403000, 160051534], [1563030004000, 160048197], [1563028803000, 159802404], [1563026405000, 159661905], [1563025203000, 159298746], [1563019203000, 159285445], [1563001204000, 159269899], [1562980803000, 158839814], [1562978403000, 158386335], [1562977204000, 158353386], [1562972404000, 157644582], [1562970005000, 157427224], [1562966405000, 157173793], [1562965204000, 157014936], [1562961604000, 156553764], [1562960404000, 156508231], [1562955603000, 156192066], [1562953203000, 155700952], [1562948405000, 155560986], [1562947204000, 155371414], [1562946004000, 155178685], [1562944804000, 154944219], [1562941204000, 154439715], [1562936403000, 154010159], [1562935204000, 154000439], [1562934004000, 153916394], [1562932805000, 153727383], [1562931604000, 153529468], [1562930404000, 153322665], [1562928004000, 152693363], [1562926803000, 152533961], [1562914803000, 152519443], [1562910003000, 152481173], [1562908804000, 152163761], [1562896804000, 152075929], [1562895604000, 151869438], [1562894404000, 151681006], [1562893203000, 151358198], [1562884804000, 151170021], [1562883604000, 150937169], [1562880004000, 150597117], [1562877604000, 150449494], [1562876404000, 150446308], [1562875204000, 150227502], [1562870410000, 149665040], [1562869205000, 149478449], [1562868003000, 148945217], [1562865606000, 148731139], [1562859603000, 148552455], [1562858404000, 148525654], [1562857203000, 148338138], [1562856004000, 148150719], [1562854805000, 147945555], [1562851204000, 147589031], [1562845204000, 147383646], [1562839203000, 147187704], [1562836803000, 146831715], [1562833203000, 146313967], [1562830803000, 146140453], [1562829603000, 145974944], [1562828403000, 145660005], [1562814004000, 145593195], [1562810404000, 145491049], [1562804403000, 145304291], [1562803203000, 144948829], [1562790004000, 144887882], [1562768404000, 144532771], [1562755204000, 144337602], [1562754003000, 144124806], [1562750403000, 143929857], [1562749203000, 143575677], [1562737203000, 143551363], [1562719204000, 143365557], [1562718003000, 143153320], [1562715604000, 142835201], [1562707204000, 142632105], [1562620804000, 142552103], [1562602803000, 142283333], [1562601604000, 142014806], [1562600403000, 141125550], [1562599203000, 140598822], [1562598004000, 140081647], [1562596804000, 138984645], [1562595603000, 138469286], [1562594404000, 137954832], [1562593203000, 137552452], [1562592003000, 137525357], [1562584804000, 137491127], [1562582404000, 137253086], [1562578803000, 136900740], [1562574003000, 136761309], [1562571603000, 136446777], [1562564403000, 136403810], [1562547603000, 136045902], [1562546404000, 135838616], [1562539203000, 135812569], [1562533203000, 135783367], [1562532005000, 135775994], [1562530805000, 135766319], [1562528403000, 135765155], [1562524804000, 135731929], [1562523603000, 135699320], [1562522404000, 135656872], [1562518804000, 135632433], [1562517604000, 135585918], [1562511603000, 135579377], [1562506808000, 135562381], [1562504404000, 135545397], [1562503358000, 135525195], [1562503204000, 134525195], [1562502003000, 134504385], [1562497203000, 134260883], [1562493603000, 134024233], [1562488804000, 133360337], [1562487604000, 133221582], [1562470803000, 133197246], [1562467204000, 132954154], [1562461203000, 132770390], [1562460004000, 132394410], [1562458811000, 132210941], [1562457605000, 131931546], [1562449203000, 131704702], [1562446804000, 131682940], [1562444404000, 131491113], [1562443204000, 131308107], [1562442003000, 130959791], [1562437204000, 130941071], [1562430004000, 130337497], [1562428803000, 130126032], [1562424005000, 129953867], [1562418005000, 129902280], [1562416803000, 129562251], [1562415604000, 129371018], [1562414404000, 129145147], [1562412004000, 128988745], [1562409603000, 128789062], [1562408404000, 128650849], [1562406009000, 128303861], [1562396404000, 128264407], [1562377205000, 127935151], [1562373604000, 127562527], [1562371205000, 127380695], [1562370005000, 126887263], [1562366405000, 126834241], [1562365204000, 126363658], [1562364003000, 126269886], [1562362804000, 126045291], [1562359205000, 125787081], [1562356804000, 125518005], [1562355604000, 125090266], [1562354404000, 124794471], [1562353203000, 124663332], [1562352004000, 124309782], [1562350805000, 123927147], [1562349610000, 123859268], [1562348406000, 123385622], [1562347205000, 123200096], [1562346005000, 123047862], [1562344804000, 122928512], [1562343605000, 122811025], [1562342405000, 122695428], [1562341205000, 121821089], [1562340006000, 120422485], [1562338805000, 119026280], [1562337604000, 117484664], [1562336405000, 116955716], [1562335206000, 116851912], [1562334006000, 116750157], [1562332805000, 116650480], [1562331605000, 116595862], [1562330405000, 116451805], [1562329205000, 116187600], [1562328005000, 116145601], [1562324405000, 115945099], [1562323206000, 115661304], [1562322005000, 115523627], [1562320804000, 115190423], [1562316005000, 114846767], [1562312406000, 114690824], [1562307604000, 114048035], [1562290805000, 114004695], [1562289606000, 113941855], [1562284805000, 113678979], [1562282405000, 113498801], [1562281206000, 113155879], [1562278818000, 112933536], [1562274005000, 112592471], [1562272805000, 112432984], [1562271605000, 112315966], [1562270406000, 112206231], [1562269205000, 112102451], [1562268005000, 112001059], [1562266805000, 111902105], [1562265607000, 111837231], [1562264405000, 110558660], [1562263207000, 108939738], [1562262004000, 107662044], [1562260806000, 106384789], [1562259605000, 105725042], [1562253605000, 105645108], [1562252405000, 105508683], [1562251205000, 105487402], [1562250011000, 105423557], [1562247605000, 105061781], [1562246406000, 105013228], [1562245204000, 104917989], [1562244005000, 104786198], [1562242805000, 104673513], [1562241605000, 104286982], [1562240405000, 103541275], [1562239205000, 103455109], [1562238005000, 103135990], [1562236804000, 103058338], [1562235608000, 102847720], [1562234405000, 102580491], [1562232006000, 102402098], [1562230805000, 102198336], [1562227204000, 101904214], [1562224805000, 101594251], [1562220004000, 101255207], [1562187605000, 101245797], [1562181606000, 101177568], [1562180406000, 101090451], [1562178006000, 100904663], [1562176806000, 100860697], [1562174405000, 100605477], [1562120405000, 100588619], [1562109607000, 100587574], [1562108406000, 100526402], [1562107208000, 100436492], [1562106005000, 99568810], [1562104806000, 98582509], [1562103606000, 97723796], [1562102405000, 96869925], [1562101207000, 95968559], [1562100006000, 95124926], [1562098807000, 94197696], [1562097606000, 93367699]], negativeColor: '#D2361C', threshold: 0 }],
  13. plotOptions: { line: { color: theme[1] }
  14. }
  15. }
  16. HISTORY = HISTORY['series'][0]['data']
  17. HISTORY.reverse()
  18. LAST_DAY = None
  19. TEMP_MINUS = 0
  20. DAYS = {}
  21. LAST_BUDGET = HISTORY[0][1]
  22. for stat in HISTORY:
  23. date = datetime.fromtimestamp(stat[0] / 1000 - 7200)
  24. budget = stat[1]
  25. if budget - LAST_BUDGET >= 25000000000:
  26. print(date)
  27. print(budget - LAST_BUDGET)
  28. TEMP_MINUS -= budget - LAST_BUDGET
  29. if LAST_BUDGET - budget >= 1000000000:
  30. TEMP_MINUS += LAST_BUDGET - budget
  31. LAST_BUDGET = budget
  32. if date.hour == 20:
  33. formatted_date = date.strftime('%Y-%m-%d')
  34. if formatted_date not in DAYS:
  35. if LAST_DAY is not None:
  36. DAYS[formatted_date] = budget - LAST_DAY + TEMP_MINUS
  37. TEMP_MINUS = 0
  38. LAST_DAY = budget
  39. for date, balance in DAYS.items():
  40. print("{},{}".format(
  41. date,
  42. balance,
  43. ))