Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop Loss implementation #93

Merged
merged 16 commits into from
Jan 25, 2025
Merged

Stop Loss implementation #93

merged 16 commits into from
Jan 25, 2025

Conversation

bludnic
Copy link
Member

@bludnic bludnic commented Jan 5, 2025

Implemented Stop Loss on the bot side. A native stop loss will be added later for exchanges that support it.

Usage

Stop-Limit

const trade = yield useSmartTrade({
  entry: { type: "Market" },
  tp: {
    type: "Limit",
    price: 100_000,
  },
  sl: {
    type: "Limit",
    stopPrice: 95000, // <-- SL triggered at this price
    price: 94500, // Limit order price
  },
  quantity: 0.001,
});

Stop-Market

const trade = yield useSmartTrade({
  entry: { type: "Market" },
  tp: {
    type: "Limit",
    price: 100_000,
  },
  sl: {
    type: "Market",
    stopPrice: 95000, // <-- SL triggered at this price. Market order will be placed.
  },
  quantity: 0.001,
});

@bludnic bludnic self-assigned this Jan 5, 2025
@bludnic bludnic marked this pull request as draft January 5, 2025 03:18
@bludnic bludnic marked this pull request as ready for review January 25, 2025 23:52
@bludnic bludnic merged commit 6e61108 into dev Jan 25, 2025
1 check passed
@bludnic bludnic deleted the feat/stop-loss branch January 25, 2025 23:52
@bludnic bludnic mentioned this pull request Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants