Skip to content

Commit a30ae39

Browse files
committed
Corrected edit bug in DCA script
1 parent 9366203 commit a30ae39

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

examples/coinbase_dca.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
SPREAD = 0.06 # do buys 1% above to 5% below (peanut butter spread)
1414
MKRFEE = 0.0040 # fee for maker limit orders
1515
TKRFEE = 0.0060 # fee for taker limit orders
16-
DCAUSD = 10.14 # USD to deposit on our DCAs
16+
DCAUSD = 10.00 # USD to deposit on our DCAs
1717
DEPOSIT = True
1818
CANCEL_OPEN = True
1919
DEPSOIT_DELAY = 12 * HOUR # If we've deposited in the last 12hrs, skip
@@ -61,7 +61,7 @@
6161
resp = cboa.oa2_client.get_deposits(account_id)
6262
for deposit in resp['data']:
6363
created = datetime.strptime(deposit['created_at'], ISOFMT).astimezone(timezone.utc)
64-
if (current - created).total_seconds() < :
64+
if (current - created).total_seconds() < DEPSOIT_DELAY:
6565
need_deposit = False
6666
break
6767

@@ -79,9 +79,10 @@
7979

8080
assert account_id and pmt_method_id
8181

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

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

0 commit comments

Comments
 (0)