Skip to content

Commit

Permalink
feat: update coinbase to use usdc wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
daneisburgh committed Feb 5, 2024
1 parent 349c990 commit 1009680
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions invaas/coinbase/coinbase_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, env: str):

self.cb_client = CoinbaseClient(self.get_secret("COINBASE-API-KEY"), self.get_secret("COINBASE-API-SECRET"))

self.product_ids = ["BTC-USD", "ETH-USD", "SOL-USD", "XRP-USD", "DOT-USD"]
self.product_ids = ["BTC-USDC", "ETH-USDC", "SOL-USDC", "XRP-USDC", "DOT-USDC"]
self.logger.info(f"Products to trade: {str(self.product_ids)}")

self.min_fear_greed_index_to_buy = 60
Expand Down Expand Up @@ -61,11 +61,11 @@ def __buy_product(self, product_id: str, available_cash: float):
def __sell_product(self, product_id: str, owned_product: float):
crypto_id = self.__get_crypto_id(product_id)

if product_id in ["BTC-USD", "ETH-USD"]:
if product_id in ["BTC-USDC", "ETH-USDC"]:
precision = 6
elif product_id in ["DOT-USD", "SOL-USD", "XRP-USD"]:
elif product_id in ["DOT-USDC", "SOL-USDC", "XRP-USDC"]:
precision = 3
elif product_id in ["ADA-USD", "ATOM-USD", "AVAX-USD", "LINK-USD"]:
elif product_id in ["ADA-USDC", "ATOM-USDC", "AVAX-USDC", "LINK-USDC"]:
precision = 2

sell_amount = self.floor_value(value=owned_product, precision=precision)
Expand Down Expand Up @@ -95,7 +95,7 @@ def create_orders(self):
owned_product = self.__get_available_balance(f"{crypto_id} Wallet")
self.logger.info(f"Owned {crypto_id}: {owned_product:.10f}")

available_cash = self.__get_available_balance("Cash (USD)")
available_cash = self.__get_available_balance("USDC Wallet")
self.logger.info(f"Available cash: ${available_cash:.2f}")

order_side = (
Expand Down

0 comments on commit 1009680

Please sign in to comment.