Last active
July 31, 2022 18:48
-
-
Save banteg/93808e6c0f1b9b6b470beaba5a140813 to your computer and use it in GitHub Desktop.
boilerplate makerdao auction keeper model using python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import sys | |
import json | |
import requests | |
discount = 0.15 | |
def get_price(): | |
resp = requests.get('https://api.coingecko.com/api/v3/simple/price', params={'ids': 'ethereum', 'vs_currencies': 'usd'}) | |
return resp.json()['ethereum']['usd'] | |
for line in sys.stdin: | |
signal = json.loads(line) | |
if signal['guy'] == os.environ['ACCOUNT_ADDRESS']: | |
continue | |
oracle = get_price() | |
stance = {'price': oracle * (1 - discount)} | |
print(json.dumps(stance), flush=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment