avantis-trader-sdk 0.3.1__py3-none-any.whl → 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- avantis_trader_sdk/rpc/fee_parameters.py +38 -20
- {avantis_trader_sdk-0.3.1.dist-info → avantis_trader_sdk-0.4.0.dist-info}/METADATA +2 -2
- {avantis_trader_sdk-0.3.1.dist-info → avantis_trader_sdk-0.4.0.dist-info}/RECORD +5 -5
- {avantis_trader_sdk-0.3.1.dist-info → avantis_trader_sdk-0.4.0.dist-info}/WHEEL +0 -0
- {avantis_trader_sdk-0.3.1.dist-info → avantis_trader_sdk-0.4.0.dist-info}/top_level.txt +0 -0
|
@@ -75,28 +75,19 @@ class FeeParametersRPC:
|
|
|
75
75
|
is_long: Optional[bool] = None,
|
|
76
76
|
pair_index: int = None,
|
|
77
77
|
pair: str = None,
|
|
78
|
-
trade_input: TradeInput = None,
|
|
79
78
|
):
|
|
80
79
|
"""
|
|
81
|
-
Retrieves the opening fee for all trading pairs.
|
|
80
|
+
Retrieves the opening fee for all trading pairs in bps.
|
|
82
81
|
|
|
83
82
|
Args:
|
|
84
83
|
is_long: A boolean indicating if the position is a buy or sell. Defaults to None. If None, the opening fee for both buy and sell will be returned.
|
|
85
84
|
position_size: The size of the position (collateral * leverage). Supports upto 6 decimals. Defaults to 0.
|
|
86
85
|
pair_index: The pair index for which the opening fee is to be calculated. Defaults to None. If None, the opening fee for all trading pairs will be returned.
|
|
87
86
|
pair: The trading pair for which the opening fee is to be calculated. Defaults to None. If None, the opening fee for all trading pairs will be returned.
|
|
88
|
-
trade_input: The trade input object. Defaults to None. If provided, the pair index will be extracted from the trade input.
|
|
89
87
|
|
|
90
88
|
Returns:
|
|
91
|
-
A Fee instance containing the opening Fee for each trading pair in bps
|
|
89
|
+
A Fee instance containing the opening Fee for each trading pair in bps.
|
|
92
90
|
"""
|
|
93
|
-
if trade_input is not None:
|
|
94
|
-
position_size = (
|
|
95
|
-
trade_input.positionSizeUSDC / 10**6 * trade_input.leverage / 10**10
|
|
96
|
-
)
|
|
97
|
-
pair_index = trade_input.pairIndex
|
|
98
|
-
is_long = trade_input.buy
|
|
99
|
-
|
|
100
91
|
position_size = int(position_size * 10**6)
|
|
101
92
|
|
|
102
93
|
Multicall = self.client.contracts.get("Multicall")
|
|
@@ -204,16 +195,43 @@ class FeeParametersRPC:
|
|
|
204
195
|
],
|
|
205
196
|
)
|
|
206
197
|
return Fee(short=decoded_response)
|
|
207
|
-
elif trade_input is not None:
|
|
208
|
-
referral_rebate_percentage = await self.client.trading_parameters.get_trade_referral_rebate_percentage(
|
|
209
|
-
trade_input.trader
|
|
210
|
-
)
|
|
211
|
-
referral_rebate_percentage = 1 - (referral_rebate_percentage / 100)
|
|
212
|
-
return round(
|
|
213
|
-
response / 10**12 * position_size / 10**6 * referral_rebate_percentage,
|
|
214
|
-
18,
|
|
215
|
-
)
|
|
216
198
|
elif is_long:
|
|
217
199
|
return Fee(long={pair: response / 10**10 * 100})
|
|
218
200
|
else:
|
|
219
201
|
return Fee(short={pair: response / 10**10 * 100})
|
|
202
|
+
|
|
203
|
+
async def get_new_trade_opening_fee(
|
|
204
|
+
self,
|
|
205
|
+
trade_input: TradeInput,
|
|
206
|
+
):
|
|
207
|
+
"""
|
|
208
|
+
Retrieves the opening fee for a trade with referral rebate in USDC.
|
|
209
|
+
|
|
210
|
+
Args:
|
|
211
|
+
trade_input: The trade input object.
|
|
212
|
+
|
|
213
|
+
Returns:
|
|
214
|
+
Final opening fee in USDC
|
|
215
|
+
"""
|
|
216
|
+
position_size = (
|
|
217
|
+
trade_input.positionSizeUSDC / 10**6 * trade_input.leverage / 10**10
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
position_size = int(position_size * 10**6)
|
|
221
|
+
|
|
222
|
+
PriceAggregator = self.client.contracts.get("PriceAggregator")
|
|
223
|
+
|
|
224
|
+
response = await PriceAggregator.functions.openFeeP(
|
|
225
|
+
trade_input.pairIndex, position_size, trade_input.buy
|
|
226
|
+
).call()
|
|
227
|
+
|
|
228
|
+
referral_rebate_percentage = (
|
|
229
|
+
await self.client.trading_parameters.get_trade_referral_rebate_percentage(
|
|
230
|
+
trade_input.trader
|
|
231
|
+
)
|
|
232
|
+
)
|
|
233
|
+
referral_rebate_percentage = 1 - (referral_rebate_percentage / 100)
|
|
234
|
+
return round(
|
|
235
|
+
response / 10**12 * position_size / 10**6 * referral_rebate_percentage,
|
|
236
|
+
18,
|
|
237
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: avantis-trader-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: SDK for interacting with Avantis trading contracts.
|
|
5
5
|
Home-page: https://avantisfi.com/
|
|
6
6
|
Author: Avantis Labs
|
|
@@ -70,7 +70,7 @@ To get started with the Avantis Trader SDK, follow these steps to install the pa
|
|
|
70
70
|
2. Install the SDK using pip:
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
|
-
pip install avantis-trader-sdk
|
|
73
|
+
pip install avantis-trader-sdk
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
or
|
|
@@ -200,7 +200,7 @@ avantis_trader_sdk/rpc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
200
200
|
avantis_trader_sdk/rpc/asset_parameters.py,sha256=OkGyfSmiCUl7fgJaUJFQekpQ8o2_JbbSwh1gWAXdZKY,19717
|
|
201
201
|
avantis_trader_sdk/rpc/blended.py,sha256=UHgrPEvkJwQJRxTrVG03Ir8IjJRGenQFov1bJvbuGi4,2512
|
|
202
202
|
avantis_trader_sdk/rpc/category_parameters.py,sha256=yw-6Ib1kS25JTmZQzH7Xyn1dehUqGYBoZM_bO7G4lEE,8181
|
|
203
|
-
avantis_trader_sdk/rpc/fee_parameters.py,sha256=
|
|
203
|
+
avantis_trader_sdk/rpc/fee_parameters.py,sha256=EhJY7I66MAP_sClVhSy6KBiicpeEip5EXrIlpfbVSDM,9369
|
|
204
204
|
avantis_trader_sdk/rpc/pairs_cache.py,sha256=CxaZKNv38AW90oINcJdG7QVGfOVYEiTWSV_vtdQ570M,4066
|
|
205
205
|
avantis_trader_sdk/rpc/rpc_helpers.py,sha256=d3dzwEaAUVo700qK7S-bBSVX3UtrOKbPEGPqgxHS5sk,292
|
|
206
206
|
avantis_trader_sdk/rpc/snapshot.py,sha256=2EMtNqfeB37dr4EsuSMBm0CAYbwWMv9evML8MZocNFw,5494
|
|
@@ -212,7 +212,7 @@ avantis_trader_sdk/signers/kms_signer.py,sha256=lxK3f9KQsdCDAvOE1SHleKjI8zD_3PTv
|
|
|
212
212
|
avantis_trader_sdk/signers/local_signer.py,sha256=kUx5vExiBfvFGmoMCFR6b7_4cXx2mvYOJNqZQDIEcG8,505
|
|
213
213
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
214
214
|
tests/test_client.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
215
|
-
avantis_trader_sdk-0.
|
|
216
|
-
avantis_trader_sdk-0.
|
|
217
|
-
avantis_trader_sdk-0.
|
|
218
|
-
avantis_trader_sdk-0.
|
|
215
|
+
avantis_trader_sdk-0.4.0.dist-info/METADATA,sha256=IViGMWDcSs2vZHlLbhA9bk72mpdqaUSBkX0oQK1eflI,4916
|
|
216
|
+
avantis_trader_sdk-0.4.0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
217
|
+
avantis_trader_sdk-0.4.0.dist-info/top_level.txt,sha256=XffaQJ68SGT1KUz2HHXSGSEsmNy8-AGjgtO127xhzQA,25
|
|
218
|
+
avantis_trader_sdk-0.4.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|