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.
Files changed (61) hide show
  1. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/PKG-INFO +16 -2
  2. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/README.md +15 -1
  3. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/formulae_wrapper.py +8 -5
  4. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/price.py +2 -2
  5. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/sdk.py +2 -2
  6. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk.egg-info/PKG-INFO +16 -2
  7. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/setup.py +1 -1
  8. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/MANIFEST.in +0 -0
  9. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/__init__.py +0 -0
  10. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/__init__.py +0 -0
  11. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/faucet_testnet_abi.py +0 -0
  12. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/pairs_info_abi.py +0 -0
  13. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/pairs_storage_abi.py +0 -0
  14. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/trading_abi.py +0 -0
  15. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/trading_storage_abi.py +0 -0
  16. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/usdc_abi.py +0 -0
  17. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/abi/vault_abi.py +0 -0
  18. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/balance.py +0 -0
  19. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/config.py +0 -0
  20. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/constants.py +0 -0
  21. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/exceptions.py +0 -0
  22. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/faucet.py +0 -0
  23. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/formulae.py +0 -0
  24. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/ostium.py +0 -0
  25. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/scscript/__init__.py +0 -0
  26. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/scscript/funding.py +0 -0
  27. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/scscript/pairinfos.py +0 -0
  28. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/subgraph.py +0 -0
  29. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk/utils.py +0 -0
  30. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk.egg-info/SOURCES.txt +0 -0
  31. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk.egg-info/dependency_links.txt +0 -0
  32. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk.egg-info/requires.txt +0 -0
  33. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/ostium_python_sdk.egg-info/top_level.txt +0 -0
  34. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/pyproject.toml +0 -0
  35. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/requirements-dev.txt +0 -0
  36. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/requirements.txt +0 -0
  37. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/setup.cfg +0 -0
  38. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/__init__.py +0 -0
  39. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/conftest.py +0 -0
  40. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/disabled_test_funding.py +0 -0
  41. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/disabled_test_slippage.py +0 -0
  42. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_current_total_profit_p.py +0 -0
  43. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_current_total_profit_raw.py +0 -0
  44. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_current_trade_profit_p.py +0 -0
  45. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_current_trade_profit_raw.py +0 -0
  46. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_get_opening_fee.py +0 -0
  47. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_get_pending_acc_funding_fees.py +0 -0
  48. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_get_price_impact.py +0 -0
  49. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_get_trade_funding_fee.py +0 -0
  50. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_get_trade_rollover_fee.py +0 -0
  51. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_get_trade_value.py +0 -0
  52. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_max_leverage.py +0 -0
  53. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_overnight_max_leverage.py +0 -0
  54. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_remove_collateral_from_leverage.py +0 -0
  55. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_remove_collateral_with_collateral.py +0 -0
  56. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_target_funding_rate.py +0 -0
  57. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_top_up_with_collateral.py +0 -0
  58. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_top_up_with_leverage.py +0 -0
  59. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_trade_get_sl_price.py +0 -0
  60. {ostium_python_sdk-2.0.13 → ostium_python_sdk-2.0.15}/tests/test_trade_get_tp_price.py +0 -0
  61. {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.13
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 January 2025, the following pairs are available on the mainnet:
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 January 2025, the following pairs are available on the mainnet:
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 (abs)
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
- total_profit = Decimal(total_profit_raw)
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
- 'total_profit': float(total_profit), # same as net_pnl
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': 97241.43864211132, 'mid': 97243.36503172085, 'ask': 97245.2739217016, 'isMarketOpen': True, 'from': 'BTC', 'to': 'USD', 'timestampSeconds': 1740043714}
28
- async def get_latest_price_json(self, from_asset: str, to_asset: str) -> Tuple[float, bool]:
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} (need here bid, mid, ask prices)")
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 # maxOI is in USD
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.13
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 January 2025, the following pairs are available on the mainnet:
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
 
@@ -22,7 +22,7 @@ if changelog_path.exists():
22
22
 
23
23
  setup(
24
24
  name="ostium-python-sdk",
25
- version="2.0.13",
25
+ version="2.0.15",
26
26
  packages=find_packages(),
27
27
  install_requires=read_requirements('requirements.txt'),
28
28
  extras_require={