ostium-python-sdk 2.0.13__tar.gz → 2.0.15__tar.gz
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.
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/PKG-INFO +16 -2
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/README.md +15 -1
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/formulae_wrapper.py +8 -5
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/price.py +2 -2
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/sdk.py +2 -2
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk.egg-info/PKG-INFO +16 -2
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/setup.py +1 -1
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/MANIFEST.in +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/__init__.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/__init__.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/faucet_testnet_abi.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/pairs_info_abi.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/pairs_storage_abi.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/trading_abi.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/trading_storage_abi.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/usdc_abi.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/vault_abi.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/balance.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/config.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/constants.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/exceptions.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/faucet.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/formulae.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/ostium.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/scscript/__init__.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/scscript/funding.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/scscript/pairinfos.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/subgraph.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/utils.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk.egg-info/SOURCES.txt +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk.egg-info/dependency_links.txt +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk.egg-info/requires.txt +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk.egg-info/top_level.txt +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/pyproject.toml +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/requirements-dev.txt +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/requirements.txt +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/setup.cfg +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/__init__.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/conftest.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/disabled_test_funding.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/disabled_test_slippage.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_current_total_profit_p.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_current_total_profit_raw.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_current_trade_profit_p.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_current_trade_profit_raw.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_get_opening_fee.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_get_pending_acc_funding_fees.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_get_price_impact.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_get_trade_funding_fee.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_get_trade_rollover_fee.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_get_trade_value.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_max_leverage.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_overnight_max_leverage.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_remove_collateral_from_leverage.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_remove_collateral_with_collateral.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_target_funding_rate.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_top_up_with_collateral.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_top_up_with_leverage.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_trade_get_sl_price.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_trade_get_tp_price.py +0 -0
- {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_trade_liquidation_price.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ostium-python-sdk
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.15
|
|
4
4
|
Summary: A python based SDK developed for interacting with Ostium, a leveraged trading application for trading currencies, commodities, indices, crypto and more.
|
|
5
5
|
Home-page: https://github.com/0xOstium/ostium-python-sdk
|
|
6
6
|
Author: ami@ostium.io
|
|
@@ -235,7 +235,7 @@ The intraction with Ostium platform is denoted with pair_id and trade_index.
|
|
|
235
235
|
|
|
236
236
|
## List of available pairs (Mainnet)
|
|
237
237
|
|
|
238
|
-
- As of
|
|
238
|
+
- As of May 2025, the following pairs are available on the mainnet:
|
|
239
239
|
|
|
240
240
|
| ID | Trading Pair | Description |
|
|
241
241
|
|----|--------------|--------------------------------|
|
|
@@ -250,6 +250,20 @@ The intraction with Ostium platform is denoted with pair_id and trade_index.
|
|
|
250
250
|
| 8 | XAG-USD | Silver |
|
|
251
251
|
| 9 | SOL-USD | Solana |
|
|
252
252
|
| 10 | SPX-USD | S&P 500 Index |
|
|
253
|
+
| 11 | DJI-USD | Dow Jones Industrial Average |
|
|
254
|
+
| 12 | NDX-USD | NASDAQ-100 Index |
|
|
255
|
+
| 13 | NIK-JPY | Nikkei 225 Index |
|
|
256
|
+
| 14 | FTSE-GBP | FTSE 100 Index |
|
|
257
|
+
| 15 | DAX-EUR | DAX Index |
|
|
258
|
+
| 16 | USD-CAD | US Dollar to Canadian Dollar |
|
|
259
|
+
| 17 | USD-MXN | US Dollar to Mexican Peso |
|
|
260
|
+
| 18 | NVDA-USD | NVIDIA Stock |
|
|
261
|
+
| 19 | GOOG-USD | Alphabet (Google) Stock |
|
|
262
|
+
| 20 | AMZN-USD | Amazon Stock |
|
|
263
|
+
| 21 | META-USD | Meta (Facebook) Stock |
|
|
264
|
+
| 22 | TSLA-USD | Tesla Stock |
|
|
265
|
+
| 23 | AAPL-USD | Apple Stock |
|
|
266
|
+
| 24 | MSFT-USD | Microsoft Stock |
|
|
253
267
|
|
|
254
268
|
## Usage Examples
|
|
255
269
|
|
|
@@ -196,7 +196,7 @@ The intraction with Ostium platform is denoted with pair_id and trade_index.
|
|
|
196
196
|
|
|
197
197
|
## List of available pairs (Mainnet)
|
|
198
198
|
|
|
199
|
-
- As of
|
|
199
|
+
- As of May 2025, the following pairs are available on the mainnet:
|
|
200
200
|
|
|
201
201
|
| ID | Trading Pair | Description |
|
|
202
202
|
|----|--------------|--------------------------------|
|
|
@@ -211,6 +211,20 @@ The intraction with Ostium platform is denoted with pair_id and trade_index.
|
|
|
211
211
|
| 8 | XAG-USD | Silver |
|
|
212
212
|
| 9 | SOL-USD | Solana |
|
|
213
213
|
| 10 | SPX-USD | S&P 500 Index |
|
|
214
|
+
| 11 | DJI-USD | Dow Jones Industrial Average |
|
|
215
|
+
| 12 | NDX-USD | NASDAQ-100 Index |
|
|
216
|
+
| 13 | NIK-JPY | Nikkei 225 Index |
|
|
217
|
+
| 14 | FTSE-GBP | FTSE 100 Index |
|
|
218
|
+
| 15 | DAX-EUR | DAX Index |
|
|
219
|
+
| 16 | USD-CAD | US Dollar to Canadian Dollar |
|
|
220
|
+
| 17 | USD-MXN | US Dollar to Mexican Peso |
|
|
221
|
+
| 18 | NVDA-USD | NVIDIA Stock |
|
|
222
|
+
| 19 | GOOG-USD | Alphabet (Google) Stock |
|
|
223
|
+
| 20 | AMZN-USD | Amazon Stock |
|
|
224
|
+
| 21 | META-USD | Meta (Facebook) Stock |
|
|
225
|
+
| 22 | TSLA-USD | Tesla Stock |
|
|
226
|
+
| 23 | AAPL-USD | Apple Stock |
|
|
227
|
+
| 24 | MSFT-USD | Microsoft Stock |
|
|
214
228
|
|
|
215
229
|
## Usage Examples
|
|
216
230
|
|
|
@@ -124,7 +124,7 @@ def get_trade_metrics(trade_details, price_data, block_number, pair_max_leverage
|
|
|
124
124
|
Decimal(trade_details['collateral']) / PRECISION_6
|
|
125
125
|
)
|
|
126
126
|
|
|
127
|
-
# Calculate total profit
|
|
127
|
+
# Calculate total profit
|
|
128
128
|
total_profit_raw = CurrentTotalProfitRaw(
|
|
129
129
|
Decimal(trade_details['openPrice']) / PRECISION_18,
|
|
130
130
|
Decimal(price_after_impact) / PRECISION_18,
|
|
@@ -144,7 +144,7 @@ def get_trade_metrics(trade_details, price_data, block_number, pair_max_leverage
|
|
|
144
144
|
pnl = Decimal(pnl_raw)
|
|
145
145
|
pnl_percent = Decimal(pnl_percent_raw)
|
|
146
146
|
net_pnl = Decimal(total_profit_raw)
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
funding = Decimal(trade_funding_fee)
|
|
149
149
|
rollover = Decimal(trade_rollover_fee)
|
|
150
150
|
net_value = net_pnl + (Decimal(trade_details['collateral']) / PRECISION_6)
|
|
@@ -155,9 +155,12 @@ def get_trade_metrics(trade_details, price_data, block_number, pair_max_leverage
|
|
|
155
155
|
'pnl_percent': float(pnl_percent),
|
|
156
156
|
'rollover': float(rollover),
|
|
157
157
|
'funding': float(funding),
|
|
158
|
-
'
|
|
159
|
-
'net_pnl': float(net_pnl), # same as total_profit
|
|
158
|
+
'net_pnl': float(net_pnl), # pnl without ff, if any
|
|
160
159
|
'net_value': float(net_value),
|
|
161
160
|
'liquidation_price': float(trade_liquidation_price),
|
|
162
|
-
'price_impact': float(price_impact)
|
|
161
|
+
'price_impact': float(price_impact),
|
|
162
|
+
'is_market_open': price_data['isMarketOpen'],
|
|
163
|
+
'bid': price_data['bid'],
|
|
164
|
+
'mid': price_data['mid'],
|
|
165
|
+
'ask': price_data['ask'],
|
|
163
166
|
}
|
|
@@ -24,8 +24,8 @@ class Price:
|
|
|
24
24
|
raise Exception(
|
|
25
25
|
f"Failed to fetch prices: {response.status}")
|
|
26
26
|
|
|
27
|
-
# Returns a json, e.g: {'feed_id': '0x00039d9e45394f473ab1f050a1b963e6b05351e52d71e507509ada0c95ed75b8', 'bid':
|
|
28
|
-
async def get_latest_price_json(self, from_asset: str, to_asset: str)
|
|
27
|
+
# Returns a json, e.g: {'feed_id': '0x00039d9e45394f473ab1f050a1b963e6b05351e52d71e507509ada0c95ed75b8', 'bid': 107646.01338169997, 'mid': 107646.03680130735, 'ask': 107646.06022091472, 'isMarketOpen': True, 'isDayTradingClosed': False, 'secondsToToggleIsDayTradingClosed': -1, 'from': 'BTC', 'to': 'USD', 'timestampSeconds': 1748460056}
|
|
28
|
+
async def get_latest_price_json(self, from_asset: str, to_asset: str):
|
|
29
29
|
prices = await self.get_latest_prices()
|
|
30
30
|
for price_data in prices:
|
|
31
31
|
if (price_data.get('from') == from_asset and
|
|
@@ -132,7 +132,7 @@ class OstiumSDK:
|
|
|
132
132
|
# get the price for this trade's asset/feed
|
|
133
133
|
price_data = await self.price.get_latest_price_json(trade_details['pair']['from'], trade_details['pair']['to'])
|
|
134
134
|
self.log(
|
|
135
|
-
f"\nPrice data: {price_data} (
|
|
135
|
+
f"\nPrice data: {price_data} (contains bid, mid, ask prices among other things)")
|
|
136
136
|
# get the block number
|
|
137
137
|
block_number = self.ostium.get_block_number()
|
|
138
138
|
self.log(f"\nBlock number: {block_number}")
|
|
@@ -155,7 +155,7 @@ class OstiumSDK:
|
|
|
155
155
|
|
|
156
156
|
currLongOI = Decimal(pair_details['longOI']) / PRECISION_6
|
|
157
157
|
currShortOI = Decimal(pair_details['shortOI']) / PRECISION_6
|
|
158
|
-
maxOI = Decimal(pair_details['maxOI']) / PRECISION_6
|
|
158
|
+
maxOI = Decimal(pair_details['maxOI']) / PRECISION_6 # maxOI is in USD
|
|
159
159
|
|
|
160
160
|
openInterestMax = max(currLongOI, currShortOI)
|
|
161
161
|
normalizedOiDelta = ((currLongOI - currShortOI).quantize(PRECISION_6, rounding=ROUND_DOWN) / max(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ostium-python-sdk
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.15
|
|
4
4
|
Summary: A python based SDK developed for interacting with Ostium, a leveraged trading application for trading currencies, commodities, indices, crypto and more.
|
|
5
5
|
Home-page: https://github.com/0xOstium/ostium-python-sdk
|
|
6
6
|
Author: ami@ostium.io
|
|
@@ -235,7 +235,7 @@ The intraction with Ostium platform is denoted with pair_id and trade_index.
|
|
|
235
235
|
|
|
236
236
|
## List of available pairs (Mainnet)
|
|
237
237
|
|
|
238
|
-
- As of
|
|
238
|
+
- As of May 2025, the following pairs are available on the mainnet:
|
|
239
239
|
|
|
240
240
|
| ID | Trading Pair | Description |
|
|
241
241
|
|----|--------------|--------------------------------|
|
|
@@ -250,6 +250,20 @@ The intraction with Ostium platform is denoted with pair_id and trade_index.
|
|
|
250
250
|
| 8 | XAG-USD | Silver |
|
|
251
251
|
| 9 | SOL-USD | Solana |
|
|
252
252
|
| 10 | SPX-USD | S&P 500 Index |
|
|
253
|
+
| 11 | DJI-USD | Dow Jones Industrial Average |
|
|
254
|
+
| 12 | NDX-USD | NASDAQ-100 Index |
|
|
255
|
+
| 13 | NIK-JPY | Nikkei 225 Index |
|
|
256
|
+
| 14 | FTSE-GBP | FTSE 100 Index |
|
|
257
|
+
| 15 | DAX-EUR | DAX Index |
|
|
258
|
+
| 16 | USD-CAD | US Dollar to Canadian Dollar |
|
|
259
|
+
| 17 | USD-MXN | US Dollar to Mexican Peso |
|
|
260
|
+
| 18 | NVDA-USD | NVIDIA Stock |
|
|
261
|
+
| 19 | GOOG-USD | Alphabet (Google) Stock |
|
|
262
|
+
| 20 | AMZN-USD | Amazon Stock |
|
|
263
|
+
| 21 | META-USD | Meta (Facebook) Stock |
|
|
264
|
+
| 22 | TSLA-USD | Tesla Stock |
|
|
265
|
+
| 23 | AAPL-USD | Apple Stock |
|
|
266
|
+
| 24 | MSFT-USD | Microsoft Stock |
|
|
253
267
|
|
|
254
268
|
## Usage Examples
|
|
255
269
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/faucet_testnet_abi.py
RENAMED
|
File without changes
|
{ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/pairs_info_abi.py
RENAMED
|
File without changes
|
{ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/pairs_storage_abi.py
RENAMED
|
File without changes
|
|
File without changes
|
{ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/trading_storage_abi.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/scscript/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/scscript/pairinfos.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk.egg-info/requires.txt
RENAMED
|
File without changes
|
{ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_current_total_profit_raw.py
RENAMED
|
File without changes
|
|
File without changes
|
{ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_current_trade_profit_raw.py
RENAMED
|
File without changes
|
|
File without changes
|
{ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_get_pending_acc_funding_fees.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_remove_collateral_from_leverage.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|