You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -33,38 +39,37 @@ This package is set up to be installed using the `pip` package manager.
33
39
34
40
1. Ensure that you have Python 3.9+ installed. If not, you can download [here](https://www.python.org/downloads/release/python-3912/). The syntax is dependent on features added in this recent version.
35
41
36
-
2. Install the package using pip (you must use the git+url as this project is private and not listed on PyPi):
***Note:*** You may need to provide your git credentials depending on the repository privacy settings. In the event, if you need help generating a personal access token see [here](https://catalyst.zoho.com/help/tutorials/githubbot/generate-access-token.html)
42
-
43
-
3. After install, the package will be available to you in your local Python environment as ***alpha_homora_v2***
47
+
3. After install, the package will be available to you in your local Python environment as ***alpha-homora-v2***
44
48
45
49
When updates are made to the package, the version will automatically be incremented so that in order to get the newest version on your end, you can simply use the same installation command and your pip will detect and update to the newest version.
46
50
47
51
## Usage
48
52
49
53
How to use the package:
50
54
51
-
### For Avalanche Positions:
55
+
### Avalanche:
52
56
53
-
1. Import the package into your Python script:
57
+
1. Import the AvalanchePosition class into your Python script:
54
58
```python
55
-
from alpha_homora_v2.util import get_web3_provider
56
-
from alpha_homora_v2.position import AvalanchePosition
59
+
from alpha_homora_v2 import AvalanchePosition
57
60
```
58
61
59
-
2. **(Optional)**Create your Web3 provider object to interact with the network:
62
+
2. **(Optional)**Instantiate your custom Web3 provider object to interact with the network:
60
63
```python
64
+
from alpha_homora_v2.util import get_web3_provider
65
+
61
66
NETWORK_RPC_URL = "your_rpc_url"
62
67
provider = get_web3_provider(NETWORK_RPC_URL)
63
68
```
64
69
3. Creating an [AvalanchePosition](alpha_homora_v2/position.py) instance requires the following:
65
70
- Your position ID (an integer)
66
71
- This ID should match your position on Alpha Homora, without the "#"
# NOTE: Passing the private key is optional, but required if you want to use transactional methods on the returned AvalanchePosition object(s).
103
108
```
104
109
5. Use your position instance(s) to interact with the Alpha Homora V2 position smart contracts on the network:
110
+
- Transactional Methods:
111
+
- Return a [TransactionReceipt](alpha_homora_v2/receipt.py) object upon success
112
+
- Private wallet key ***required***for use to sign transactions
113
+
- See the documentation in the [AvalanchePosition](alpha_homora_v2/position.py) class forfunctionparameters.
114
+
```python
115
+
# Add liquidity to the LP
116
+
position.add(params)
117
+
118
+
# Remove liquidity from the LP
119
+
position.remove(params)
120
+
121
+
# Harvest available rewards:
122
+
position.harvest()
123
+
124
+
# Close the position:
125
+
position.close()
126
+
```
105
127
- Informational Methods
106
128
- Return JSON data
107
129
- Private wallet key ***not required***for use
130
+
- See [`examples/position_info.ipynb`](https://github.com/PathX-Projects/Alpha-Homora-V2-Python/blob/development/examples/avalanche/position_info.ipynb) for output examples.
108
131
```python
132
+
# Get position value (equity, debt, and position value):
133
+
position.get_position_value()
134
+
109
135
# Get value of harvestable rewards:
110
136
position.get_rewards_value()
111
137
@@ -115,25 +141,23 @@ How to use the package:
115
141
# Get the current leverage ratio:
116
142
position.get_leverage_ratio()
117
143
118
-
# Get position value (equity, debt, and position value):
119
-
position.get_position_value()
120
-
121
-
# (WIP) Get current pool APY (Only returns trading and farmng APY)
144
+
# Get current pool APY
122
145
position.get_current_apy()
123
146
147
+
# Get underlying tokens and LP for the pool:
148
+
position.get_pool_tokens()
149
+
150
+
# Get the debt of each token in the position (token, debt_uint256, debt_token, debt_usd):
151
+
position.get_tokens_debts()
152
+
# Alternatively, get the debt of a single token:
153
+
position.get_token_debts(token_address)
154
+
155
+
# Get all token borrow rates from CREAM:
156
+
position.get_cream_borrow_rates()
157
+
124
158
# get LP pool info:
125
159
position.pool
126
160
```
127
-
- Transactional Methods:
128
-
- Return a [TransactionReceipt](alpha_homora_v2/receipt.py) object upon success
129
-
- Private wallet key ***required***for use to sign transactions
0 commit comments