dpo-otto-client 5.0.0__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.
- dpo_otto_client-5.0.0/PKG-INFO +3 -0
- dpo_otto_client-5.0.0/dpo_otto_client.egg-info/PKG-INFO +3 -0
- dpo_otto_client-5.0.0/dpo_otto_client.egg-info/SOURCES.txt +6 -0
- dpo_otto_client-5.0.0/dpo_otto_client.egg-info/dependency_links.txt +1 -0
- dpo_otto_client-5.0.0/dpo_otto_client.egg-info/top_level.txt +1 -0
- dpo_otto_client-5.0.0/dpo_otto_langchain.py +28 -0
- dpo_otto_client-5.0.0/setup.cfg +4 -0
- dpo_otto_client-5.0.0/setup.py +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dpo_otto_langchain
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import urllib.request
|
|
2
|
+
import urllib.parse
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
class DPOAtomArbitrageClient:
|
|
6
|
+
"""Official Python & Agent Swarm Client for Data Processing Organization (SEC SIC-7370)."""
|
|
7
|
+
BASE_URL = "https://dataprocessingorganization.com"
|
|
8
|
+
|
|
9
|
+
def __init__(self, api_key: str = ""):
|
|
10
|
+
self.api_key = api_key or self.provision_trial_key()
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def provision_trial_key(cls) -> str:
|
|
14
|
+
req = urllib.request.Request(f"{cls.BASE_URL}/v1/otto/register", method="POST")
|
|
15
|
+
with urllib.request.urlopen(req, timeout=10) as resp:
|
|
16
|
+
return json.loads(resp.read().decode("utf-8")).get("otto_key", "")
|
|
17
|
+
|
|
18
|
+
def search(self, query: str, limit: int = 10) -> dict:
|
|
19
|
+
qs = urllib.parse.urlencode({"q": query, "limit": limit})
|
|
20
|
+
req = urllib.request.Request(f"{self.BASE_URL}/v1/otto/search?{qs}", headers={"api-key": self.api_key})
|
|
21
|
+
with urllib.request.urlopen(req, timeout=10) as resp:
|
|
22
|
+
return json.loads(resp.read().decode("utf-8"))
|
|
23
|
+
|
|
24
|
+
def evaluate_true_margin(self, acquisition_cost: float, target_resale: float, distance_miles: float = 150.0) -> dict:
|
|
25
|
+
qs = urllib.parse.urlencode({"acquisition_cost": acquisition_cost, "target_resale": target_resale, "distance_miles": distance_miles})
|
|
26
|
+
req = urllib.request.Request(f"{self.BASE_URL}/v1/otto/score/true-margin?{qs}", headers={"api-key": self.api_key})
|
|
27
|
+
with urllib.request.urlopen(req, timeout=10) as resp:
|
|
28
|
+
return json.loads(resp.read().decode("utf-8"))
|