Skip to content

Commit

Permalink
Corrected edit bug in DCA script
Browse files Browse the repository at this point in the history
  • Loading branch information
brianddk committed Mar 25, 2024
1 parent 9366203 commit a30ae39
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/coinbase_dca.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
SPREAD = 0.06 # do buys 1% above to 5% below (peanut butter spread)
MKRFEE = 0.0040 # fee for maker limit orders
TKRFEE = 0.0060 # fee for taker limit orders
DCAUSD = 10.14 # USD to deposit on our DCAs
DCAUSD = 10.00 # USD to deposit on our DCAs
DEPOSIT = True
CANCEL_OPEN = True
DEPSOIT_DELAY = 12 * HOUR # If we've deposited in the last 12hrs, skip
Expand Down Expand Up @@ -61,7 +61,7 @@
resp = cboa.oa2_client.get_deposits(account_id)
for deposit in resp['data']:
created = datetime.strptime(deposit['created_at'], ISOFMT).astimezone(timezone.utc)
if (current - created).total_seconds() < :
if (current - created).total_seconds() < DEPSOIT_DELAY:
need_deposit = False
break

Expand All @@ -79,9 +79,10 @@

assert account_id and pmt_method_id

dcausd = DCAUSD + current.day/100 # set pennies to day of month
# Make the deposit
#
resp = cboa.oa2_client.deposit(account_id, amount=f"{DCAUSD:.2f}", currency="USD", payment_method=pmt_method_id)
resp = cboa.oa2_client.deposit(account_id, amount=f"{dcausd:.2f}", currency="USD", payment_method=pmt_method_id)

sleep(3) # There really is a settle time from cancel to avail balance... insane.

Expand Down

0 comments on commit a30ae39

Please sign in to comment.