Skip to content

Instantly share code, notes, and snippets.

@staccDOTsol
Created August 18, 2020 22:33
Show Gist options
  • Save staccDOTsol/247820d932c84ac40c4be4124e6b84c4 to your computer and use it in GitHub Desktop.
Save staccDOTsol/247820d932c84ac40c4be4124e6b84c4 to your computer and use it in GitHub Desktop.
markets = client.get_perpetual_markets()
syms = []
rates = []
for m in markets['markets']:
#if m['market'] == 'WETH-PUSD':
syms.append(m['market'])
rate = round(float(m['fundingRate']) * 8*60*60*100*3 * 10000)/ 10000
# print(m['market'] + ' daily funding rate: ' + str(rate) + '%')
rates.append(rate)
t = 0
c = 0
for r in rates:
t = t + r
c = c + 1
avg = t / c
print('avg opp: ' + str(avg) + '%')
percs = {}
c = -1
for r in rates:
c = c + 1
percs[syms[c]] = round((r/t*100)*10000)/10000
print('\npercents of opps out of total opps:')
print(percs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment