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
An unofficial Python3.9+ package that models positions on the Alpaca Finance platform to simplify interaction with their smart contracts in your Python projects.
9
+
An unofficial Python3.9+ package that models Binance Smart Chain positions on the Alpaca Finance platform to simplify interaction with their smart contracts in your Python projects.
10
10
</p>
11
11
<h3><strong>Supported Position Types</strong></h3>
12
12
<i>Automated Vaults</i><br>
13
13
</div>
14
14
<br>
15
15
16
-
> NOTE: Codebase is currently in development and incomplete
16
+
> NOTE: Existing users please update to the latest version of the package before using, core functionality has changed in version 1+.
17
17
18
18
<!-- TABLE OF CONTENTS -->
19
19
### Table of Contents
@@ -36,8 +36,7 @@ This package is set up to be installed using the `pip` package manager.
***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)
39
+
<!-- ***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) -->
41
40
42
41
2. After install, the package will be available to you in your local Python environment as ***alpaca_finance***
43
42
@@ -47,7 +46,9 @@ ___
47
46
48
47
## Usage
49
48
50
-
How to use the package:
49
+
How to use the package
50
+
51
+
### Automated Vaults:
51
52
52
53
1. Import the package into your Python script:
53
54
```python
@@ -61,8 +62,6 @@ How to use the package:
61
62
provider = get_web3_provider("your_rpc_url")
62
63
```
63
64
64
-
### Automated Vaults:
65
-
66
65
3. Creating an [AutomatedVaultPosition](alpaca_finance/automated_vault/positions.py) instance requires the following:
67
66
- Your position key (string)
68
67
- This key should match your position key on Alpaca Finance's webapp
@@ -78,32 +77,73 @@ How to use the package:
78
77
position = AutomatedVaultPosition(position_key="n3x-BNBBUSD-PCS1", owner_wallet_address="0x...", owner_private_key="123abc456efg789hij...")
79
78
```
80
79
4. Use your position instance to interact with Alpaca Finance:
81
-
```python
80
+
- For reference, see the BEP20Token class [documentation](https://github.com/hschickdevs/Python-BEP20-Token/blob/main/bep20/token.py)
81
+
- Please view the **usage examples** under [examples/automated_vault](examples/automated_vault)
82
+
```python
82
83
""" Informational Methods (Private Key not Required) """
83
84
85
+
# Get the asset token or stable token for the vault (BEP20Token object)
86
+
position.asset_token, position.stable_token
87
+
88
+
84
89
# Get the current yields for the vault:
85
90
position.yields()
86
91
92
+
87
93
# Get the current vault TVL:
88
94
position.tvl()
89
95
96
+
90
97
# Get the current vault capacity:
91
98
position.capacity()
92
99
100
+
93
101
# Get the position's cost basis (entry price in USD):
94
102
position.cost_basis()
95
103
104
+
96
105
# Get the current position value (in USD):
97
106
position.current_value()
98
107
108
+
99
109
# Get the position profit/loss (PnL in USD):
100
110
position.pnl()
101
111
112
+
102
113
# Get the amount of shares held and the USD value of all shares held:
103
114
position.shares()
104
115
116
+
105
117
# get the full vault summary (See the documentation alpaca_fiance/position.py for more details):
0 commit comments