Skip to content

Instantly share code, notes, and snippets.

@banteg
Last active July 31, 2022 18:48
Show Gist options
  • Save banteg/93808e6c0f1b9b6b470beaba5a140813 to your computer and use it in GitHub Desktop.
Save banteg/93808e6c0f1b9b6b470beaba5a140813 to your computer and use it in GitHub Desktop.
boilerplate makerdao auction keeper model using python
#!/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