-
Notifications
You must be signed in to change notification settings - Fork 5
/
get_gmx_stats.py
137 lines (105 loc) · 3.39 KB
/
get_gmx_stats.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
from utils import _set_paths
_set_paths()
from gmx_python_sdk.scripts.v2.get.get_available_liquidity import (
GetAvailableLiquidity
)
from gmx_python_sdk.scripts.v2.get.get_borrow_apr import GetBorrowAPR
from gmx_python_sdk.scripts.v2.get.get_claimable_fees import GetClaimableFees
from gmx_python_sdk.scripts.v2.get.get_contract_balance import (
GetPoolTVL as ContractTVL
)
from gmx_python_sdk.scripts.v2.get.get_funding_apr import GetFundingFee
from gmx_python_sdk.scripts.v2.get.get_gm_prices import GMPrices
from gmx_python_sdk.scripts.v2.get.get_markets import Markets
from gmx_python_sdk.scripts.v2.get.get_open_interest import OpenInterest
from gmx_python_sdk.scripts.v2.get.get_oracle_prices import OraclePrices
from gmx_python_sdk.scripts.v2.get.get_pool_tvl import GetPoolTVL
from gmx_python_sdk.scripts.v2.gmx_utils import ConfigManager
class GetGMXv2Stats:
def __init__(self, config, to_json, to_csv):
self.config = config
self.to_json = to_json
self.to_csv = to_csv
def get_available_liquidity(self):
return GetAvailableLiquidity(
self.config
).get_data(
to_csv=self.to_csv,
to_json=self.to_json
)
def get_borrow_apr(self):
return GetBorrowAPR(
self.config
).get_data(
to_csv=self.to_csv,
to_json=self.to_json
)
def get_claimable_fees(self):
return GetClaimableFees(
self.config
).get_data(
to_csv=self.to_csv,
to_json=self.to_json
)
def get_contract_tvl(self):
return ContractTVL(
self.config
).get_pool_balances(
to_json=self.to_json
)
def get_funding_apr(self):
return GetFundingFee(
self.config
).get_data(
to_csv=self.to_csv,
to_json=self.to_json
)
def get_gm_price(self):
return GMPrices(
self.config
).get_price_traders(
to_csv=self.to_csv,
to_json=self.to_json
)
def get_available_markets(self):
return Markets(
self.config
).get_available_markets()
def get_open_interest(self):
return OpenInterest(
self.config
).get_data(
to_csv=self.to_csv,
to_json=self.to_json
)
def get_oracle_prices(self):
return OraclePrices(
self.config.chain
).get_recent_prices()
def get_pool_tvl(self):
return GetPoolTVL(
self.config
).get_pool_balances(
to_csv=self.to_csv,
to_json=self.to_json
)
if __name__ == "__main__":
to_json = True
to_csv = True
config = ConfigManager(chain='avalanche')
config.set_config()
stats_object = GetGMXv2Stats(
config=config,
to_json=to_json,
to_csv=to_csv
)
markets = stats_object.get_available_markets()
liquidity = stats_object.get_available_liquidity()
borrow_apr = stats_object.get_borrow_apr()
claimable_fees = stats_object.get_claimable_fees()
contract_tvl = stats_object.get_contract_tvl()
funding_apr = stats_object.get_funding_apr()
gm_prices = stats_object.get_gm_price()
open_interest = stats_object.get_open_interest()
oracle_prices = stats_object.get_oracle_prices()
pool_tvl = stats_object.get_pool_tvl()