Skip to content

Instantly share code, notes, and snippets.

@michaelneuder
Last active April 14, 2023 21:21
Show Gist options
  • Save michaelneuder/703a33faab34654e5fa14f87d2ca38c0 to your computer and use it in GitHub Desktop.
Save michaelneuder/703a33faab34654e5fa14f87d2ca38c0 to your computer and use it in GitHub Desktop.
get slots
res = []
for s in t['jsonPayload.slot']:
time.sleep(0.1)
url = 'http://57.128.92.65:3500/eth/v1/beacon/headers/{}'.format(s)
headers = {'content-type': 'application/json'}
r = requests.get(url, headers=headers)
try:
code = r.json()['code']
print(s, False)
res.append((s, False))
except KeyError:
print(s, True)
res.append((s, True))
res = np.asarray(res)
missed = np.asarray([v[0] for v in res if v[1] == 0])
dlvd['inserted_at'] = pd.to_datetime(dlvd['inserted_at'], format="%Y-%m-%d%H:%M:%S.%f")
dlvd['slot_boundary'] = np.asarray([pd.Timestamp(x).round(freq='12S') - pd.Timedelta('1s') for x in dlvd['inserted_at'].values])
gp = gp.sort_values('msIntoSlot', ascending=True).drop_duplicates('slot').sort_index()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment