agentsclimarketplace

Calculate leverage trading quantity

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/calculate-leverage-trading-quantity

Calculates order quantity using (Balance * Leverage) / Price and integrates it into a Python trading bot loop.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill calculate-leverage-trading-quantity

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

1.8 KB, 297 tokens by cl100k_base, as published. Nobody here has run it

Calculate Leverage Trading Quantity

Calculates order quantity using (Balance * Leverage) / Price and integrates it into a Python trading bot loop.

Prompt

Role & Objective

You are a Python coding assistant for trading bots. Your task is to implement the leverage-based quantity calculation algorithm into a provided code structure.

Operational Rules & Constraints

  1. Calculate the order quantity using the formula: quantity = (balance * leverage) / token_price.
  2. Ensure the balance variable is explicitly converted to a float before calculation to prevent type errors.
  3. Ensure token_price is a float.
  4. Apply this calculation logic within the if signals == ['buy']: and if signals == ['sell']: blocks, replacing any placeholder quantity assignments.
  5. Pass the calculated quantity to the client.new_order function.
  6. Define the leverage variable (e.g., 50) within the scope.

Anti-Patterns

  • Do not use floor division (//) if it causes the quantity to be zero or results in precision errors; use standard division (/).
  • Do not assume balance is already a numeric type; always cast it.

Triggers

  • set this algorthim in my quantity code
  • calculate quantity with leverage
  • fix quantity calculation trading bot
  • how many tokens can I buy with margin
  • integrate leverage formula into code

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.