Skip to content

Commit 0b60851

Browse files
committed
Retries after 'Post only mode' error
1 parent 028dc50 commit 0b60851

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
cron.log
2+
cron*
33

44
settings.conf
55

gdax_bot.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,12 @@ def get_timestamp():
213213

214214
print(json.dumps(result, sort_keys=True, indent=4))
215215

216-
if "message" in result:
216+
if "message" in result and "Post only mode" in result.get("message"):
217+
# Price moved away from valid order
218+
print("Post only mode at $%0.2f" % (offer_price))
219+
continue
220+
221+
elif "message" in result:
217222
# Something went wrong if there's a 'message' field in response
218223
sns.publish(
219224
TopicArn=sns_topic,
@@ -261,8 +266,8 @@ def get_timestamp():
261266
'''
262267
wait_time = 60
263268
total_wait_time = 0
264-
while ("status" in order
265-
and (order["status"] == "pending" or order["status"] == "open")):
269+
while "status" in order and \
270+
(order["status"] == "pending" or order["status"] == "open")):
266271
if total_wait_time > warn_after:
267272
sns.publish(
268273
TopicArn=sns_topic,

0 commit comments

Comments
 (0)