ostium-python-sdk 0.1.8__tar.gz → 0.1.10__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.8 → ostium_python_sdk-0.1.10}/PKG-INFO +1 -1
  2. ostium_python_sdk-0.1.10/ostium_python_sdk/sdk.py +53 -0
  3. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk.egg-info/PKG-INFO +1 -1
  4. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/setup.py +1 -1
  5. ostium_python_sdk-0.1.8/ostium_python_sdk/sdk.py +0 -40
  6. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/README.md +0 -0
  7. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk/__init__.py +0 -0
  8. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk/abi.py +0 -0
  9. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk/balance.py +0 -0
  10. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk/config.py +0 -0
  11. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk/constants.py +0 -0
  12. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk/formulae.py +0 -0
  13. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk/formulae_wrapper.py +0 -0
  14. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk/ostium.py +0 -0
  15. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk/price.py +0 -0
  16. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk/subgraph.py +0 -0
  17. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk/utils.py +0 -0
  18. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk.egg-info/SOURCES.txt +0 -0
  19. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk.egg-info/dependency_links.txt +0 -0
  20. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk.egg-info/requires.txt +0 -0
  21. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/ostium_python_sdk.egg-info/top_level.txt +0 -0
  22. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/pyproject.toml +0 -0
  23. {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ostium-python-sdk
3
- Version: 0.1.8
3
+ Version: 0.1.10
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
@@ -0,0 +1,53 @@
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
+ from typing import Union
7
+ from .subgraph import SubgraphClient
8
+
9
+
10
+ class OstiumSDK:
11
+ def __init__(self, network: Union[str, NetworkConfig], private_key: str = None, rpc_url: str = None):
12
+ load_dotenv()
13
+ self.private_key = private_key or os.getenv('PRIVATE_KEY')
14
+ if not self.private_key:
15
+ raise ValueError(
16
+ "No private key provided. Please provide via constructor or PRIVATE_KEY environment variable")
17
+
18
+ self.rpc_url = rpc_url or os.getenv('RPC_URL')
19
+ if not self.rpc_url:
20
+ network_name = "mainnet" if isinstance(
21
+ network, str) and network == "mainnet" else "testnet"
22
+ raise ValueError(
23
+ f"No RPC URL provided for {network_name}. Please provide via constructor or RPC_URL environment variable")
24
+
25
+ # Initialize Web3
26
+ self.w3 = Web3(Web3.HTTPProvider(self.rpc_url))
27
+
28
+ # Get network configuration
29
+ if isinstance(network, NetworkConfig):
30
+ self.network_config = network
31
+ elif isinstance(network, str):
32
+ if network == "mainnet":
33
+ self.network_config = NetworkConfig.mainnet()
34
+ elif network == "testnet":
35
+ self.network_config = NetworkConfig.testnet()
36
+ else:
37
+ raise ValueError(
38
+ f"Unsupported network: {network}. Use 'mainnet' or 'testnet'")
39
+ else:
40
+ raise ValueError(
41
+ "Network must be either a NetworkConfig instance or a string ('mainnet' or 'testnet')")
42
+
43
+ # Initialize Ostium instance
44
+ self.ostium = Ostium(
45
+ self.w3,
46
+ self.network_config.contracts["usdc"],
47
+ self.network_config.contracts["tradingStorage"],
48
+ self.network_config.contracts["trading"],
49
+ private_key=self.private_key
50
+ )
51
+
52
+ # Initialize subgraph client
53
+ self.subgraph = SubgraphClient(url=self.network_config.graph_url)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ostium-python-sdk
3
- Version: 0.1.8
3
+ Version: 0.1.10
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.8",
5
+ version="0.1.10",
6
6
  packages=find_packages(),
7
7
  install_requires=[
8
8
  "web3>=6.0.0",
@@ -1,40 +0,0 @@
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
- )