Skip to content
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
67c12e4
working orderly connector, pmm avellaneda wip
bhanusanghi Nov 6, 2025
00bb87a
have differently defined spread level config for bid and spread
bhanusanghi Nov 7, 2025
6ce2fe6
fix: cleanup
bhanusanghi Nov 8, 2025
d405bb9
wip
bhanusanghi Nov 8, 2025
53e0d98
wip: connector update
bhanusanghi Nov 11, 2025
04e2674
wip corrects rate limits, better cancellation handling
bhanusanghi Nov 11, 2025
774121c
wip: strategy update
bhanusanghi Nov 11, 2025
50c6e68
fix: batch order creation and cancellation with proper tracking
bhanusanghi Nov 11, 2025
26eb5f1
fix: properly cancels and places new orders now
bhanusanghi Nov 11, 2025
badeb5f
Working multiple assets with batch requests, needs to send orders tog…
bhanusanghi Nov 11, 2025
ce8a719
working multi with batched orders
bhanusanghi Nov 11, 2025
bd92a3e
feature: adds mark price websocket listening
bhanusanghi Nov 12, 2025
f07fc8e
fix: working with correct position tracking
bhanusanghi Nov 12, 2025
b2696bf
fix: removes redundant position fetch in loop
bhanusanghi Nov 12, 2025
bbe0040
fix orphan orders due to async and race conditions
bhanusanghi Nov 12, 2025
259d57c
fix: order orphaning issue
bhanusanghi Nov 12, 2025
32e5dce
clamp reservation price calculation
berastotle Nov 12, 2025
de1e4fc
feature: adds bid size and ask size for weighted mid price calculation
bhanusanghi Nov 13, 2025
b27aee1
improve logic to deal with both mark and mid price
berastotle Nov 13, 2025
3a626f3
adds example config to be pushed
bhanusanghi Nov 13, 2025
ee59516
Merge branch 'feature/orderly' of github.com:Kodiak-Finance/humingbot…
bhanusanghi Nov 13, 2025
0c6ba9e
remove offending line
berastotle Nov 13, 2025
316f063
btc configs
berastotle Nov 13, 2025
b22e3dc
add eth config
berastotle Nov 13, 2025
eb6b81e
feature: adds order levels and order fill cooldown to the script
bhanusanghi Nov 13, 2025
39bd5ec
fix: updates the example configs for pmm_kodiak
bhanusanghi Nov 13, 2025
b44254a
feature: add volume logging
bhanusanghi Nov 13, 2025
0c7e602
Merge branch 'feature/orderly' of github.com:Kodiak-Finance/humingbot…
bhanusanghi Nov 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
570 changes: 570 additions & 0 deletions CONNECTOR_ARCHITECTURE_EXPLANATION.md

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions conf/scripts/Kodiak_btc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
exchange: orderly_perpetual
trading_pair: BTC-USDC
order_amount_quote: 20
bid_spread_levels: [0.0005]
ask_spread_levels: [0.0005]
order_refresh_time: 10
max_inventory: 0.002 # 200 usd
max_price_adjustment: 0.001 # 10 bps
leverage: 100
9 changes: 9 additions & 0 deletions conf/scripts/pmm_kodiak_example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
exchange: orderly_perpetual
trading_pair: BTC-USDC
order_amount_quote: 20
bid_spread_levels: [0.0005]
ask_spread_levels: [0.0005]
order_refresh_time: 10
max_inventory: 0.002 # 200 usd
max_price_adjustment: 0.001 # 10 bps
leverage: 100
Comment on lines +1 to +10
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Duplicate configuration files with identical content.

This file is identical to conf/scripts/Kodiak_btc.yml. Having two separate files with the same configuration creates maintenance burden and potential for drift. Clarify the purpose of both files—if they serve different use cases, document those differences clearly; otherwise, consolidate into a single example file.

🤖 Prompt for AI Agents
In conf/scripts/pmm_kodiak_example.yml lines 1-9 the configuration is identical
to conf/scripts/Kodiak_btc.yml, causing duplicate files and maintenance risk;
either consolidate by keeping a single canonical example (e.g.,
conf/scripts/kodiak_example.yml) and remove the duplicate, or if both must
exist, add a header comment in each file explaining their distinct purpose and
update any documentation or references to point to the canonical file; ensure
any CI/tests or docs that reference the removed filename are updated to the
retained name (or replace the duplicate with a short README or symlink) so no
references break.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify that 100x leverage is intentional and document associated risks.

The leverage value of 100 is extremely high and represents significant liquidation risk. Confirm this is:

  1. Intentional (not a typo or placeholder)
  2. Appropriate for the intended use case and acceptable risk tolerance
  3. Documented in strategy guidelines or risk management documentation

Consider adding a risk warning in accompanying documentation.



🏁 Script executed:

