Skip to content

Commit 6f81029

Browse files
committed
update to limit orders
1 parent c28a619 commit 6f81029

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

public_invest_api/public.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ def get_portfolio(self):
136136
timeout=self.timeout,
137137
)
138138
if portfolio.status_code != 200:
139-
print("Portfolio request failed")
140-
print(portfolio.text)
139+
print(f"Portfolio request failed: {portfolio.text}")
141140
return None
142141
return portfolio.json()
143142

@@ -236,8 +235,7 @@ def place_order(
236235
timeout=self.timeout,
237236
)
238237
if preflight.status_code != 200:
239-
print(preflight.text)
240-
raise Exception("Preflight failed")
238+
raise Exception(f"Preflight failed: {preflight.text}")
241239
preflight = preflight.json()
242240
# Build order endpoint
243241
build_response = self.session.post(
@@ -247,7 +245,6 @@ def place_order(
247245
timeout=self.timeout,
248246
)
249247
if build_response.status_code != 200:
250-
print(build_response.text)
251248
raise Exception(f"Build order failed: {build_response.text}")
252249
build_response = build_response.json()
253250
if build_response.get("orderId") is None:
@@ -261,12 +258,10 @@ def place_order(
261258
timeout=self.timeout,
262259
)
263260
if submit_response.status_code != 200:
264-
print(submit_response.text)
265-
raise Exception("Submit order failed")
261+
raise Exception(f"Submit order failed: {submit_response.text}")
266262
submit_response = submit_response.json()
267263
# Empty dict is success
268264
if submit_response != {}:
269-
print(f"Submit response: {submit_response}")
270265
raise Exception(f"Order failed: {submit_response}")
271266
sleep(1)
272267
# Check if order was rejected

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="public_invest_api",
5-
version="1.0.2",
5+
version="1.0.3",
66
description="Unofficial Public.com Invest API written in Python Requests",
77
long_description=open("README.md").read(),
88
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)