aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-04-21 10:44:16 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-04-21 10:44:16 +0200
commit17fd3f752d5e37df906abddf1f13fd7ad1de6c00 (patch)
treeaa2db0ed93d6103bd2f59d7a8c183c32e4a55a85
parentc5ca26b83ca9f120fb39f1e61265216342f8a4db (diff)
downloadTrader-17fd3f752d5e37df906abddf1f13fd7ad1de6c00.tar.gz
Trader-17fd3f752d5e37df906abddf1f13fd7ad1de6c00.tar.zst
Trader-17fd3f752d5e37df906abddf1f13fd7ad1de6c00.zip
Add latest date to redis
-rw-r--r--market.py2
-rw-r--r--tests/test_market.py1
2 files changed, 3 insertions, 0 deletions
diff --git a/market.py b/market.py
index ce0c48c..ce41841 100644
--- a/market.py
+++ b/market.py
@@ -85,6 +85,8 @@ class Market:
85 conn.set(key, log, ex=31*24*60*60) 85 conn.set(key, log, ex=31*24*60*60)
86 key = "/cryptoportfolio/{}/latest/{}".format(self.market_id, type_) 86 key = "/cryptoportfolio/{}/latest/{}".format(self.market_id, type_)
87 conn.set(key, log) 87 conn.set(key, log)
88 key = "/cryptoportfolio/{}/latest/date".format(self.market_id)
89 conn.set(key, date.isoformat())
88 except Exception as e: 90 except Exception as e:
89 print("impossible to store report to redis: {}; {}".format(e.__class__.__name__, e)) 91 print("impossible to store report to redis: {}; {}".format(e.__class__.__name__, e))
90 92
diff --git a/tests/test_market.py b/tests/test_market.py
index e3482b8..e0cf70a 100644
--- a/tests/test_market.py
+++ b/tests/test_market.py
@@ -550,6 +550,7 @@ class MarketTest(WebMockTestCase):
550 mock.call.set("/cryptoportfolio/1/latest/type1", "payload1"), 550 mock.call.set("/cryptoportfolio/1/latest/type1", "payload1"),
551 mock.call.set("/cryptoportfolio/1/2018-03-24T00:00:00/type2", "payload2", ex=31*24*60*60), 551 mock.call.set("/cryptoportfolio/1/2018-03-24T00:00:00/type2", "payload2", ex=31*24*60*60),
552 mock.call.set("/cryptoportfolio/1/latest/type2", "payload2"), 552 mock.call.set("/cryptoportfolio/1/latest/type2", "payload2"),
553 mock.call.set("/cryptoportfolio/1/latest/date", "2018-03-24T00:00:00"),
553 ]) 554 ])
554 555
555 connect_mock.reset_mock() 556 connect_mock.reset_mock()