#!/bin/bash
# Examine the file and surrounding context
echo "=== File content: conf/scripts/pmm_kodiak_example.yml ==="
cat conf/scripts/pmm_kodiak_example.yml

echo -e "\n=== Search for other leverage values in the repository ==="
rg -i 'leverage' --type yaml -C 3

echo -e "\n=== Search for risk management or documentation files ==="
fd -e md -e txt -e rst | head -20 | xargs grep -l -i 'risk\|leverage' 2>/dev/null

echo -e "\n=== Check for other example or config files ==="
fd -e yml -e yaml | grep -E '(example|config|kodiak|pmm)' | head -20

Length of output: 20635


🏁 Script executed:

#!/bin/bash
echo "=== File content: conf/scripts/pmm_kodiak_example.yml ==="
cat conf/scripts/pmm_kodiak_example.yml

echo -e "\n=== Search for leverage values across YAML files ==="
rg -i 'leverage' --type yaml -C 2

echo -e "\n=== Search for documentation mentioning risk or leverage ==="
fd -type f \( -name "*.md" -o -name "*.txt" -o -name "*.rst" \) | xargs grep -l -i 'leverage\|risk' 2>/dev/null || echo "No matches found"

echo -e "\n=== List YAML/YML files that might be config or example related ==="
fd -type f \( -name "*.yml" -o -name "*.yaml" \) | head -30

Length of output: 16638


🏁 Script executed:

#!/bin/bash
# Search for leverage validation in the strategy and connector code
echo "=== Search for leverage validation or constraint checking ==="
rg -n 'leverage' --type py -C 3 | grep -iE '(valid|constraint|check|range|max|min|error)' | head -40

echo -e "\n=== Look for perpetual market making strategy files ==="
fd -type f -name "*perpetual*market*making*" --type f

echo -e "\n=== Search for orderly connector leverage handling ==="
fd -type f -path "*orderly*" -name "*.py" | head -20

echo -e "\n=== Check if leverage is validated before submission to exchange ==="
rg -n 'def.*leverage' --type py -A 5 | head -50

Length of output: 10409


🏁 Script executed:

#!/bin/bash
# Find orderly perpetual connector files
echo "=== Orderly perpetual connector files ==="
find . -path "*orderly*perpetual*" -name "*.py" | grep -v __pycache__ | grep -v test

echo -e "\n=== Search for set_leverage in orderly connector ==="
find . -path "*orderly*perpetual*" -name "*.py" -exec grep -l "set_leverage" {} \;

echo -e "\n=== Look for leverage validation or constraint checking in orderly ==="
find . -path "*orderly*perpetual*" -name "*.py" -exec grep -n "leverage" {} + | grep -iE "(valid|range|check|between|1.*50|max)" | head -20

Length of output: 1271


🏁 Script executed:

#!/bin/bash
# Extract the set_leverage method implementation
echo "=== set_leverage method in orderly_perpetual_derivative.py ==="
rg -A 30 'def set_leverage' hummingbot/connector/derivative/orderly_perpetual/orderly_perpetual_derivative.py

echo -e "\n=== Look for any validation or range checks ==="
rg -B 5 -A 10 'leverage' hummingbot/connector/derivative/orderly_perpetual/orderly_perpetual_derivative.py | grep -iE '(valid|range|check|error|exception|1.*50|between)' -A 2 -B 2 | head -40

Length of output: 806


🏁 Script executed:

#!/bin/bash
# Get the full _set_trading_pair_leverage method
echo "=== Full _set_trading_pair_leverage implementation ==="
rg -B 5 -A 50 'async def _set_trading_pair_leverage' hummingbot/connector/derivative/orderly_perpetual/orderly_perpetual_derivative.py

echo -e "\n=== Check for any leverage constraints in constants ==="
rg 'leverage' hummingbot/connector/derivative/orderly_perpetual/orderly_perpetual_constants.py | head -20

Length of output: 2370


Reduce leverage from 100 to valid range (1-50) per Orderly Perpetual API constraints.

The value 100 violates the Orderly Perpetual API's documented maximum leverage of 50 ("Integer between 1 to 50" per orderly_swagger.yml). The connector's _set_trading_pair_leverage method performs no client-side validation and passes the value directly to the API, where it will be rejected at runtime. Reduce to a valid value (e.g., 10-20 for a conservative example, or 50 for maximum).

🤖 Prompt for AI Agents
In conf/scripts/pmm_kodiak_example.yml around line 9 the leverage is set to 100
which exceeds the Orderly Perpetual API allowed range (1–50); change the
leverage value to a valid integer within 1–50 (for example 10, 20, or 50) so the
connector won’t pass an invalid value to the API and cause runtime rejection.

Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Dummy Cython header file for build system compatibility
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Dummy Cython file for build system compatibility
Loading