Skip to content

Commit 955ef66

Browse files
author
Hendrik Schicke
committed
fixed Mirror claim timezone issue
1 parent ffe2ebb commit 955ef66

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

assets/Notifications.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def generate_status_report_html(self, format, Anchor_borrow_info, Mirror_positio
118118
status_update += f'Collateral value: {(position["collateral_amount_in_kind"].__float__()/1000000):.0f} {position["collateral_token_denom"]}\n'
119119
status_update += f'Collateral value: {(position["collateral_amount_in_ust"].__float__()/1000000):.0f} UST\n'
120120
status_update += f'Shorted Value in UST: {(position["shorted_asset_amount"].__float__()/1000000):.0f} UST\n'
121-
status_update += f'Current LTV: {position["cur_col_ratio"].__float__():.0f}00 %\n'
121+
status_update += f'Current LTV: {position["cur_col_ratio"].__float__()*100:.0f} %\n'
122122
status_update += f'If all your collateral loses {(position["collateral_loss_to_liq"].__float__()*100):.0f}%\n'
123123
status_update += f'or if {position["mAsset_symbol"]} raises by {(position["shorted_mAsset_gain_to_liq"].__float__()*100):.0f}% you would get liquidated.\n'
124124
status_update += f'\n'
@@ -144,7 +144,7 @@ def generate_status_report_html(self, format, Anchor_borrow_info, Mirror_positio
144144
status_update += f'Collateral value: {(position["collateral_amount_in_kind"].__float__()/1000000):.0f} {position["collateral_token_denom"]}<br>'
145145
status_update += f'Collateral value: {(position["collateral_amount_in_ust"].__float__()/1000000):.0f} UST<br>'
146146
status_update += f'Shorted Value in UST: {(position["shorted_asset_amount"].__float__()/1000000):.0f} UST<br>'
147-
status_update += f'Current LTV: {position["cur_col_ratio"].__float__():.0f}00 %<br>'
147+
status_update += f'Current LTV: {position["cur_col_ratio"].__float__()*100:.0f} %<br>'
148148
status_update += f'If your collateral would lose {(position["collateral_loss_to_liq"].__float__()*100):.0f}%<br>'
149149
status_update += f'or if {position["mAsset_symbol"]} would raise by {(position["shorted_mAsset_gain_to_liq"].__float__()*100):.0f}% you would get liquidated.<br>'
150150
status_update += f'<br>'

assets/Queries.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,8 @@ def get_claimable_ANC(self):
364364

365365
def Mirror_get_claimable_UST(self, Mirror_position_info:list):
366366

367+
claimable = 0
368+
367369
# Input: Mirror_position_info
368370
# Output: Returns the quantity of UST that can be claimed
369371
# https://docs.mirror.finance/contracts/lock#positionlockinfo
@@ -380,13 +382,14 @@ def Mirror_get_claimable_UST(self, Mirror_position_info:list):
380382
query_result = Terra.terra.wasm.contract_query(Terra.Lock, query)
381383
locked_amount = Dec(query_result['locked_amount'])
382384
unlock_time = Dec(query_result['unlock_time'])
383-
if unlock_time < Dec(datetime.utcnow().timestamp()):
385+
now_time = Dec(datetime.now().timestamp())
386+
if unlock_time < now_time:
384387
claimable += locked_amount
385388

386389
except LCDResponseError as err:
387390
# Status code 500 means, that there is no unclaimed UST. If so, this exception can be ignored
388391
if err.response.status == 500:
389-
claimable = 0
392+
pass
390393
else:
391394
raise err
392395

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ I made the One-Stop-Bot as much configureable as possible. You can configure wha
114114
- The bot currently only supports UST, aUST and Luna as collateral on Mirror (you really should only use aUST anyway).
115115

116116
## ⚠️ Very important remarks!
117-
- This bot is quite heavy, so do not run it too short intervals. It currently has a runtime of around 1-2 min. Depending on your internet connection and how often you run it (more often, means less to do in one run, so less runtime).
117+
- This bot is quite heavy, so do not run it too short intervals. It currently has a runtime of around 1 min. Depending on your internet connection and how often you run it (more often, means less to do in one run, so less runtime).
118118
- Watch your UST balance, as this bot is doing transactions, hence drains your UST balance.
119119
- Use this bot at your own risk. I have done my best to check it, but program bugs & human bugs happen and I am not financial advisor.
120120
- This bot can be used with the Testnet. I strongly recommend playing on the Testnet or with `Disable_all_transaction_defs` set to True first, before letting it manage your funds for real. Here you can get free UST, LUNA etc: https://faucet.terra.money/.

0 commit comments

Comments
 (0)