From cb662c82b1e9d4e13677322c610fea239276e4d7 Mon Sep 17 00:00:00 2001 From: mraniki <8766259+mraniki@users.noreply.github.com> Date: Fri, 19 Apr 2024 07:50:38 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20update=20capitalcom.py=20and=20e?= =?UTF-8?q?xample.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cefi/handler/capitalcom.py | 9 ++++----- examples/example.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/cefi/handler/capitalcom.py b/cefi/handler/capitalcom.py index 3ed9aec8..d9ef79df 100644 --- a/cefi/handler/capitalcom.py +++ b/cefi/handler/capitalcom.py @@ -100,7 +100,7 @@ async def get_quote(self, instrument): # logger.debug("Instrument verification: {}", search_markets) market = self.client.single_market(instrument) - # logger.debug("Raw Quote: {}", market) + # logger.debug("market: {}", market) quote = market["snapshot"]["offer"] logger.debug("Quote: {}", quote) @@ -254,8 +254,8 @@ async def get_instrument_min_amount(self, instrument): .get("minDealSize", {}) .get("value", 0) ) - logger.debug("Minimum {}", minimum_amount) - return int(minimum_amount) + logger.debug("Minimum Amount Needed {}", minimum_amount) + return float(minimum_amount) async def execute_order(self, order_params): """ @@ -283,9 +283,8 @@ async def execute_order(self, order_params): is_percentage=self.trading_risk_percentage, ) min_amount = await self.get_instrument_min_amount(instrument) - logger.debug("min_amount {}", min_amount) amount = max(amount, min_amount) - logger.debug("amount {}", amount) + logger.debug("Amount to execute {}", amount) await asyncio.sleep(1) # Wait for 1 second if not (await self.pre_order_checks(order_params)): diff --git a/examples/example.py b/examples/example.py index f353368b..d60168ee 100644 --- a/examples/example.py +++ b/examples/example.py @@ -29,7 +29,7 @@ async def main(): # # EURUSD: -3.22 order = { "action": "BUY", - "instrument": "EURUSD", + "instrument": "US500", "quantity": 10, "take_profit": 100, "stop_loss": 1000,