Update a trading rule
Update an existing trading rule. Admin only.
Only provide fields you want to change. Use null to clear optional numeric fields.
Example - Update limits:
curl -X PATCH "https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}" \
-H "X-API-Key: hp_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{"maxLoss": 6000, "dailyLoss": 3000}'
Example - Clear a field:
curl -X PATCH ".../{ruleId}" \
-d '{"consistency": null}'
Example - Set a contract scaling plan:
curl -X PATCH ".../{ruleId}" \
-d '{"scalingPlan": {"basis": "balance", "tiers": [{"profit": 0, "maxContracts": 1}, {"profit": 1000, "maxContracts": 2}, {"profit": 3000, "maxContracts": 5.5}]}}'
Example - Change the micro conversion ratio (5 micros = 1 mini):
curl -X PATCH ".../{ruleId}" \
-d '{"microConversionRatio": 5}'
Example - Restrict the rule set to the New York session (send both null to remove it):
curl -X PATCH ".../{ruleId}" \
-d '{"sessionWindowStart": "09:30", "sessionWindowEnd": "16:00", "sessionWindowTimezone": "America/New_York"}'
Trading session (sessionWindowStart, sessionWindowEnd, sessionWindowTimezone):
Restricts accounts on this rule set to a daily trading session, so one organization can sell a full-session product and, say, a New York session product (09:30–16:00 America/New_York) side by side. Off by default: with no session set, trading follows the market hours and your organization’s session settings exactly as before.
- Outside the session, new positions are refused with error code
OUTSIDE_TRADING_SESSION. Closing or reducing a position, cancelling orders and take-profit / stop-loss exits are always allowed. - At the session end, open positions are closed and working orders are cancelled.
- The session is evaluated every day in its own time zone and follows daylight saving time. An end earlier than the start is an overnight session (e.g. 18:00 → 02:00).
- It only narrows trading: the market’s hours and your organization’s session open delay and close buffer still apply, so trading is allowed only where they overlap.
- Set
sessionWindowStartandsessionWindowEndtogether (24-hour HH:MM); send both asnullto remove the session. The time zone defaults to America/New_York.
Micro contract conversion (microConversionRatio):
maxContracts (and scaling-plan tiers) are denominated in mini-equivalent units. Micro contracts (MES, MNQ, MGC, …) are converted using the rule set’s microConversionRatio — how many micros count as 1 unit toward the limit:
| Ratio | maxContracts: 10 allows |
|---|---|
10 (default, CME notional ratio) | 10 minis or 100 micros, or any equivalent mix |
5 | 10 minis or 50 micros |
1 | 10 contracts total — micros count the same as minis |
E-mini and full-size contracts always count as 1 unit each; the ratio only affects micros. Omit the field (or PATCH it to null) to use the default 10:1 conversion. Different plans can use different ratios by pointing them at different rule sets. Enforcement is account-wide and real-time in the trade engine.
Example — a plan where 5 micros equal 1 mini:
{ "maxContracts": 10, "microConversionRatio": 5 }
Scaling plans (scalingPlan):
Position limits: pick the right field
maxContracts counts engine units and a rule is not tied to a market, so
one unit is one futures contract but 0.001 BTC on the Binance perpetual. The
same number therefore means different things depending on which account the rule
backs. Use maxPositionByMarket for anything that is not plain futures:
{
"name": "50K BTC Perp",
"maxLoss": 2000,
"dailyLoss": 1000,
"maxPositionByMarket": { "BINANCE": 0.5 }
}
That is half a Bitcoin — no conversion, no engine units. Rejections quote it back the same way:
Order would exceed the BINANCE position limit on this account: 0.600 BTC requested, limit 0.500 BTC.
| Field | Counts in | Scope | Use for |
|---|---|---|---|
maxPositionByMarket | the market’s own unit (BTC) | that market only | crypto, and any fractional contract |
maxContracts | mini-equivalents (micros via microConversionRatio) | all instruments | futures |
A market named in maxPositionByMarket is not also gated by
maxContracts — a market gets one limit or the other. Send null to clear
every per-market limit and put all markets back under maxContracts.
Instead of a flat maxContracts limit, you can define profit-based tiers that grow the trader’s position size as they make profit:
{
"scalingPlan": {
"basis": "balance",
"tiers": [
{ "profit": 0, "maxContracts": 1 },
{ "profit": 1000, "maxContracts": 2 },
{ "profit": 3000, "maxContracts": 5.5 }
]
}
}
profitis in dollars relative to the account’s starting balance. The first tier must be0— it defines the starting limit.- Alternatively, tiers can use absolute
balancethresholds instead ofprofit(all tiers must use the same key). The first tier defines the starting limit — set its threshold at (or below) the account size:
{
"tiers": [
{ "balance": 50000, "maxContracts": 1 },
{ "balance": 55000, "maxContracts": 2 },
{ "balance": 60000, "maxContracts": 5.5 }
]
}
Note: balance thresholds tie the rule to one account size — a 55000 tier means something very different on a 25K vs 100K account. Profit-based tiers are portable across account sizes; prefer them unless all accounts on this rule share one size.
maxContractsis in mini-equivalent units and supports 0.1 steps. Micros count as 1/microConversionRatioof a mini (default 10), so5.5allows 5 minis or 55 micros (e.g. 5 ES or 55 MES) at the default ratio.basiscontrols when tiers activate/deactivate:Value Behavior balanceMeasured against current balance — limits scale back down if the balance drops below a threshold (default) high_water_markMeasured against the best balance reached — tiers unlock permanently - When
scalingPlanis set it overridesmaxContracts. Remove it ("scalingPlan": nullon PATCH) to fall back to the flat limit. - Enforced in real time at order placement by the trade engine.
Consistency rule (consistency + related fields):
Caps how much of a trader’s profit may come from a single day. The daily cap is:
daily_cap = round(base × consistency%, 2)
+ starting_balance × consistencyTolerancePct%
+ consistencyLeniency
A day whose net PnL reaches or exceeds the cap fails the rule (the boundary is inclusive). The formula is selected automatically by account type:
- Evaluation accounts — the rule gates passing: base defaults to max(profitTarget, totalPnl), and the trader also needs at least
consistencyMinDaysprofitable days (default: ceil(100/consistency), so 50% → 2 days). Reaching the profit target with over-concentrated gains does NOT fail the account — it simply stays active until gains are spread out, and the account’scompletionPendingReasonexplains exactly why. - Sim-funded accounts — the rule gates payouts: base is the profit in the current payout cycle (since the last payout with
consistencyReset).
Enforcement is opt-in per rule set (consistencyEnforced, default false — the historical behavior where the consistency % was informational only). Existing accounts are unaffected until you enable it.
Example — a consistency-enforced template: { "consistency": 50, "consistencyEnforced": true, "consistencyTolerancePct": 0.2 } on evaluation rules, and { "consistency": 50, "consistencyEnforced": true, "consistencyLeniency": 40 } on Builder sim-funded rules.
Sim-funded accounts — limits are optional per rule set:
Every trading limit on a rule set applies to sim_funded accounts exactly like evaluations when set, and is disabled when 0/omitted — so you choose per template who enforces funded limits:
- Platform enforces (recommended): attach a rule set with real values, e.g.
{ "dailyLoss": 1500, "maxLoss": 2500, "maxContracts": 5, "consistency": 50, "consistencyEnforced": true, "consistencyLeniency": 40, "maxPayouts": 5, "payoutMllLockOffset": 100 }— we enforce limits live, gate payouts on consistency, and fire the webhooks. - You enforce: attach a permissive rule set (limits
0) and run your own logic; we still execute trades and payouts.
profitTarget never completes a sim-funded account — funded accounts withdraw, they don’t “pass” — so it is safe to reuse an eval-style rule set on funded accounts.
Warning: Changing rules affects how accounts using these rules are evaluated. Changes apply to future evaluations, not retroactively.
Error Codes:
| Code | Description |
|---|---|
RULE_NOT_FOUND | No rule with this ID exists in your organization |
RULE_NAME_EXISTS | Another rule already has this name |
NO_FIELDS_TO_UPDATE | No valid fields provided |
ADMIN_REQUIRED | Only admins can update rules |
Access: full-access API keys only (a read-only key gets 403 READ_ONLY_KEY). Dashboard members need manage access to Plans & rules.
curl --request PATCH \
--url https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Updated Rule Name",
"description": "Updated description",
"profitTarget": 12000,
"dailyProfit": 50000000,
"dailyProfitEnforced": true,
"bestDayStopPct": 40,
"maxProfit": 50000000,
"dailyLossEntryBufferTicks": 4,
"dailyLoss": 3000,
"maxLoss": 6000,
"dailyDrawdown": 50,
"maxDrawdown": 50000000,
"drawdownDenomination": "percent",
"drawdownTrailCeiling": 100,
"newsTradingAllowed": true,
"microscalpingAllowed": true,
"weekendHoldingAllowed": true,
"overnightHoldingAllowed": true,
"consistency": 50,
"consistencyEnforced": true,
"consistencyBase": "max_target_or_pnl",
"consistencyTolerancePct": 0.2,
"consistencyLeniency": 40,
"consistencyMinDays": 2,
"consistencyProfitableDayMin": 0,
"maxPayouts": 5,
"payoutMllLockOffset": 100,
"maxAccountDays": 30,
"timeLimitExtensionDays": 30,
"timeLimitExtensionMinProgressPct": 50,
"maxInactiveDays": 10,
"dailyLossOffThreshold": 500,
"dailyLossOffMode": "while_above",
"maxPositionByMarket": {
"BINANCE": 0.5
},
"perpMaxLeverage": 2,
"blockedSymbols": [
"ES",
"NQ",
"YM",
"RTY",
"CL",
"GC"
],
"sessionWindowStart": "09:30",
"sessionWindowEnd": "16:00",
"sessionWindowTimezone": "America/New_York",
"maxPositionByProduct": {
"SIL": 5
},
"maxContracts": 500000,
"microConversionRatio": 5,
"scalingPlan": {
"basis": "balance",
"tiers": [
{
"profit": 0,
"maxContracts": 1
},
{
"profit": 1000,
"maxContracts": 2
},
{
"profit": 3000,
"maxContracts": 5.5
}
]
},
"personalRiskPolicy": {
"dailyLossLimitMax": 1000,
"dailyLossLimitDefault": 500,
"requireDailyLossLimit": true,
"maxTradesPerDayMax": 20
},
"metadata": {
"version": "2.0"
},
"mergeMetadata": true
}
'import requests
url = "https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}"
payload = {
"name": "Updated Rule Name",
"description": "Updated description",
"profitTarget": 12000,
"dailyProfit": 50000000,
"dailyProfitEnforced": True,
"bestDayStopPct": 40,
"maxProfit": 50000000,
"dailyLossEntryBufferTicks": 4,
"dailyLoss": 3000,
"maxLoss": 6000,
"dailyDrawdown": 50,
"maxDrawdown": 50000000,
"drawdownDenomination": "percent",
"drawdownTrailCeiling": 100,
"newsTradingAllowed": True,
"microscalpingAllowed": True,
"weekendHoldingAllowed": True,
"overnightHoldingAllowed": True,
"consistency": 50,
"consistencyEnforced": True,
"consistencyBase": "max_target_or_pnl",
"consistencyTolerancePct": 0.2,
"consistencyLeniency": 40,
"consistencyMinDays": 2,
"consistencyProfitableDayMin": 0,
"maxPayouts": 5,
"payoutMllLockOffset": 100,
"maxAccountDays": 30,
"timeLimitExtensionDays": 30,
"timeLimitExtensionMinProgressPct": 50,
"maxInactiveDays": 10,
"dailyLossOffThreshold": 500,
"dailyLossOffMode": "while_above",
"maxPositionByMarket": { "BINANCE": 0.5 },
"perpMaxLeverage": 2,
"blockedSymbols": ["ES", "NQ", "YM", "RTY", "CL", "GC"],
"sessionWindowStart": "09:30",
"sessionWindowEnd": "16:00",
"sessionWindowTimezone": "America/New_York",
"maxPositionByProduct": { "SIL": 5 },
"maxContracts": 500000,
"microConversionRatio": 5,
"scalingPlan": {
"basis": "balance",
"tiers": [
{
"profit": 0,
"maxContracts": 1
},
{
"profit": 1000,
"maxContracts": 2
},
{
"profit": 3000,
"maxContracts": 5.5
}
]
},
"personalRiskPolicy": {
"dailyLossLimitMax": 1000,
"dailyLossLimitDefault": 500,
"requireDailyLossLimit": True,
"maxTradesPerDayMax": 20
},
"metadata": { "version": "2.0" },
"mergeMetadata": True
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Updated Rule Name',
description: 'Updated description',
profitTarget: 12000,
dailyProfit: 50000000,
dailyProfitEnforced: true,
bestDayStopPct: 40,
maxProfit: 50000000,
dailyLossEntryBufferTicks: 4,
dailyLoss: 3000,
maxLoss: 6000,
dailyDrawdown: 50,
maxDrawdown: 50000000,
drawdownDenomination: 'percent',
drawdownTrailCeiling: 100,
newsTradingAllowed: true,
microscalpingAllowed: true,
weekendHoldingAllowed: true,
overnightHoldingAllowed: true,
consistency: 50,
consistencyEnforced: true,
consistencyBase: 'max_target_or_pnl',
consistencyTolerancePct: 0.2,
consistencyLeniency: 40,
consistencyMinDays: 2,
consistencyProfitableDayMin: 0,
maxPayouts: 5,
payoutMllLockOffset: 100,
maxAccountDays: 30,
timeLimitExtensionDays: 30,
timeLimitExtensionMinProgressPct: 50,
maxInactiveDays: 10,
dailyLossOffThreshold: 500,
dailyLossOffMode: 'while_above',
maxPositionByMarket: {BINANCE: 0.5},
perpMaxLeverage: 2,
blockedSymbols: ['ES', 'NQ', 'YM', 'RTY', 'CL', 'GC'],
sessionWindowStart: '09:30',
sessionWindowEnd: '16:00',
sessionWindowTimezone: 'America/New_York',
maxPositionByProduct: {SIL: 5},
maxContracts: 500000,
microConversionRatio: 5,
scalingPlan: {
basis: 'balance',
tiers: [
{profit: 0, maxContracts: 1},
{profit: 1000, maxContracts: 2},
{profit: 3000, maxContracts: 5.5}
]
},
personalRiskPolicy: {
dailyLossLimitMax: 1000,
dailyLossLimitDefault: 500,
requireDailyLossLimit: true,
maxTradesPerDayMax: 20
},
metadata: {version: '2.0'},
mergeMetadata: true
})
};
fetch('https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Updated Rule Name',
'description' => 'Updated description',
'profitTarget' => 12000,
'dailyProfit' => 50000000,
'dailyProfitEnforced' => true,
'bestDayStopPct' => 40,
'maxProfit' => 50000000,
'dailyLossEntryBufferTicks' => 4,
'dailyLoss' => 3000,
'maxLoss' => 6000,
'dailyDrawdown' => 50,
'maxDrawdown' => 50000000,
'drawdownDenomination' => 'percent',
'drawdownTrailCeiling' => 100,
'newsTradingAllowed' => true,
'microscalpingAllowed' => true,
'weekendHoldingAllowed' => true,
'overnightHoldingAllowed' => true,
'consistency' => 50,
'consistencyEnforced' => true,
'consistencyBase' => 'max_target_or_pnl',
'consistencyTolerancePct' => 0.2,
'consistencyLeniency' => 40,
'consistencyMinDays' => 2,
'consistencyProfitableDayMin' => 0,
'maxPayouts' => 5,
'payoutMllLockOffset' => 100,
'maxAccountDays' => 30,
'timeLimitExtensionDays' => 30,
'timeLimitExtensionMinProgressPct' => 50,
'maxInactiveDays' => 10,
'dailyLossOffThreshold' => 500,
'dailyLossOffMode' => 'while_above',
'maxPositionByMarket' => [
'BINANCE' => 0.5
],
'perpMaxLeverage' => 2,
'blockedSymbols' => [
'ES',
'NQ',
'YM',
'RTY',
'CL',
'GC'
],
'sessionWindowStart' => '09:30',
'sessionWindowEnd' => '16:00',
'sessionWindowTimezone' => 'America/New_York',
'maxPositionByProduct' => [
'SIL' => 5
],
'maxContracts' => 500000,
'microConversionRatio' => 5,
'scalingPlan' => [
'basis' => 'balance',
'tiers' => [
[
'profit' => 0,
'maxContracts' => 1
],
[
'profit' => 1000,
'maxContracts' => 2
],
[
'profit' => 3000,
'maxContracts' => 5.5
]
]
],
'personalRiskPolicy' => [
'dailyLossLimitMax' => 1000,
'dailyLossLimitDefault' => 500,
'requireDailyLossLimit' => true,
'maxTradesPerDayMax' => 20
],
'metadata' => [
'version' => '2.0'
],
'mergeMetadata' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}"
payload := strings.NewReader("{\n \"name\": \"Updated Rule Name\",\n \"description\": \"Updated description\",\n \"profitTarget\": 12000,\n \"dailyProfit\": 50000000,\n \"dailyProfitEnforced\": true,\n \"bestDayStopPct\": 40,\n \"maxProfit\": 50000000,\n \"dailyLossEntryBufferTicks\": 4,\n \"dailyLoss\": 3000,\n \"maxLoss\": 6000,\n \"dailyDrawdown\": 50,\n \"maxDrawdown\": 50000000,\n \"drawdownDenomination\": \"percent\",\n \"drawdownTrailCeiling\": 100,\n \"newsTradingAllowed\": true,\n \"microscalpingAllowed\": true,\n \"weekendHoldingAllowed\": true,\n \"overnightHoldingAllowed\": true,\n \"consistency\": 50,\n \"consistencyEnforced\": true,\n \"consistencyBase\": \"max_target_or_pnl\",\n \"consistencyTolerancePct\": 0.2,\n \"consistencyLeniency\": 40,\n \"consistencyMinDays\": 2,\n \"consistencyProfitableDayMin\": 0,\n \"maxPayouts\": 5,\n \"payoutMllLockOffset\": 100,\n \"maxAccountDays\": 30,\n \"timeLimitExtensionDays\": 30,\n \"timeLimitExtensionMinProgressPct\": 50,\n \"maxInactiveDays\": 10,\n \"dailyLossOffThreshold\": 500,\n \"dailyLossOffMode\": \"while_above\",\n \"maxPositionByMarket\": {\n \"BINANCE\": 0.5\n },\n \"perpMaxLeverage\": 2,\n \"blockedSymbols\": [\n \"ES\",\n \"NQ\",\n \"YM\",\n \"RTY\",\n \"CL\",\n \"GC\"\n ],\n \"sessionWindowStart\": \"09:30\",\n \"sessionWindowEnd\": \"16:00\",\n \"sessionWindowTimezone\": \"America/New_York\",\n \"maxPositionByProduct\": {\n \"SIL\": 5\n },\n \"maxContracts\": 500000,\n \"microConversionRatio\": 5,\n \"scalingPlan\": {\n \"basis\": \"balance\",\n \"tiers\": [\n {\n \"profit\": 0,\n \"maxContracts\": 1\n },\n {\n \"profit\": 1000,\n \"maxContracts\": 2\n },\n {\n \"profit\": 3000,\n \"maxContracts\": 5.5\n }\n ]\n },\n \"personalRiskPolicy\": {\n \"dailyLossLimitMax\": 1000,\n \"dailyLossLimitDefault\": 500,\n \"requireDailyLossLimit\": true,\n \"maxTradesPerDayMax\": 20\n },\n \"metadata\": {\n \"version\": \"2.0\"\n },\n \"mergeMetadata\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Rule Name\",\n \"description\": \"Updated description\",\n \"profitTarget\": 12000,\n \"dailyProfit\": 50000000,\n \"dailyProfitEnforced\": true,\n \"bestDayStopPct\": 40,\n \"maxProfit\": 50000000,\n \"dailyLossEntryBufferTicks\": 4,\n \"dailyLoss\": 3000,\n \"maxLoss\": 6000,\n \"dailyDrawdown\": 50,\n \"maxDrawdown\": 50000000,\n \"drawdownDenomination\": \"percent\",\n \"drawdownTrailCeiling\": 100,\n \"newsTradingAllowed\": true,\n \"microscalpingAllowed\": true,\n \"weekendHoldingAllowed\": true,\n \"overnightHoldingAllowed\": true,\n \"consistency\": 50,\n \"consistencyEnforced\": true,\n \"consistencyBase\": \"max_target_or_pnl\",\n \"consistencyTolerancePct\": 0.2,\n \"consistencyLeniency\": 40,\n \"consistencyMinDays\": 2,\n \"consistencyProfitableDayMin\": 0,\n \"maxPayouts\": 5,\n \"payoutMllLockOffset\": 100,\n \"maxAccountDays\": 30,\n \"timeLimitExtensionDays\": 30,\n \"timeLimitExtensionMinProgressPct\": 50,\n \"maxInactiveDays\": 10,\n \"dailyLossOffThreshold\": 500,\n \"dailyLossOffMode\": \"while_above\",\n \"maxPositionByMarket\": {\n \"BINANCE\": 0.5\n },\n \"perpMaxLeverage\": 2,\n \"blockedSymbols\": [\n \"ES\",\n \"NQ\",\n \"YM\",\n \"RTY\",\n \"CL\",\n \"GC\"\n ],\n \"sessionWindowStart\": \"09:30\",\n \"sessionWindowEnd\": \"16:00\",\n \"sessionWindowTimezone\": \"America/New_York\",\n \"maxPositionByProduct\": {\n \"SIL\": 5\n },\n \"maxContracts\": 500000,\n \"microConversionRatio\": 5,\n \"scalingPlan\": {\n \"basis\": \"balance\",\n \"tiers\": [\n {\n \"profit\": 0,\n \"maxContracts\": 1\n },\n {\n \"profit\": 1000,\n \"maxContracts\": 2\n },\n {\n \"profit\": 3000,\n \"maxContracts\": 5.5\n }\n ]\n },\n \"personalRiskPolicy\": {\n \"dailyLossLimitMax\": 1000,\n \"dailyLossLimitDefault\": 500,\n \"requireDailyLossLimit\": true,\n \"maxTradesPerDayMax\": 20\n },\n \"metadata\": {\n \"version\": \"2.0\"\n },\n \"mergeMetadata\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Updated Rule Name\",\n \"description\": \"Updated description\",\n \"profitTarget\": 12000,\n \"dailyProfit\": 50000000,\n \"dailyProfitEnforced\": true,\n \"bestDayStopPct\": 40,\n \"maxProfit\": 50000000,\n \"dailyLossEntryBufferTicks\": 4,\n \"dailyLoss\": 3000,\n \"maxLoss\": 6000,\n \"dailyDrawdown\": 50,\n \"maxDrawdown\": 50000000,\n \"drawdownDenomination\": \"percent\",\n \"drawdownTrailCeiling\": 100,\n \"newsTradingAllowed\": true,\n \"microscalpingAllowed\": true,\n \"weekendHoldingAllowed\": true,\n \"overnightHoldingAllowed\": true,\n \"consistency\": 50,\n \"consistencyEnforced\": true,\n \"consistencyBase\": \"max_target_or_pnl\",\n \"consistencyTolerancePct\": 0.2,\n \"consistencyLeniency\": 40,\n \"consistencyMinDays\": 2,\n \"consistencyProfitableDayMin\": 0,\n \"maxPayouts\": 5,\n \"payoutMllLockOffset\": 100,\n \"maxAccountDays\": 30,\n \"timeLimitExtensionDays\": 30,\n \"timeLimitExtensionMinProgressPct\": 50,\n \"maxInactiveDays\": 10,\n \"dailyLossOffThreshold\": 500,\n \"dailyLossOffMode\": \"while_above\",\n \"maxPositionByMarket\": {\n \"BINANCE\": 0.5\n },\n \"perpMaxLeverage\": 2,\n \"blockedSymbols\": [\n \"ES\",\n \"NQ\",\n \"YM\",\n \"RTY\",\n \"CL\",\n \"GC\"\n ],\n \"sessionWindowStart\": \"09:30\",\n \"sessionWindowEnd\": \"16:00\",\n \"sessionWindowTimezone\": \"America/New_York\",\n \"maxPositionByProduct\": {\n \"SIL\": 5\n },\n \"maxContracts\": 500000,\n \"microConversionRatio\": 5,\n \"scalingPlan\": {\n \"basis\": \"balance\",\n \"tiers\": [\n {\n \"profit\": 0,\n \"maxContracts\": 1\n },\n {\n \"profit\": 1000,\n \"maxContracts\": 2\n },\n {\n \"profit\": 3000,\n \"maxContracts\": 5.5\n }\n ]\n },\n \"personalRiskPolicy\": {\n \"dailyLossLimitMax\": 1000,\n \"dailyLossLimitDefault\": 500,\n \"requireDailyLossLimit\": true,\n \"maxTradesPerDayMax\": 20\n },\n \"metadata\": {\n \"version\": \"2.0\"\n },\n \"mergeMetadata\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Trading rule updated successfully",
"data": {
"id": "660e8400-e29b-41d4-a716-446655440000",
"name": "Updated Rule Name",
"profitTarget": 12000,
"maxLoss": 6000,
"consistency": 50,
"consistencyEnforced": true,
"consistencyBase": "<string>",
"consistencyTolerancePct": 123,
"consistencyLeniency": 123,
"consistencyMinDays": 123,
"consistencyProfitableDayMin": 123,
"maxPayouts": 123,
"payoutMllLockOffset": 123,
"maxAccountDays": 123,
"maxInactiveDays": 123,
"timeLimitExtensionDays": 123,
"timeLimitExtensionMinProgressPct": 123,
"dailyLossOffThreshold": 123,
"dailyLossOffMode": "while_above",
"updatedAt": "2025-02-17T14:30:00.000Z"
}
}{
"statusCode": 400,
"error": "Bad Request",
"message": "No valid fields to update",
"code": "NO_FIELDS_TO_UPDATE"
}{
"success": false,
"statusCode": 401,
"error": "Unauthorized",
"message": "Authentication required",
"code": "UNAUTHORIZED"
}{
"statusCode": 403,
"error": "Forbidden",
"message": "Only organization admins can perform this action",
"code": "NOT_ADMIN"
}{
"statusCode": 404,
"error": "Not Found",
"message": "Trading rule not found",
"code": "RULE_NOT_FOUND"
}{
"statusCode": 409,
"error": "Conflict",
"message": "A trading rule with this name already exists",
"code": "RULE_NAME_EXISTS"
}{
"success": false,
"statusCode": 500,
"error": "Internal Server Error",
"message": "An unexpected error occurred",
"code": "INTERNAL_ERROR"
}{
"success": false,
"statusCode": 503,
"error": "Service Unavailable",
"message": "The Idempotency-Key could not be recorded, so the request was not run. Retry with the same key.",
"code": "IDEMPOTENCY_UNAVAILABLE"
}Authorizations
Organization API key (hp_live_...), sent in the X-API-Key header. Create, rotate and restrict keys in the dashboard or with the API keys endpoints; an organization can have two active keys, so you can rotate without downtime. A full-access key can call every endpoint in this reference. A read-only key can call GET endpoints (and create a trading stream token); any other request returns 403 READ_ONLY_KEY. A key with an IP allowlist returns 403 IP_NOT_ALLOWED from any other address. Each endpoint lists which keys can call it under Access.
Headers
Optional. A value that identifies this operation on your side, at most 255 characters. A retry with the same key, method, path and body within 24 hours returns the original response (with Idempotency-Replayed: true) instead of repeating the change. The same key with a different body returns 409 IDEMPOTENCY_KEY_REUSED; a retry while the first request is still running returns 409 IDEMPOTENCY_KEY_IN_PROGRESS. A response that contains a credential (such as a new API key or signing secret) is not saved: the change is still not repeated, and a retry returns 409 IDEMPOTENCY_KEY_COMPLETED with the original status in originalStatus. Server errors (5xx) are not saved, so a retry runs again. If the key cannot be recorded, the request is not run and returns 503 IDEMPOTENCY_UNAVAILABLE; retry with the same key.
255Body
Unit of maxDrawdown. "percent" (default) = % of the reference. "dollars" = a fixed dollar amount below the reference — required for zero-based (e.g. $0 sim funded) accounts, where any percent of $0 is a $0 floor. Example: drawdownType "trailing" + denomination "dollars" + maxDrawdown 1000 = a $1,000 trailing max loss whose floor starts at -$1,000.
percent, dollars "percent"
For trailing drawdowns: the floor stops climbing once it reaches initialBalance + this many dollars and locks there (the "ceiling"). Example: 100 on a $0 sim funded locks the floor at +$100 once equity has peaked $1,100. null/absent = the floor trails forever.
0 <= x <= 100000000100
What the consistency % applies to. null (default) = automatic by account type: evaluation → max_target_or_pnl (cap grows once total PnL exceeds the target), sim_funded → cycle_profit (profit since the last consistency reset). max_profit_target_or_pnl is accepted as an alias of max_target_or_pnl.
max_target_or_pnl, max_profit_target_or_pnl, total_pnl, profit_target, cycle_profit "max_target_or_pnl"
Hard time limit in calendar days, counted from activation: when the trader redeemed the account's import key, or when the account was created if it was created for the trader (that day is day 1). The clock runs whether or not the account trades, and resets do not restart it. An in-progress account that has not passed by the end of the last day fails with ruleType time_limit_exceeded. 0 or null = no time limit (default).
0 <= x <= 365030
One-time extension of maxAccountDays. When an in-progress account reaches the end of its time limit with total profit (open positions included) strictly above timeLimitExtensionMinProgressPct % of profitTarget, it gets this many more calendar days instead of failing, and you receive account.time_limit_extended. Decided once per account, at the end of the time limit; an account that later falls back below the threshold keeps its extension. Has no effect without maxAccountDays and profitTarget. 0 or null = off (default).
0 <= x <= 365030
Progress required for the time-limit extension, as a whole percent (0-100) of profitTarget. Total profit must be strictly above it: with a $3,000 target and 50, $1,500.01 qualifies and exactly $1,500 does not. 0 = any profit above $0. Default 0.
0 <= x <= 10050
Consecutive calendar days without a fill after which the account fails with ruleType inactivity. Counted from the last fill, or from the start if the account has none. Holding an open position counts as activity. 0 or null = off (default).
0 <= x <= 365010
Switch the daily loss limit off once the account is this many dollars above its starting balance. Judged on the end-of-day balance (closed balance; open positions do not count; payouts and balance adjustments do) at each daily close: at or above starting balance + this amount, dailyLoss is not enforced from the next trading day, and you receive account.daily_loss_limit_off. Has no effect without dailyLoss. Every other rule, including dailyDrawdown, is unchanged. 0 or null = off (default).
0 <= x <= 10000000500
What happens after the daily loss limit is switched off. while_above (default): it is back on from the next trading day after an end-of-day balance below the target (account.daily_loss_limit_on). permanent: it stays off until the account is reset. null = while_above.
while_above, permanent "while_above"
Per-market position limits in each market's own unit — {"BINANCE": 0.5} is half a Bitcoin, not 500 of anything. A market listed here is measured against this limit instead of maxContracts, so it is never gated twice; markets left out fall back to maxContracts in mini-equivalents. Prefer this over maxContracts for any market whose contract steps fractionally.
{ "BINANCE": 0.5 }
Perpetuals: the largest total open position value, as a multiple of the account balance (2 = positions worth up to twice the balance). Open positions and working orders count; closing orders never do. Capped at the instrument's own maximum. Null = no leverage cap (maxPositionByMarket still applies). Does not affect futures.
1 <= x <= 10002
Contract roots that cannot be opened on accounts using this rule set. Use it for plans restricted to certain contracts, e.g. a micros-only plan lists the full-size contracts (ES, NQ, YM, RTY, CL, GC) and leaves MES, MNQ, MYM, M2K, MCL, MGC tradable. Roots are matched exactly, so ES never blocks MES. Only new positions are refused, with error code SYMBOL_BLOCKED_BY_PLAN; closing or reducing an existing position and take-profit / stop-loss exits are always allowed. Replaces the whole list; null or [] clears it so nothing is blocked. Omit to leave it unchanged.
100^[A-Z0-9]{1,12}$["ES", "NQ", "YM", "RTY", "CL", "GC"]
Start of the rule set's trading session (24-hour HH:MM, in sessionWindowTimezone). Send together with sessionWindowEnd; send both as null to remove the session. Outside the session new positions are refused with error code OUTSIDE_TRADING_SESSION; closing or reducing a position and take-profit / stop-loss exits are always allowed. At the session end open positions are closed and working orders cancelled. The market's own hours and your organization's session open delay and close buffer still apply, so trading is allowed only where they overlap.
^([01]\d|2[0-3]):[0-5]\d$"09:30"
Per-product position caps: contract root → the most contracts of that product an account may hold plus work on one side, e.g. {"SIL": 5} = at most 5 micro Silver long or 5 short. Counted in the product's own contracts across every contract month; open positions and working entry orders count, take-profit/stop-loss orders do not. Closing and reducing are always allowed, also on a position above a newly lowered cap. Applies on top of maxContracts / maxPositionByMarket (the stricter limit wins). Orders over the cap are rejected with PRODUCT_LIMIT_BY_PLAN. Roots are matched whole: a cap on SI does not cover SIL. null or {} removes every cap.
{ "SIL": 5 }
New max contracts limit (mini-equivalent units). A rule is not tied to a market, so this is always counted in ENGINE units: one unit is one futures contract, but 0.001 BTC on the Binance perpetual. A 0.1 BTC cap is therefore 100, and 1 BTC is 1000. Read quantityStep on the contract to convert.
0 <= x <= 1000000curl --request PATCH \
--url https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Updated Rule Name",
"description": "Updated description",
"profitTarget": 12000,
"dailyProfit": 50000000,
"dailyProfitEnforced": true,
"bestDayStopPct": 40,
"maxProfit": 50000000,
"dailyLossEntryBufferTicks": 4,
"dailyLoss": 3000,
"maxLoss": 6000,
"dailyDrawdown": 50,
"maxDrawdown": 50000000,
"drawdownDenomination": "percent",
"drawdownTrailCeiling": 100,
"newsTradingAllowed": true,
"microscalpingAllowed": true,
"weekendHoldingAllowed": true,
"overnightHoldingAllowed": true,
"consistency": 50,
"consistencyEnforced": true,
"consistencyBase": "max_target_or_pnl",
"consistencyTolerancePct": 0.2,
"consistencyLeniency": 40,
"consistencyMinDays": 2,
"consistencyProfitableDayMin": 0,
"maxPayouts": 5,
"payoutMllLockOffset": 100,
"maxAccountDays": 30,
"timeLimitExtensionDays": 30,
"timeLimitExtensionMinProgressPct": 50,
"maxInactiveDays": 10,
"dailyLossOffThreshold": 500,
"dailyLossOffMode": "while_above",
"maxPositionByMarket": {
"BINANCE": 0.5
},
"perpMaxLeverage": 2,
"blockedSymbols": [
"ES",
"NQ",
"YM",
"RTY",
"CL",
"GC"
],
"sessionWindowStart": "09:30",
"sessionWindowEnd": "16:00",
"sessionWindowTimezone": "America/New_York",
"maxPositionByProduct": {
"SIL": 5
},
"maxContracts": 500000,
"microConversionRatio": 5,
"scalingPlan": {
"basis": "balance",
"tiers": [
{
"profit": 0,
"maxContracts": 1
},
{
"profit": 1000,
"maxContracts": 2
},
{
"profit": 3000,
"maxContracts": 5.5
}
]
},
"personalRiskPolicy": {
"dailyLossLimitMax": 1000,
"dailyLossLimitDefault": 500,
"requireDailyLossLimit": true,
"maxTradesPerDayMax": 20
},
"metadata": {
"version": "2.0"
},
"mergeMetadata": true
}
'import requests
url = "https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}"
payload = {
"name": "Updated Rule Name",
"description": "Updated description",
"profitTarget": 12000,
"dailyProfit": 50000000,
"dailyProfitEnforced": True,
"bestDayStopPct": 40,
"maxProfit": 50000000,
"dailyLossEntryBufferTicks": 4,
"dailyLoss": 3000,
"maxLoss": 6000,
"dailyDrawdown": 50,
"maxDrawdown": 50000000,
"drawdownDenomination": "percent",
"drawdownTrailCeiling": 100,
"newsTradingAllowed": True,
"microscalpingAllowed": True,
"weekendHoldingAllowed": True,
"overnightHoldingAllowed": True,
"consistency": 50,
"consistencyEnforced": True,
"consistencyBase": "max_target_or_pnl",
"consistencyTolerancePct": 0.2,
"consistencyLeniency": 40,
"consistencyMinDays": 2,
"consistencyProfitableDayMin": 0,
"maxPayouts": 5,
"payoutMllLockOffset": 100,
"maxAccountDays": 30,
"timeLimitExtensionDays": 30,
"timeLimitExtensionMinProgressPct": 50,
"maxInactiveDays": 10,
"dailyLossOffThreshold": 500,
"dailyLossOffMode": "while_above",
"maxPositionByMarket": { "BINANCE": 0.5 },
"perpMaxLeverage": 2,
"blockedSymbols": ["ES", "NQ", "YM", "RTY", "CL", "GC"],
"sessionWindowStart": "09:30",
"sessionWindowEnd": "16:00",
"sessionWindowTimezone": "America/New_York",
"maxPositionByProduct": { "SIL": 5 },
"maxContracts": 500000,
"microConversionRatio": 5,
"scalingPlan": {
"basis": "balance",
"tiers": [
{
"profit": 0,
"maxContracts": 1
},
{
"profit": 1000,
"maxContracts": 2
},
{
"profit": 3000,
"maxContracts": 5.5
}
]
},
"personalRiskPolicy": {
"dailyLossLimitMax": 1000,
"dailyLossLimitDefault": 500,
"requireDailyLossLimit": True,
"maxTradesPerDayMax": 20
},
"metadata": { "version": "2.0" },
"mergeMetadata": True
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Updated Rule Name',
description: 'Updated description',
profitTarget: 12000,
dailyProfit: 50000000,
dailyProfitEnforced: true,
bestDayStopPct: 40,
maxProfit: 50000000,
dailyLossEntryBufferTicks: 4,
dailyLoss: 3000,
maxLoss: 6000,
dailyDrawdown: 50,
maxDrawdown: 50000000,
drawdownDenomination: 'percent',
drawdownTrailCeiling: 100,
newsTradingAllowed: true,
microscalpingAllowed: true,
weekendHoldingAllowed: true,
overnightHoldingAllowed: true,
consistency: 50,
consistencyEnforced: true,
consistencyBase: 'max_target_or_pnl',
consistencyTolerancePct: 0.2,
consistencyLeniency: 40,
consistencyMinDays: 2,
consistencyProfitableDayMin: 0,
maxPayouts: 5,
payoutMllLockOffset: 100,
maxAccountDays: 30,
timeLimitExtensionDays: 30,
timeLimitExtensionMinProgressPct: 50,
maxInactiveDays: 10,
dailyLossOffThreshold: 500,
dailyLossOffMode: 'while_above',
maxPositionByMarket: {BINANCE: 0.5},
perpMaxLeverage: 2,
blockedSymbols: ['ES', 'NQ', 'YM', 'RTY', 'CL', 'GC'],
sessionWindowStart: '09:30',
sessionWindowEnd: '16:00',
sessionWindowTimezone: 'America/New_York',
maxPositionByProduct: {SIL: 5},
maxContracts: 500000,
microConversionRatio: 5,
scalingPlan: {
basis: 'balance',
tiers: [
{profit: 0, maxContracts: 1},
{profit: 1000, maxContracts: 2},
{profit: 3000, maxContracts: 5.5}
]
},
personalRiskPolicy: {
dailyLossLimitMax: 1000,
dailyLossLimitDefault: 500,
requireDailyLossLimit: true,
maxTradesPerDayMax: 20
},
metadata: {version: '2.0'},
mergeMetadata: true
})
};
fetch('https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Updated Rule Name',
'description' => 'Updated description',
'profitTarget' => 12000,
'dailyProfit' => 50000000,
'dailyProfitEnforced' => true,
'bestDayStopPct' => 40,
'maxProfit' => 50000000,
'dailyLossEntryBufferTicks' => 4,
'dailyLoss' => 3000,
'maxLoss' => 6000,
'dailyDrawdown' => 50,
'maxDrawdown' => 50000000,
'drawdownDenomination' => 'percent',
'drawdownTrailCeiling' => 100,
'newsTradingAllowed' => true,
'microscalpingAllowed' => true,
'weekendHoldingAllowed' => true,
'overnightHoldingAllowed' => true,
'consistency' => 50,
'consistencyEnforced' => true,
'consistencyBase' => 'max_target_or_pnl',
'consistencyTolerancePct' => 0.2,
'consistencyLeniency' => 40,
'consistencyMinDays' => 2,
'consistencyProfitableDayMin' => 0,
'maxPayouts' => 5,
'payoutMllLockOffset' => 100,
'maxAccountDays' => 30,
'timeLimitExtensionDays' => 30,
'timeLimitExtensionMinProgressPct' => 50,
'maxInactiveDays' => 10,
'dailyLossOffThreshold' => 500,
'dailyLossOffMode' => 'while_above',
'maxPositionByMarket' => [
'BINANCE' => 0.5
],
'perpMaxLeverage' => 2,
'blockedSymbols' => [
'ES',
'NQ',
'YM',
'RTY',
'CL',
'GC'
],
'sessionWindowStart' => '09:30',
'sessionWindowEnd' => '16:00',
'sessionWindowTimezone' => 'America/New_York',
'maxPositionByProduct' => [
'SIL' => 5
],
'maxContracts' => 500000,
'microConversionRatio' => 5,
'scalingPlan' => [
'basis' => 'balance',
'tiers' => [
[
'profit' => 0,
'maxContracts' => 1
],
[
'profit' => 1000,
'maxContracts' => 2
],
[
'profit' => 3000,
'maxContracts' => 5.5
]
]
],
'personalRiskPolicy' => [
'dailyLossLimitMax' => 1000,
'dailyLossLimitDefault' => 500,
'requireDailyLossLimit' => true,
'maxTradesPerDayMax' => 20
],
'metadata' => [
'version' => '2.0'
],
'mergeMetadata' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}"
payload := strings.NewReader("{\n \"name\": \"Updated Rule Name\",\n \"description\": \"Updated description\",\n \"profitTarget\": 12000,\n \"dailyProfit\": 50000000,\n \"dailyProfitEnforced\": true,\n \"bestDayStopPct\": 40,\n \"maxProfit\": 50000000,\n \"dailyLossEntryBufferTicks\": 4,\n \"dailyLoss\": 3000,\n \"maxLoss\": 6000,\n \"dailyDrawdown\": 50,\n \"maxDrawdown\": 50000000,\n \"drawdownDenomination\": \"percent\",\n \"drawdownTrailCeiling\": 100,\n \"newsTradingAllowed\": true,\n \"microscalpingAllowed\": true,\n \"weekendHoldingAllowed\": true,\n \"overnightHoldingAllowed\": true,\n \"consistency\": 50,\n \"consistencyEnforced\": true,\n \"consistencyBase\": \"max_target_or_pnl\",\n \"consistencyTolerancePct\": 0.2,\n \"consistencyLeniency\": 40,\n \"consistencyMinDays\": 2,\n \"consistencyProfitableDayMin\": 0,\n \"maxPayouts\": 5,\n \"payoutMllLockOffset\": 100,\n \"maxAccountDays\": 30,\n \"timeLimitExtensionDays\": 30,\n \"timeLimitExtensionMinProgressPct\": 50,\n \"maxInactiveDays\": 10,\n \"dailyLossOffThreshold\": 500,\n \"dailyLossOffMode\": \"while_above\",\n \"maxPositionByMarket\": {\n \"BINANCE\": 0.5\n },\n \"perpMaxLeverage\": 2,\n \"blockedSymbols\": [\n \"ES\",\n \"NQ\",\n \"YM\",\n \"RTY\",\n \"CL\",\n \"GC\"\n ],\n \"sessionWindowStart\": \"09:30\",\n \"sessionWindowEnd\": \"16:00\",\n \"sessionWindowTimezone\": \"America/New_York\",\n \"maxPositionByProduct\": {\n \"SIL\": 5\n },\n \"maxContracts\": 500000,\n \"microConversionRatio\": 5,\n \"scalingPlan\": {\n \"basis\": \"balance\",\n \"tiers\": [\n {\n \"profit\": 0,\n \"maxContracts\": 1\n },\n {\n \"profit\": 1000,\n \"maxContracts\": 2\n },\n {\n \"profit\": 3000,\n \"maxContracts\": 5.5\n }\n ]\n },\n \"personalRiskPolicy\": {\n \"dailyLossLimitMax\": 1000,\n \"dailyLossLimitDefault\": 500,\n \"requireDailyLossLimit\": true,\n \"maxTradesPerDayMax\": 20\n },\n \"metadata\": {\n \"version\": \"2.0\"\n },\n \"mergeMetadata\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Rule Name\",\n \"description\": \"Updated description\",\n \"profitTarget\": 12000,\n \"dailyProfit\": 50000000,\n \"dailyProfitEnforced\": true,\n \"bestDayStopPct\": 40,\n \"maxProfit\": 50000000,\n \"dailyLossEntryBufferTicks\": 4,\n \"dailyLoss\": 3000,\n \"maxLoss\": 6000,\n \"dailyDrawdown\": 50,\n \"maxDrawdown\": 50000000,\n \"drawdownDenomination\": \"percent\",\n \"drawdownTrailCeiling\": 100,\n \"newsTradingAllowed\": true,\n \"microscalpingAllowed\": true,\n \"weekendHoldingAllowed\": true,\n \"overnightHoldingAllowed\": true,\n \"consistency\": 50,\n \"consistencyEnforced\": true,\n \"consistencyBase\": \"max_target_or_pnl\",\n \"consistencyTolerancePct\": 0.2,\n \"consistencyLeniency\": 40,\n \"consistencyMinDays\": 2,\n \"consistencyProfitableDayMin\": 0,\n \"maxPayouts\": 5,\n \"payoutMllLockOffset\": 100,\n \"maxAccountDays\": 30,\n \"timeLimitExtensionDays\": 30,\n \"timeLimitExtensionMinProgressPct\": 50,\n \"maxInactiveDays\": 10,\n \"dailyLossOffThreshold\": 500,\n \"dailyLossOffMode\": \"while_above\",\n \"maxPositionByMarket\": {\n \"BINANCE\": 0.5\n },\n \"perpMaxLeverage\": 2,\n \"blockedSymbols\": [\n \"ES\",\n \"NQ\",\n \"YM\",\n \"RTY\",\n \"CL\",\n \"GC\"\n ],\n \"sessionWindowStart\": \"09:30\",\n \"sessionWindowEnd\": \"16:00\",\n \"sessionWindowTimezone\": \"America/New_York\",\n \"maxPositionByProduct\": {\n \"SIL\": 5\n },\n \"maxContracts\": 500000,\n \"microConversionRatio\": 5,\n \"scalingPlan\": {\n \"basis\": \"balance\",\n \"tiers\": [\n {\n \"profit\": 0,\n \"maxContracts\": 1\n },\n {\n \"profit\": 1000,\n \"maxContracts\": 2\n },\n {\n \"profit\": 3000,\n \"maxContracts\": 5.5\n }\n ]\n },\n \"personalRiskPolicy\": {\n \"dailyLossLimitMax\": 1000,\n \"dailyLossLimitDefault\": 500,\n \"requireDailyLossLimit\": true,\n \"maxTradesPerDayMax\": 20\n },\n \"metadata\": {\n \"version\": \"2.0\"\n },\n \"mergeMetadata\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperprop.com/platform/v1/organization/trading-rules/{ruleId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Updated Rule Name\",\n \"description\": \"Updated description\",\n \"profitTarget\": 12000,\n \"dailyProfit\": 50000000,\n \"dailyProfitEnforced\": true,\n \"bestDayStopPct\": 40,\n \"maxProfit\": 50000000,\n \"dailyLossEntryBufferTicks\": 4,\n \"dailyLoss\": 3000,\n \"maxLoss\": 6000,\n \"dailyDrawdown\": 50,\n \"maxDrawdown\": 50000000,\n \"drawdownDenomination\": \"percent\",\n \"drawdownTrailCeiling\": 100,\n \"newsTradingAllowed\": true,\n \"microscalpingAllowed\": true,\n \"weekendHoldingAllowed\": true,\n \"overnightHoldingAllowed\": true,\n \"consistency\": 50,\n \"consistencyEnforced\": true,\n \"consistencyBase\": \"max_target_or_pnl\",\n \"consistencyTolerancePct\": 0.2,\n \"consistencyLeniency\": 40,\n \"consistencyMinDays\": 2,\n \"consistencyProfitableDayMin\": 0,\n \"maxPayouts\": 5,\n \"payoutMllLockOffset\": 100,\n \"maxAccountDays\": 30,\n \"timeLimitExtensionDays\": 30,\n \"timeLimitExtensionMinProgressPct\": 50,\n \"maxInactiveDays\": 10,\n \"dailyLossOffThreshold\": 500,\n \"dailyLossOffMode\": \"while_above\",\n \"maxPositionByMarket\": {\n \"BINANCE\": 0.5\n },\n \"perpMaxLeverage\": 2,\n \"blockedSymbols\": [\n \"ES\",\n \"NQ\",\n \"YM\",\n \"RTY\",\n \"CL\",\n \"GC\"\n ],\n \"sessionWindowStart\": \"09:30\",\n \"sessionWindowEnd\": \"16:00\",\n \"sessionWindowTimezone\": \"America/New_York\",\n \"maxPositionByProduct\": {\n \"SIL\": 5\n },\n \"maxContracts\": 500000,\n \"microConversionRatio\": 5,\n \"scalingPlan\": {\n \"basis\": \"balance\",\n \"tiers\": [\n {\n \"profit\": 0,\n \"maxContracts\": 1\n },\n {\n \"profit\": 1000,\n \"maxContracts\": 2\n },\n {\n \"profit\": 3000,\n \"maxContracts\": 5.5\n }\n ]\n },\n \"personalRiskPolicy\": {\n \"dailyLossLimitMax\": 1000,\n \"dailyLossLimitDefault\": 500,\n \"requireDailyLossLimit\": true,\n \"maxTradesPerDayMax\": 20\n },\n \"metadata\": {\n \"version\": \"2.0\"\n },\n \"mergeMetadata\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Trading rule updated successfully",
"data": {
"id": "660e8400-e29b-41d4-a716-446655440000",
"name": "Updated Rule Name",
"profitTarget": 12000,
"maxLoss": 6000,
"consistency": 50,
"consistencyEnforced": true,
"consistencyBase": "<string>",
"consistencyTolerancePct": 123,
"consistencyLeniency": 123,
"consistencyMinDays": 123,
"consistencyProfitableDayMin": 123,
"maxPayouts": 123,
"payoutMllLockOffset": 123,
"maxAccountDays": 123,
"maxInactiveDays": 123,
"timeLimitExtensionDays": 123,
"timeLimitExtensionMinProgressPct": 123,
"dailyLossOffThreshold": 123,
"dailyLossOffMode": "while_above",
"updatedAt": "2025-02-17T14:30:00.000Z"
}
}{
"statusCode": 400,
"error": "Bad Request",
"message": "No valid fields to update",
"code": "NO_FIELDS_TO_UPDATE"
}{
"success": false,
"statusCode": 401,
"error": "Unauthorized",
"message": "Authentication required",
"code": "UNAUTHORIZED"
}{
"statusCode": 403,
"error": "Forbidden",
"message": "Only organization admins can perform this action",
"code": "NOT_ADMIN"
}{
"statusCode": 404,
"error": "Not Found",
"message": "Trading rule not found",
"code": "RULE_NOT_FOUND"
}{
"statusCode": 409,
"error": "Conflict",
"message": "A trading rule with this name already exists",
"code": "RULE_NAME_EXISTS"
}{
"success": false,
"statusCode": 500,
"error": "Internal Server Error",
"message": "An unexpected error occurred",
"code": "INTERNAL_ERROR"
}{
"success": false,
"statusCode": 503,
"error": "Service Unavailable",
"message": "The Idempotency-Key could not be recorded, so the request was not run. Retry with the same key.",
"code": "IDEMPOTENCY_UNAVAILABLE"
}