ostium-python-sdk 0.1.6__tar.gz → 0.1.8__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 (23) hide show
  1. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/PKG-INFO +1 -1
  2. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk/config.py +0 -3
  3. ostium_python_sdk-0.1.8/ostium_python_sdk/sdk.py +40 -0
  4. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk.egg-info/PKG-INFO +1 -1
  5. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/setup.py +1 -1
  6. ostium_python_sdk-0.1.6/ostium_python_sdk/sdk.py +0 -39
  7. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/README.md +0 -0
  8. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk/__init__.py +0 -0
  9. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk/abi.py +0 -0
  10. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk/balance.py +0 -0
  11. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk/constants.py +0 -0
  12. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk/formulae.py +0 -0
  13. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk/formulae_wrapper.py +0 -0
  14. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk/ostium.py +0 -0
  15. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk/price.py +0 -0
  16. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk/subgraph.py +0 -0
  17. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk/utils.py +0 -0
  18. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk.egg-info/SOURCES.txt +0 -0
  19. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk.egg-info/dependency_links.txt +0 -0
  20. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk.egg-info/requires.txt +0 -0
  21. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/ostium_python_sdk.egg-info/top_level.txt +0 -0
  22. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/pyproject.toml +0 -0
  23. {ostium_python_sdk-0.1.6 → ostium_python_sdk-0.1.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ostium-python-sdk
3
- Version: 0.1.6
3
+ Version: 0.1.8
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
@@ -4,14 +4,12 @@ from typing import Dict, Optional
4
4
 
5
5
  @dataclass
6
6
  class NetworkConfig:
7
- rpc_url: str
8
7
  graph_url: str
9
8
  contracts: Dict[str, str]
10
9
 
11
10
  @classmethod
12
11
  def mainnet(cls) -> 'NetworkConfig':
13
12
  return cls(
14
- rpc_url="https://arb-mainnet.g.alchemy.com/v2/-dfuyiAmKg9seY_LJcy61q60GZELrNhX",
15
13
  graph_url="https://subgraph.satsuma-prod.com/391a61815d32/ostium/ost-prod/api",
16
14
  contracts={
17
15
  "usdc": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
@@ -23,7 +21,6 @@ class NetworkConfig:
23
21
  @classmethod
24
22
  def testnet(cls) -> 'NetworkConfig':
25
23
  return cls(
26
- rpc_url="https://arb-sepolia.g.alchemy.com/v2/xussaWLkWxKtZjCIlUjAYiMGV6_dRO-8",
27
24
  graph_url="https://subgraph.satsuma-prod.com/391a61815d32/ostium/ost-sep-final/api",
28
25
  contracts={
29
26
  "usdc": "0xe73B11Fb1e3eeEe8AF2a23079A4410Fe1B370548",
@@ -0,0 +1,40 @@
1
+ from dotenv import load_dotenv
2
+ import os
3
+ from web3 import Web3
4
+ from .ostium import Ostium
5
+ from .config import NetworkConfig
6
+
7
+
8
+ class OstiumSDK:
9
+ def __init__(self, network="mainnet", private_key: str = None, rpc_url: str = None):
10
+ load_dotenv()
11
+ self.private_key = private_key or os.getenv('PRIVATE_KEY')
12
+ if not self.private_key:
13
+ raise ValueError(
14
+ "No private key provided. Please provide via constructor or PRIVATE_KEY environment variable")
15
+
16
+ self.rpc_url = rpc_url or os.getenv('RPC_URL')
17
+ if not self.rpc_url:
18
+ raise ValueError(
19
+ f"No RPC URL provided for {network}. Please provide via constructor or RPC_URL environment variable")
20
+
21
+ # Initialize Web3
22
+ self.w3 = Web3(Web3.HTTPProvider(self.rpc_url))
23
+
24
+ # Get network configuration
25
+ if network == "mainnet":
26
+ self.network_config = NetworkConfig.mainnet()
27
+ elif network == "testnet":
28
+ self.network_config = NetworkConfig.testnet()
29
+ else:
30
+ raise ValueError(
31
+ f"Unsupported network: {network}. Use 'mainnet' or 'testnet'")
32
+
33
+ # Initialize Ostium instance
34
+ self.ostium = Ostium(
35
+ self.w3,
36
+ self.network_config.contracts["usdc"],
37
+ self.network_config.contracts["tradingStorage"],
38
+ self.network_config.contracts["trading"],
39
+ private_key=self.private_key
40
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ostium-python-sdk
3
- Version: 0.1.6
3
+ Version: 0.1.8
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
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="ostium-python-sdk",
5
- version="0.1.6",
5
+ version="0.1.8",
6
6
  packages=find_packages(),
7
7
  install_requires=[
8
8
  "web3>=6.0.0",
@@ -1,39 +0,0 @@
1
- from dotenv import load_dotenv
2
- import os
3
- from web3 import Web3
4
- from .ostium import Ostium
5
-
6
-
7
- class OstiumSDK:
8
- def __init__(self, network="arbitrum", private_key: str = None, rpc_url: str = None):
9
- load_dotenv()
10
- self.private_key = private_key or os.getenv('OSTIUM_PRIVATE_KEY')
11
- if not self.private_key:
12
- raise ValueError(
13
- "No private key provided. Please provide via constructor or OSTIUM_PRIVATE_KEY environment variable")
14
-
15
- # Use provided RPC URL or get from env
16
- self.rpc_url = rpc_url or os.getenv('OSTIUM_RPC_URL')
17
- if not self.rpc_url:
18
- raise ValueError(
19
- "No RPC URL provided. Please provide via constructor or OSTIUM_RPC_URL environment variable")
20
-
21
- # Initialize Web3
22
- self.w3 = Web3(Web3.HTTPProvider(self.rpc_url))
23
-
24
- # Set network-specific addresses
25
- if network == "arbitrum":
26
- self.usdc_address = "0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
27
- self.ostium_trading_storage_address = "0x937F3002dE1C7b9E6f461f5F5C5Ac5cA8A1a6339"
28
- self.ostium_trading_address = "0x4c78B6566864e374a5949C6EE1408Fd0Fe01A6ED"
29
- else:
30
- raise ValueError(f"Unsupported network: {network}")
31
-
32
- # Initialize Ostium instance
33
- self.ostium = Ostium(
34
- self.w3,
35
- self.usdc_address,
36
- self.ostium_trading_storage_address,
37
- self.ostium_trading_address,
38
- private_key=self.private_key
39
- )